prompt.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. """
  2. @package gui_core.prompt
  3. @brief wxGUI command prompt
  4. Classes:
  5. - prompt::GPrompt
  6. - prompt::GPromptSTC
  7. (C) 2009-2014 by the GRASS Development Team
  8. This program is free software under the GNU General Public License
  9. (>=v2). Read the file COPYING that comes with GRASS for details.
  10. @author Martin Landa <landa.martin gmail.com>
  11. @author Michael Barton <michael.barton@asu.edu>
  12. @author Vaclav Petras <wenzeslaus gmail.com> (copy&paste customization)
  13. @author Wolf Bergenheim <wolf bergenheim.net> (#962)
  14. """
  15. import os
  16. import difflib
  17. import codecs
  18. import sys
  19. import wx
  20. import wx.stc
  21. from grass.script import core as grass
  22. from grass.script import task as gtask
  23. from grass.pydispatch.signal import Signal
  24. from core import globalvar
  25. from core import utils
  26. from core.gcmd import EncodeString, DecodeString
  27. class GPrompt(object):
  28. """Abstract class for interactive wxGUI prompt
  29. Signal promptRunCmd - emitted to run command from prompt
  30. - attribute 'cmd'
  31. See subclass GPromptPopUp and GPromptSTC.
  32. """
  33. def __init__(self, parent, giface, menuModel):
  34. self.parent = parent # GConsole
  35. self.panel = self.parent.GetPanel()
  36. self.promptRunCmd = Signal("GPrompt.promptRunCmd")
  37. # probably only subclasses need this
  38. self._menuModel = menuModel
  39. self.mapList = self._getListOfMaps()
  40. self.mapsetList = utils.ListOfMapsets()
  41. # auto complete items
  42. self.autoCompList = list()
  43. self.autoCompFilter = None
  44. # command description (gtask.grassTask)
  45. self.cmdDesc = None
  46. self._loadHistory()
  47. if giface:
  48. giface.currentMapsetChanged.connect(self._loadHistory)
  49. # list of traced commands
  50. self.commands = list()
  51. # reload map lists when needed
  52. if giface:
  53. giface.currentMapsetChanged.connect(self._reloadListOfMaps)
  54. giface.grassdbChanged.connect(self._reloadListOfMaps)
  55. def _readHistory(self):
  56. """Get list of commands from history file"""
  57. hist = list()
  58. env = grass.gisenv()
  59. try:
  60. fileHistory = codecs.open(
  61. os.path.join(
  62. env["GISDBASE"],
  63. env["LOCATION_NAME"],
  64. env["MAPSET"],
  65. ".wxgui_history",
  66. ),
  67. encoding="utf-8",
  68. mode="r",
  69. errors="replace",
  70. )
  71. except IOError:
  72. return hist
  73. try:
  74. for line in fileHistory.readlines():
  75. hist.append(line.replace("\n", ""))
  76. finally:
  77. fileHistory.close()
  78. return hist
  79. def _loadHistory(self):
  80. """Load history from a history file to data structures"""
  81. self.cmdbuffer = self._readHistory()
  82. self.cmdindex = len(self.cmdbuffer)
  83. def _getListOfMaps(self):
  84. """Get list of maps"""
  85. result = dict()
  86. result["raster"] = grass.list_strings("raster")
  87. result["vector"] = grass.list_strings("vector")
  88. return result
  89. def _reloadListOfMaps(self):
  90. self.mapList = self._getListOfMaps()
  91. def _runCmd(self, cmdString):
  92. """Run command
  93. :param str cmdString: command to run
  94. """
  95. if not cmdString:
  96. return
  97. # parse command into list
  98. try:
  99. cmd = utils.split(str(cmdString))
  100. except UnicodeError:
  101. cmd = utils.split(EncodeString((cmdString)))
  102. cmd = list(map(DecodeString, cmd))
  103. self.promptRunCmd.emit(cmd=cmd)
  104. self.OnCmdErase(None)
  105. self.ShowStatusText("")
  106. def GetCommands(self):
  107. """Get list of launched commands"""
  108. return self.commands
  109. def ClearCommands(self):
  110. """Clear list of commands"""
  111. del self.commands[:]
  112. class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
  113. """Styled wxGUI prompt with autocomplete and calltips"""
  114. def __init__(self, parent, giface, menuModel, margin=False):
  115. GPrompt.__init__(self, parent=parent, giface=giface, menuModel=menuModel)
  116. wx.stc.StyledTextCtrl.__init__(self, self.panel, id=wx.ID_ANY)
  117. #
  118. # styles
  119. #
  120. self.SetWrapMode(True)
  121. self.SetUndoCollection(True)
  122. #
  123. # create command and map lists for autocompletion
  124. #
  125. self.AutoCompSetIgnoreCase(False)
  126. #
  127. # line margins
  128. #
  129. # TODO print number only from cmdlog
  130. self.SetMarginWidth(1, 0)
  131. self.SetMarginWidth(2, 0)
  132. if margin:
  133. self.SetMarginType(0, wx.stc.STC_MARGIN_NUMBER)
  134. self.SetMarginWidth(0, 30)
  135. else:
  136. self.SetMarginWidth(0, 0)
  137. #
  138. # miscellaneous
  139. #
  140. self.SetViewWhiteSpace(False)
  141. self.SetUseTabs(False)
  142. self.UsePopUp(True)
  143. self.SetUseHorizontalScrollBar(True)
  144. # support light and dark mode
  145. bg_color = wx.SystemSettings().GetColour(wx.SYS_COLOUR_WINDOW)
  146. fg_color = wx.SystemSettings().GetColour(wx.SYS_COLOUR_WINDOWTEXT)
  147. selection_color = wx.SystemSettings().GetColour(wx.SYS_COLOUR_HIGHLIGHT)
  148. self.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, bg_color)
  149. self.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, fg_color)
  150. self.SetCaretForeground(fg_color)
  151. self.SetSelBackground(True, selection_color)
  152. self.StyleClearAll()
  153. #
  154. # bindings
  155. #
  156. self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
  157. self.Bind(wx.EVT_CHAR, self.OnChar)
  158. self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
  159. self.Bind(wx.stc.EVT_STC_AUTOCOMP_SELECTION, self.OnItemSelected)
  160. self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemChanged)
  161. if sys.platform != "darwin": # unstable on Mac with wxPython 3
  162. self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
  163. # signal which requests showing of a notification
  164. self.showNotification = Signal("GPromptSTC.showNotification")
  165. # signal to notify selected command
  166. self.commandSelected = Signal("GPromptSTC.commandSelected")
  167. def OnTextSelectionChanged(self, event):
  168. """Copy selected text to clipboard and skip event.
  169. The same function is in GStc class (goutput.py).
  170. """
  171. wx.CallAfter(self.Copy)
  172. event.Skip()
  173. def OnItemChanged(self, event):
  174. """Change text in statusbar
  175. if the item selection in the auto-completion list is changed"""
  176. # list of commands
  177. if self.toComplete["entity"] == "command":
  178. item = (
  179. self.toComplete["cmd"].rpartition(".")[0]
  180. + "."
  181. + self.autoCompList[event.GetIndex()]
  182. )
  183. try:
  184. nodes = self._menuModel.SearchNodes(key="command", value=item)
  185. desc = ""
  186. if nodes:
  187. self.commandSelected.emit(command=item)
  188. desc = nodes[0].data["description"]
  189. except KeyError:
  190. desc = ""
  191. self.ShowStatusText(desc)
  192. # list of flags
  193. elif self.toComplete["entity"] == "flags":
  194. desc = self.cmdDesc.get_flag(self.autoCompList[event.GetIndex()])[
  195. "description"
  196. ]
  197. self.ShowStatusText(desc)
  198. # list of parameters
  199. elif self.toComplete["entity"] == "params":
  200. item = self.cmdDesc.get_param(self.autoCompList[event.GetIndex()])
  201. desc = item["name"] + "=" + item["type"]
  202. if not item["required"]:
  203. desc = "[" + desc + "]"
  204. desc += ": " + item["description"]
  205. self.ShowStatusText(desc)
  206. # list of flags and commands
  207. elif self.toComplete["entity"] == "params+flags":
  208. if self.autoCompList[event.GetIndex()][0] == "-":
  209. desc = self.cmdDesc.get_flag(
  210. self.autoCompList[event.GetIndex()].strip("-")
  211. )["description"]
  212. else:
  213. item = self.cmdDesc.get_param(self.autoCompList[event.GetIndex()])
  214. desc = item["name"] + "=" + item["type"]
  215. if not item["required"]:
  216. desc = "[" + desc + "]"
  217. desc += ": " + item["description"]
  218. self.ShowStatusText(desc)
  219. else:
  220. self.ShowStatusText("")
  221. def OnItemSelected(self, event):
  222. """Item selected from the list"""
  223. lastWord = self.GetWordLeft()
  224. # to insert selection correctly if selected word partly matches written
  225. # text
  226. match = difflib.SequenceMatcher(None, event.GetText(), lastWord)
  227. matchTuple = match.find_longest_match(0, len(event.GetText()), 0, len(lastWord))
  228. compl = event.GetText()[matchTuple[2] :]
  229. text = self.GetTextLeft() + compl
  230. # add space or '=' at the end
  231. end = "="
  232. for char in (".", "-", "="):
  233. if text.split(" ")[-1].find(char) >= 0:
  234. end = " "
  235. compl += end
  236. text += end
  237. self.AddText(compl)
  238. pos = len(text)
  239. self.SetCurrentPos(pos)
  240. cmd = text.strip().split(" ")[0]
  241. if not self.cmdDesc or cmd != self.cmdDesc.get_name():
  242. try:
  243. self.cmdDesc = gtask.parse_interface(cmd)
  244. except IOError:
  245. self.cmdDesc = None
  246. def OnKillFocus(self, event):
  247. """Hides autocomplete"""
  248. # hide autocomplete
  249. if self.AutoCompActive():
  250. self.AutoCompCancel()
  251. event.Skip()
  252. def SetTextAndFocus(self, text):
  253. pos = len(text)
  254. self.commandSelected.emit(command=text)
  255. self.SetText(text)
  256. self.SetSelectionStart(pos)
  257. self.SetCurrentPos(pos)
  258. self.SetFocus()
  259. def UpdateCmdHistory(self, cmd):
  260. """Update command history
  261. :param cmd: command given as a string
  262. """
  263. # add command to history
  264. self.cmdbuffer.append(cmd)
  265. # update also traced commands
  266. self.commands.append(cmd)
  267. # keep command history to a manageable size
  268. if len(self.cmdbuffer) > 200:
  269. del self.cmdbuffer[0]
  270. self.cmdindex = len(self.cmdbuffer)
  271. def EntityToComplete(self):
  272. """Determines which part of command (flags, parameters) should
  273. be completed at current cursor position"""
  274. entry = self.GetTextLeft()
  275. toComplete = dict(cmd=None, entity=None)
  276. try:
  277. cmd = entry.split()[0].strip()
  278. except IndexError:
  279. return toComplete
  280. try:
  281. splitted = utils.split(str(entry))
  282. except ValueError: # No closing quotation error
  283. return toComplete
  284. if len(splitted) > 0 and cmd in globalvar.grassCmd:
  285. toComplete["cmd"] = cmd
  286. if entry[-1] == " ":
  287. words = entry.split(" ")
  288. if any(word.startswith("-") for word in words):
  289. toComplete["entity"] = "params"
  290. else:
  291. toComplete["entity"] = "params+flags"
  292. else:
  293. # get word left from current position
  294. word = self.GetWordLeft(withDelimiter=True)
  295. if word[0] == "=" and word[-1] == "@":
  296. toComplete["entity"] = "mapsets"
  297. elif word[0] == "=":
  298. # get name of parameter
  299. paramName = self.GetWordLeft(
  300. withDelimiter=False, ignoredDelimiter="="
  301. ).strip("=")
  302. if paramName:
  303. try:
  304. param = self.cmdDesc.get_param(paramName)
  305. except (ValueError, AttributeError):
  306. return toComplete
  307. else:
  308. return toComplete
  309. if param["values"]:
  310. toComplete["entity"] = "param values"
  311. elif param["prompt"] == "raster" and param["element"] == "cell":
  312. toComplete["entity"] = "raster map"
  313. elif param["prompt"] == "vector" and param["element"] == "vector":
  314. toComplete["entity"] = "vector map"
  315. elif word[0] == "-":
  316. toComplete["entity"] = "flags"
  317. elif word[0] == " ":
  318. toComplete["entity"] = "params"
  319. else:
  320. toComplete["entity"] = "command"
  321. toComplete["cmd"] = cmd
  322. return toComplete
  323. def GetWordLeft(self, withDelimiter=False, ignoredDelimiter=None):
  324. """Get word left from current cursor position. The beginning
  325. of the word is given by space or chars: .,-=
  326. :param withDelimiter: returns the word with the initial delimeter
  327. :param ignoredDelimiter: finds the word ignoring certain delimeter
  328. """
  329. textLeft = self.GetTextLeft()
  330. parts = list()
  331. if ignoredDelimiter is None:
  332. ignoredDelimiter = ""
  333. for char in set(" .,-=") - set(ignoredDelimiter):
  334. if not withDelimiter:
  335. delimiter = ""
  336. else:
  337. delimiter = char
  338. parts.append(delimiter + textLeft.rpartition(char)[2])
  339. return min(parts, key=lambda x: len(x))
  340. def ShowList(self):
  341. """Show sorted auto-completion list if it is not empty"""
  342. if len(self.autoCompList) > 0:
  343. self.autoCompList.sort()
  344. self.AutoCompShow(0, itemList=" ".join(self.autoCompList))
  345. def OnKeyPressed(self, event):
  346. """Key pressed capture special treatment for tabulator to show help"""
  347. pos = self.GetCurrentPos()
  348. if event.GetKeyCode() == wx.WXK_TAB:
  349. # show GRASS command calltips (to hide press 'ESC')
  350. entry = self.GetTextLeft()
  351. try:
  352. cmd = entry.split()[0].strip()
  353. except IndexError:
  354. cmd = ""
  355. if cmd not in globalvar.grassCmd:
  356. return
  357. info = gtask.command_info(cmd)
  358. self.CallTipSetBackground("#f4f4d1")
  359. self.CallTipSetForeground("BLACK")
  360. self.CallTipShow(pos, info["usage"] + "\n\n" + info["description"])
  361. elif (
  362. event.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER)
  363. and not self.AutoCompActive()
  364. ):
  365. # run command on line when <return> is pressed
  366. self._runCmd(self.GetCurLine()[0].strip())
  367. elif (
  368. event.GetKeyCode() in [wx.WXK_UP, wx.WXK_DOWN] and not self.AutoCompActive()
  369. ):
  370. # Command history using up and down
  371. if len(self.cmdbuffer) < 1:
  372. return
  373. self.DocumentEnd()
  374. # move through command history list index values
  375. if event.GetKeyCode() == wx.WXK_UP:
  376. self.cmdindex = self.cmdindex - 1
  377. if event.GetKeyCode() == wx.WXK_DOWN:
  378. self.cmdindex = self.cmdindex + 1
  379. if self.cmdindex < 0:
  380. self.cmdindex = 0
  381. if self.cmdindex > len(self.cmdbuffer) - 1:
  382. self.cmdindex = len(self.cmdbuffer) - 1
  383. try:
  384. # without strip causes problem on windows
  385. txt = self.cmdbuffer[self.cmdindex].strip()
  386. except KeyError:
  387. txt = ""
  388. # clear current line and insert command history
  389. self.DelLineLeft()
  390. self.DelLineRight()
  391. pos = self.GetCurrentPos()
  392. self.InsertText(pos, txt)
  393. self.LineEnd()
  394. self.ShowStatusText("")
  395. else:
  396. event.Skip()
  397. def OnChar(self, event):
  398. """Key char capture for autocompletion, calltips, and command history
  399. .. todo::
  400. event.ControlDown() for manual autocomplete
  401. """
  402. # keycodes used: "." = 46, "=" = 61, "-" = 45
  403. pos = self.GetCurrentPos()
  404. # complete command after pressing '.'
  405. if event.GetKeyCode() == 46:
  406. self.autoCompList = list()
  407. entry = self.GetTextLeft()
  408. self.InsertText(pos, ".")
  409. self.CharRight()
  410. self.toComplete = self.EntityToComplete()
  411. try:
  412. if self.toComplete["entity"] == "command":
  413. for command in globalvar.grassCmd:
  414. try:
  415. if command.find(self.toComplete["cmd"]) == 0:
  416. dotNumber = list(self.toComplete["cmd"]).count(".")
  417. self.autoCompList.append(
  418. command.split(".", dotNumber)[-1]
  419. )
  420. except UnicodeDecodeError as error:
  421. sys.stderr.write(DecodeString(command) + ": " + str(error))
  422. except (KeyError, TypeError):
  423. return
  424. self.ShowList()
  425. # complete flags after pressing '-'
  426. elif (
  427. (event.GetKeyCode() == 45)
  428. or event.GetKeyCode() == wx.WXK_NUMPAD_SUBTRACT
  429. or event.GetKeyCode() == wx.WXK_SUBTRACT
  430. ):
  431. self.autoCompList = list()
  432. entry = self.GetTextLeft()
  433. self.InsertText(pos, "-")
  434. self.CharRight()
  435. self.toComplete = self.EntityToComplete()
  436. if self.toComplete["entity"] == "flags" and self.cmdDesc:
  437. if self.GetTextLeft()[-2:] == " -": # complete e.g. --quite
  438. for flag in self.cmdDesc.get_options()["flags"]:
  439. if len(flag["name"]) == 1:
  440. self.autoCompList.append(flag["name"])
  441. else:
  442. for flag in self.cmdDesc.get_options()["flags"]:
  443. if len(flag["name"]) > 1:
  444. self.autoCompList.append(flag["name"])
  445. self.ShowList()
  446. # complete map or values after parameter
  447. elif event.GetKeyCode() == 61:
  448. self.autoCompList = list()
  449. self.InsertText(pos, "=")
  450. self.CharRight()
  451. self.toComplete = self.EntityToComplete()
  452. if self.toComplete["entity"] == "raster map":
  453. self.autoCompList = self.mapList["raster"]
  454. elif self.toComplete["entity"] == "vector map":
  455. self.autoCompList = self.mapList["vector"]
  456. elif self.toComplete["entity"] == "param values":
  457. param = self.GetWordLeft(
  458. withDelimiter=False, ignoredDelimiter="="
  459. ).strip(" =")
  460. self.autoCompList = self.cmdDesc.get_param(param)["values"]
  461. self.ShowList()
  462. # complete mapset ('@')
  463. elif event.GetKeyCode() == 64:
  464. self.autoCompList = list()
  465. self.InsertText(pos, "@")
  466. self.CharRight()
  467. self.toComplete = self.EntityToComplete()
  468. if self.toComplete["entity"] == "mapsets":
  469. self.autoCompList = self.mapsetList
  470. self.ShowList()
  471. # complete after pressing CTRL + Space
  472. elif event.GetKeyCode() == wx.WXK_SPACE and event.ControlDown():
  473. self.autoCompList = list()
  474. self.toComplete = self.EntityToComplete()
  475. # complete command
  476. if self.toComplete["entity"] == "command":
  477. for command in globalvar.grassCmd:
  478. if command.find(self.toComplete["cmd"]) == 0:
  479. dotNumber = list(self.toComplete["cmd"]).count(".")
  480. self.autoCompList.append(command.split(".", dotNumber)[-1])
  481. # complete flags in such situations (| is cursor):
  482. # r.colors -| ...w, q, l
  483. # r.colors -w| ...w, q, l
  484. elif self.toComplete["entity"] == "flags" and self.cmdDesc:
  485. for flag in self.cmdDesc.get_options()["flags"]:
  486. if len(flag["name"]) == 1:
  487. self.autoCompList.append(flag["name"])
  488. # complete parameters in such situations (| is cursor):
  489. # r.colors -w | ...color, map, rast, rules
  490. # r.colors col| ...color
  491. elif self.toComplete["entity"] == "params" and self.cmdDesc:
  492. for param in self.cmdDesc.get_options()["params"]:
  493. if param["name"].find(self.GetWordLeft(withDelimiter=False)) == 0:
  494. self.autoCompList.append(param["name"])
  495. # complete flags or parameters in such situations (| is cursor):
  496. # r.colors | ...-w, -q, -l, color, map, rast, rules
  497. # r.colors color=grey | ...-w, -q, -l, color, map, rast, rules
  498. elif self.toComplete["entity"] == "params+flags" and self.cmdDesc:
  499. self.autoCompList = list()
  500. for param in self.cmdDesc.get_options()["params"]:
  501. self.autoCompList.append(param["name"])
  502. for flag in self.cmdDesc.get_options()["flags"]:
  503. if len(flag["name"]) == 1:
  504. self.autoCompList.append("-" + flag["name"])
  505. else:
  506. self.autoCompList.append("--" + flag["name"])
  507. self.ShowList()
  508. # complete map or values after parameter
  509. # r.buffer input=| ...list of raster maps
  510. # r.buffer units=| ... feet, kilometers, ...
  511. elif self.toComplete["entity"] == "raster map":
  512. self.autoCompList = list()
  513. self.autoCompList = self.mapList["raster"]
  514. elif self.toComplete["entity"] == "vector map":
  515. self.autoCompList = list()
  516. self.autoCompList = self.mapList["vector"]
  517. elif self.toComplete["entity"] == "param values":
  518. self.autoCompList = list()
  519. param = self.GetWordLeft(
  520. withDelimiter=False, ignoredDelimiter="="
  521. ).strip(" =")
  522. self.autoCompList = self.cmdDesc.get_param(param)["values"]
  523. self.ShowList()
  524. elif event.GetKeyCode() == wx.WXK_SPACE:
  525. items = self.GetTextLeft().split()
  526. if len(items) == 1:
  527. cmd = items[0].strip()
  528. if cmd in globalvar.grassCmd and (
  529. not self.cmdDesc or cmd != self.cmdDesc.get_name()
  530. ):
  531. try:
  532. self.cmdDesc = gtask.parse_interface(cmd)
  533. except IOError:
  534. self.cmdDesc = None
  535. event.Skip()
  536. else:
  537. event.Skip()
  538. def ShowStatusText(self, text):
  539. """Requests showing of notification, e.g. showing in a statusbar."""
  540. self.showNotification.emit(message=text)
  541. def GetTextLeft(self):
  542. """Returns all text left of the caret"""
  543. pos = self.GetCurrentPos()
  544. self.HomeExtend()
  545. entry = self.GetSelectedText()
  546. self.SetCurrentPos(pos)
  547. return entry
  548. def OnDestroy(self, event):
  549. """The clipboard contents can be preserved after
  550. the app has exited"""
  551. if wx.TheClipboard.IsOpened():
  552. wx.TheClipboard.Flush()
  553. event.Skip()
  554. def OnCmdErase(self, event):
  555. """Erase command prompt"""
  556. self.Home()
  557. self.DelLineRight()