2 @package gui_core.prompt
4 @brief wxGUI command prompt
7 - prompt::PromptListCtrl
8 - prompt::TextCtrlAutoComplete
10 - prompt::GPromptPopUp
13 (C) 2009-2011 by the GRASS Development Team
15 This program is free software under the GNU General Public License
16 (>=v2). Read the file COPYING that comes with GRASS for details.
18 @author Martin Landa <landa.martin gmail.com>
19 @author Michael Barton <michael.barton@asu.edu>
20 @author Vaclav Petras <wenzeslaus gmail.com> (copy&paste customization)
30 import wx.lib.mixins.listctrl
as listmix
35 from core
import globalvar
36 from core
import utils
37 from lmgr.menudata
import ManagerData
38 from core.gcmd import EncodeString, DecodeString, GetRealCmd
41 """!PopUp window used by GPromptPopUp"""
42 def __init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition,
43 size = wx.DefaultSize, style = 0):
44 wx.ListCtrl.__init__(self, parent, id, pos, size, style)
45 listmix.ListCtrlAutoWidthMixin.__init__(self)
48 """!Auto complete text area used by GPromptPopUp"""
49 def __init__ (self, parent, statusbar,
50 id = wx.ID_ANY, choices = [], **kwargs):
51 """!Constructor works just like wx.TextCtrl except you can pass in a
52 list of choices. You can also change the choice list at any time
53 by calling setChoices.
55 Inspired by http://wiki.wxpython.org/TextCtrlAutoComplete
60 kwargs[
'style'] = wx.TE_PROCESS_ENTER | kwargs[
'style']
62 kwargs[
'style'] = wx.TE_PROCESS_ENTER
64 wx.ComboBox.__init__(self, parent, id, **kwargs)
71 self.
_screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
80 except NotImplementedError:
82 raise NotImplementedError
86 style = wx.LC_REPORT | wx.LC_SINGLE_SEL | \
87 wx.LC_SORT_ASCENDING | wx.LC_NO_HEADER,
90 listmix.ColumnSorterMixin.__init__(self, 1)
95 for type
in (
'raster',
'vector'):
96 self.
_choicesMap[type] = grass.list_strings(type = type[:4])
100 self.SetMinSize(self.GetSize())
105 self.Bind(wx.EVT_TEXT_ENTER, self.OnRunCmd)
106 self.Bind(wx.EVT_KEY_DOWN , self.
OnKeyDown)
111 self.dropdownlistbox.Bind(wx.EVT_LEFT_DOWN, self.
OnListClick)
112 self.dropdownlistbox.Bind(wx.EVT_LEFT_DCLICK, self.
OnListDClick)
113 self.dropdownlistbox.Bind(wx.EVT_LIST_COL_CLICK, self.
OnListColClick)
117 def _updateDataList(self, choices):
118 """!Update data list"""
120 if self.dropdownlistbox.GetColumnCount() != 0:
121 self.dropdownlistbox.DeleteAllColumns()
122 self.dropdownlistbox.DeleteAllItems()
125 for numVal, data
in enumerate(choices):
129 self.SetColumnCount(numVal)
131 def _setListSize(self):
135 for choice
in choices:
136 longest =
max(len(choice), longest)
138 itemcount =
min(len( choices ), 7) + 2
139 charheight = self.dropdownlistbox.GetCharHeight()
140 charwidth = self.dropdownlistbox.GetCharWidth()
141 self.
popupsize = wx.Size(charwidth*longest, charheight*itemcount)
142 self.dropdownlistbox.SetSize(self.
popupsize)
143 self.dropdown.SetClientSize(self.
popupsize)
145 def _showDropDown(self, show = True):
146 """!Either display the drop down list (show = True) or hide it
150 size = self.dropdown.GetSize()
151 width, height = self.GetSizeTuple()
152 x, y = self.ClientToScreenXY(0, height)
153 if size.GetWidth() != width:
155 self.dropdown.SetSize(size)
156 self.dropdownlistbox.SetSize(self.dropdown.GetClientSize())
158 self.dropdown.SetPosition(wx.Point(x, y))
160 self.dropdown.SetPosition(wx.Point(x, y - height - size.GetHeight()))
162 self.dropdown.Show(show)
164 def _listItemVisible(self):
165 """!Moves the selected item to the top of the list ensuring it is
168 toSel = self.dropdownlistbox.GetFirstSelected()
171 self.dropdownlistbox.EnsureVisible(toSel)
173 def _setModule(self, name):
174 """!Set module's choices (flags, parameters)"""
178 self.
_module = gtask.parse_interface(name)
183 self.
_choicesMap[
'flag'] = self._module.get_list_flags()
186 desc = self._module.get_flag(item)[
'label']
188 desc = self._module.get_flag(item)[
'description']
190 self.
_choicesMap[
'flag'][idx] =
'%s (%s)' % (item, desc)
193 self.
_choicesMap[
'param'] = self._module.get_list_params()
196 desc = self._module.get_param(item)[
'label']
198 desc = self._module.get_param(item)[
'description']
200 self.
_choicesMap[
'param'][idx] =
'%s (%s)' % (item, desc)
202 def _setValueFromSelected(self):
203 """!Sets the wx.TextCtrl value from the selected wx.ListCtrl item.
204 Will do nothing if no item is selected in the wx.ListCtrl.
206 sel = self.dropdownlistbox.GetFirstSelected()
214 itemtext = self.dropdownlistbox.GetItem(sel, col).GetText()
220 itemtext = itemtext.split(
' ')[0]
221 self.SetValue(
' '.join(cmd) +
' ' + itemtext +
'=')
222 optType = self._module.get_param(itemtext)[
'prompt']
223 if optType
in (
'raster',
'vector'):
227 itemtext = itemtext.split(
' ')[0]
228 if len(itemtext) > 1:
232 self.SetValue(
' '.join(cmd[:-1]) +
' ' + prefix + itemtext)
234 self.SetValue(
' '.join(cmd[:-1]) +
' ' + cmd[-1].
split(
'=', 1)[0] +
'=' + itemtext)
237 self.SetValue(itemtext +
' ')
246 self.SetInsertionPointEnd()
251 """!Method required by listmix.ColumnSorterMixin"""
255 """!Sets the choices available in the popup wx.ListBox.
256 The items will be sorted case insensitively.
258 @param choices list of choices
259 @param type type of choices (module, param, flag, raster, vector)
264 self.dropdownlistbox.SetWindowStyleFlag(wx.LC_REPORT | wx.LC_SINGLE_SEL |
265 wx.LC_SORT_ASCENDING | wx.LC_NO_HEADER)
266 if not isinstance(choices, list):
267 self.
_choices = [ x
for x
in choices ]
274 self.dropdownlistbox.InsertColumn(0,
"")
275 for num, colVal
in enumerate(self.
_choices):
276 index = self.dropdownlistbox.InsertImageStringItem(sys.maxint, colVal, -1)
277 self.dropdownlistbox.SetStringItem(index, 0, colVal)
278 self.dropdownlistbox.SetItemData(index, num)
286 """Left mouse button pressed"""
287 sel = self.dropdownlistbox.GetFirstSelected()
288 if not self.dropdown.IsShown():
290 self.dropdownlistbox.Select(sel)
292 self.dropdownlistbox.Select(0)
299 """!Command selected from history"""
300 self.
_historyItem = event.GetSelection() - len(self.GetItems())
304 """!Left mouse button pressed"""
305 toSel, flag = self.dropdownlistbox.HitTest( evt.GetPosition() )
307 if toSel == -1:
return
308 self.dropdownlistbox.Select(toSel)
311 """!Mouse button double click"""
315 """!Left mouse button pressed on column"""
316 col = evt.GetColumn()
320 self.SortListItems( evt.GetColumn(), ascending=self.
_ascending )
331 text = event.GetString()
335 if self.dropdown.IsShown():
342 except ValueError, e:
343 self.statusbar.SetStatusText(str(e))
344 cmd = text.split(
' ')
351 if len(cmd[-1].
split(
'=', 1)) == 1:
353 if cmd[-1][0] ==
'-':
356 pattern = cmd[-1].lstrip(
'-')
363 pattern = cmd[-1].
split(
'=', 1)[1]
376 for numCh, choice
in enumerate(choices):
377 if choice.lower().startswith(pattern):
381 item = self.dropdownlistbox.GetItem(numCh)
383 self.dropdownlistbox.Select(toSel)
387 self.dropdownlistbox.Select(self.dropdownlistbox.GetFirstSelected(),
False)
390 if self.
_module and '=' not in cmd[-1]:
392 if cmd[-1][0] ==
'-':
393 message = _(
"Warning: flag <%(flag)s> not found in '%(module)s'") % \
394 {
'flag' : cmd[-1][1:],
'module' : self._module.name }
396 message = _(
"Warning: option <%(param)s> not found in '%(module)s'") % \
397 {
'param' : cmd[-1],
'module' : self._module.name }
398 self.statusbar.SetStatusText(message)
400 if self.
_module and len(cmd[-1]) == 2
and cmd[-1][-2] ==
'=':
401 optType = self._module.get_param(cmd[-1][:-2])[
'prompt']
402 if optType
in (
'raster',
'vector'):
411 """!Do some work when the user press on the keys: up and down:
412 move the cursor left and right: move the search
415 sel = self.dropdownlistbox.GetFirstSelected()
416 visible = self.dropdown.IsShown()
417 KC = event.GetKeyCode()
419 if KC == wx.WXK_RIGHT:
421 if sel < (self.dropdownlistbox.GetItemCount() - 1):
422 self.dropdownlistbox.Select(sel + 1)
426 elif KC == wx.WXK_UP:
429 self.dropdownlistbox.Select(sel - 1)
439 elif KC == wx.WXK_DOWN:
441 if sel < (self.dropdownlistbox.GetItemCount() - 1):
442 self.dropdownlistbox.Select(sel + 1)
452 if event.GetKeyCode() == wx.WXK_RETURN:
455 if event.GetKeyCode() == wx.WXK_ESCAPE:
462 """!Control changed"""
469 """!Abstract class for interactive wxGUI prompt
471 See subclass GPromptPopUp and GPromptSTC.
477 if self.parent.parent.GetName()
not in (
"LayerManager",
"Modeler"):
484 if self.parent.parent.GetName() ==
'Modeler':
487 self.
moduleDesc = parent.parent.menubar.GetData().GetModules()
506 def _readHistory(self):
507 """!Get list of commands from history file"""
511 fileHistory = codecs.open(os.path.join(env[
'GISDBASE'],
512 env[
'LOCATION_NAME'],
515 encoding =
'utf-8', mode =
'r', errors='replace')
520 for line
in fileHistory.readlines():
521 hist.append(line.replace(
'\n',
''))
528 """!Get description for given command"""
535 """!Get list of available commands"""
546 prefixes = mList.keys()
549 for prefix
in prefixes:
550 for command
in mList[prefix]:
551 name = prefix +
'.' + command
552 if name
not in items:
559 def _getListOfModules(self):
560 """!Get list of modules"""
562 for module
in globalvar.grassCmd:
564 group, name = module.split(
'.',1)
568 if group
not in result:
569 result[group] = list()
570 result[group].append(name)
574 for i
in range(len(name.split(
'.'))-1):
575 group =
'.'.join([group,name.split(
'.',1)[0]])
576 name = name.split(
'.',1)[1]
577 if group
not in result:
578 result[group] = list()
579 result[group].append(name)
582 for group
in result.keys():
587 def _getListOfMaps(self):
588 """!Get list of maps"""
590 result[
'raster'] = grass.list_strings(
'rast')
591 result[
'vector'] = grass.list_strings(
'vect')
595 def _runCmd(self, cmdString):
598 @param cmdString command to run (given as a string)
600 if self.parent.GetName() ==
"ModelerDialog":
601 self.parent.OnOk(
None)
607 if cmdString[:2] ==
'd.' and not self.parent.parent.GetMapDisplay():
608 self.parent.parent.NewDisplay(show =
True)
610 self.commands.append(cmdString)
617 cmd = map(DecodeString, cmd)
620 if cmd[0]
in (
'r.mapcalc',
'r3.mapcalc')
and len(cmd) == 1:
621 self.parent.parent.OnMapCalculator(event =
None, cmd = cmd)
623 self.parent.RunCmd(cmd)
626 self.UpdateCmdHistory(cmd)
627 self.OnCmdErase(
None)
628 self.parent.parent.statusbar.SetStatusText(
'')
631 """!Update Layer Manager status bar"""
636 self.parent.parent.statusbar.SetStatusText(
"")
638 self.parent.parent.statusbar.SetStatusText(_(
"Type GRASS command and run by pressing ENTER"))
642 """!Get main widget panel"""
646 """!Get main prompt widget"""
652 @param data data dict
653 @param module True to filter modules, otherwise data
667 """!Get list of launched commands"""
671 """!Clear list of commands"""
675 """!Interactive wxGUI prompt - popup version"""
677 GPrompt.__init__(self, parent)
682 TextCtrlAutoComplete.__init__(self, parent = self.
panel, id = wx.ID_ANY,
684 style = wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
685 statusbar = self.parent.parent.statusbar)
687 except NotImplementedError:
690 wx.TextCtrl.__init__(parent = self.
panel, id = wx.ID_ANY,
692 style=wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
694 self.searchBy.Enable(
False)
695 self.search.Enable(
False)
697 self.SetFont(wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.NORMAL, 0,
''))
699 wx.CallAfter(self.SetInsertionPoint, 0)
702 self.Bind(wx.EVT_TEXT_ENTER, self.
OnRunCmd)
706 """!Erase command prompt"""
707 self.input.SetValue(
'')
711 self.
_runCmd(event.GetString())
714 """!Styled wxGUI prompt with autocomplete and calltips"""
715 def __init__(self, parent, id = wx.ID_ANY, margin = False):
716 GPrompt.__init__(self, parent)
717 wx.stc.StyledTextCtrl.__init__(self, self.
panel, id)
722 self.SetWrapMode(
True)
723 self.SetUndoCollection(
True)
728 self.AutoCompSetIgnoreCase(
False)
734 self.SetMarginWidth(1, 0)
735 self.SetMarginWidth(2, 0)
737 self.SetMarginType(0, wx.stc.STC_MARGIN_NUMBER)
738 self.SetMarginWidth(0, 30)
740 self.SetMarginWidth(0, 0)
745 self.SetViewWhiteSpace(
False)
746 self.SetUseTabs(
False)
748 self.SetSelBackground(
True,
"#FFFF00")
749 self.SetUseHorizontalScrollBar(
True)
754 self.Bind(wx.EVT_WINDOW_DESTROY, self.
OnDestroy)
755 self.Bind(wx.EVT_CHAR, self.
OnChar)
761 """!Copy selected text to clipboard and skip event.
762 The same function is in GMStc class (goutput.py).
768 """!Change text in statusbar
769 if the item selection in the auto-completion list is changed"""
780 desc = self.cmdDesc.get_flag(self.
autoCompList[event.GetIndex()])[
'description']
784 item = self.cmdDesc.get_param(self.
autoCompList[event.GetIndex()])
785 desc = item[
'name'] +
'=' + item[
'type']
786 if not item[
'required']:
787 desc =
'[' + desc +
']'
788 desc +=
': ' + item[
'description']
791 elif self.
toComplete[
'entity'] ==
'params+flags':
793 desc = self.cmdDesc.get_flag(self.
autoCompList[event.GetIndex()].strip(
'-'))[
'description']
795 item = self.cmdDesc.get_param(self.
autoCompList[event.GetIndex()])
796 desc = item[
'name'] +
'=' + item[
'type']
797 if not item[
'required']:
798 desc =
'[' + desc +
']'
799 desc +=
': ' + item[
'description']
805 """!Item selected from the list"""
808 match = difflib.SequenceMatcher(
None, event.GetText(), lastWord)
809 matchTuple = match.find_longest_match(0, len(event.GetText()), 0, len(lastWord))
811 compl = event.GetText()[matchTuple[2]:]
815 for char
in (
'.',
'-',
'='):
816 if text.split(
' ')[-1].find(char) >= 0:
824 self.SetCurrentPos(pos)
826 cmd = text.strip().
split(
' ')[0]
828 if not self.
cmdDesc or cmd != self.cmdDesc.get_name():
829 if cmd
in (
'r.mapcalc',
'v.type'):
830 cmd = cmd +
'_wrapper'
832 if cmd
in (
'r.mapcalc',
'r3.mapcalc')
and \
833 self.parent.parent.GetName() ==
'LayerManager':
834 self.parent.parent.OnMapCalculator(event =
None, cmd = [cmd])
845 """!Update command history
847 @param cmd command given as a list
850 self.cmdbuffer.append(
' '.join(cmd))
858 """!Determines which part of command (flags, parameters) should
859 be completed at current cursor position"""
861 toComplete = dict(cmd=
None, entity=
None)
863 cmd = entry.split()[0].strip()
871 if len(splitted) > 0
and cmd
in globalvar.grassCmd:
872 toComplete[
'cmd'] = cmd
874 words = entry.split(
' ')
875 if any(word.startswith(
'-')
for word
in words):
876 toComplete[
'entity'] =
'params'
878 toComplete[
'entity'] =
'params+flags'
883 if word[0] ==
'=' and word[-1] ==
'@':
884 toComplete[
'entity'] =
'mapsets'
887 paramName = self.
GetWordLeft(withDelimiter =
False, ignoredDelimiter =
'=').strip(
'=')
890 param = self.cmdDesc.get_param(paramName)
891 except (ValueError, AttributeError):
897 toComplete[
'entity'] =
'param values'
898 elif param[
'prompt'] ==
'raster' and param[
'element'] ==
'cell':
899 toComplete[
'entity'] =
'raster map'
900 elif param[
'prompt'] ==
'vector' and param[
'element'] ==
'vector':
901 toComplete[
'entity'] =
'vector map'
903 toComplete[
'entity'] =
'flags'
905 toComplete[
'entity'] =
'params'
907 toComplete[
'entity'] =
'command'
908 toComplete[
'cmd'] = cmd
912 def GetWordLeft(self, withDelimiter = False, ignoredDelimiter = None):
913 """!Get word left from current cursor position. The beginning
914 of the word is given by space or chars: .,-=
916 @param withDelimiter returns the word with the initial delimeter
917 @param ignoredDelimiter finds the word ignoring certain delimeter
922 if ignoredDelimiter
is None:
923 ignoredDelimiter =
''
925 for char
in set(
' .,-=') -
set(ignoredDelimiter):
926 if not withDelimiter:
930 parts.append(delimiter + textLeft.rpartition(char)[2])
931 return min(parts, key=
lambda x: len(x))
934 """!Show sorted auto-completion list if it is not empty"""
936 self.autoCompList.sort()
937 self.AutoCompShow(lenEntered = 0, itemList =
' '.join(self.
autoCompList))
940 """!Key pressed capture special treatment for tabulator to show help"""
941 pos = self.GetCurrentPos()
942 if event.GetKeyCode() == wx.WXK_TAB:
946 cmd = entry.split()[0].strip()
950 if cmd
not in globalvar.grassCmd:
955 self.CallTipSetBackground(
"#f4f4d1")
956 self.CallTipSetForeground(
"BLACK")
957 self.CallTipShow(pos, info[
'usage'] +
'\n\n' + info[
'description'])
958 elif event.GetKeyCode()
in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER)
and \
959 not self.AutoCompActive():
961 self.
_runCmd(self.GetCurLine()[0].strip())
962 elif event.GetKeyCode()
in [wx.WXK_UP, wx.WXK_DOWN]
and \
963 not self.AutoCompActive():
971 if event.GetKeyCode() == wx.WXK_UP:
973 if event.GetKeyCode() == wx.WXK_DOWN:
988 pos = self.GetCurrentPos()
989 self.InsertText(pos, txt)
997 """!Key char capture for autocompletion, calltips, and command history
999 @todo event.ControlDown() for manual autocomplete
1002 pos = self.GetCurrentPos()
1004 if event.GetKeyCode() == 46:
1007 self.InsertText(pos,
'.')
1012 for command
in globalvar.grassCmd:
1014 if command.find(self.
toComplete[
'cmd']) == 0:
1015 dotNumber = list(self.
toComplete[
'cmd']).count(
'.')
1016 self.autoCompList.append(command.split(
'.',dotNumber)[-1])
1017 except UnicodeDecodeError, e:
1018 sys.stderr.write(
DecodeString(command) +
": " + unicode(e))
1020 except (KeyError, TypeError):
1025 elif (event.GetKeyCode() == 45) \
1026 or event.GetKeyCode() == wx.WXK_NUMPAD_SUBTRACT \
1027 or event.GetKeyCode() == wx.WXK_SUBTRACT:
1030 self.InsertText(pos,
'-')
1035 for flag
in self.cmdDesc.get_options()[
'flags']:
1036 if len(flag[
'name']) == 1:
1037 self.autoCompList.append(flag[
'name'])
1039 for flag
in self.cmdDesc.get_options()[
'flags']:
1040 if len(flag[
'name']) > 1:
1041 self.autoCompList.append(flag[
'name'])
1045 elif event.GetKeyCode() == 61:
1047 self.InsertText(pos,
'=')
1050 if self.
toComplete[
'entity'] ==
'raster map':
1052 elif self.
toComplete[
'entity'] ==
'vector map':
1054 elif self.
toComplete[
'entity'] ==
'param values':
1055 param = self.
GetWordLeft(withDelimiter =
False, ignoredDelimiter=
'=').strip(
' =')
1056 self.
autoCompList = self.cmdDesc.get_param(param)[
'values']
1060 elif event.GetKeyCode() == 64:
1062 self.InsertText(pos,
'@')
1071 elif event.GetKeyCode() == wx.WXK_SPACE
and event.ControlDown():
1079 for command
in globalvar.grassCmd:
1080 if command.find(self.
toComplete[
'cmd']) == 0:
1081 dotNumber = list(self.
toComplete[
'cmd']).count(
'.')
1082 self.autoCompList.append(command.split(
'.',dotNumber)[-1])
1089 for flag
in self.cmdDesc.get_options()[
'flags']:
1090 if len(flag[
'name']) == 1:
1091 self.autoCompList.append(flag[
'name'])
1097 for param
in self.cmdDesc.get_options()[
'params']:
1098 if param[
'name'].find(self.
GetWordLeft(withDelimiter=
False)) == 0:
1099 self.autoCompList.append(param[
'name'])
1107 for param
in self.cmdDesc.get_options()[
'params']:
1108 self.autoCompList.append(param[
'name'])
1109 for flag
in self.cmdDesc.get_options()[
'flags']:
1110 if len(flag[
'name']) == 1:
1111 self.autoCompList.append(
'-' + flag[
'name'])
1113 self.autoCompList.append(
'--' + flag[
'name'])
1120 elif self.
toComplete[
'entity'] ==
'raster map':
1123 elif self.
toComplete[
'entity'] ==
'vector map':
1126 elif self.
toComplete[
'entity'] ==
'param values':
1128 param = self.
GetWordLeft(withDelimiter =
False, ignoredDelimiter=
'=').strip(
' =')
1129 self.
autoCompList = self.cmdDesc.get_param(param)[
'values']
1133 elif event.GetKeyCode() == wx.WXK_SPACE:
1136 cmd = items[0].strip()
1137 if cmd
in globalvar.grassCmd
and \
1138 cmd !=
'r.mapcalc' and \
1139 (
not self.
cmdDesc or cmd != self.cmdDesc.get_name()):
1151 """!Sets statusbar text, if it's too long, it is cut off"""
1152 maxLen = self.parent.parent.statusbar.GetFieldRect(0).GetWidth()/ 7
1153 if len(text) < maxLen:
1154 self.parent.parent.statusbar.SetStatusText(text)
1156 self.parent.parent.statusbar.SetStatusText(text[:maxLen]+
'...')
1160 """!Returns all text left of the caret"""
1161 pos = self.GetCurrentPos()
1163 entry = self.GetSelectedText()
1164 self.SetCurrentPos(pos)
1169 """!The clipboard contents can be preserved after
1170 the app has exited"""
1171 wx.TheClipboard.Flush()
1175 """!Erase command prompt"""
def GetCommandDesc
Get description for given command.
def __init__
Constructor works just like wx.TextCtrl except you can pass in a list of choices. ...
def EncodeString
Return encoded string using system locales.
def DecodeString
Decode string using system encoding.
def GetListCtrl
Method required by listmix.ColumnSorterMixin.
PopUp window used by GPromptPopUp.
def _listItemVisible
Moves the selected item to the top of the list ensuring it is always visible.
def _getListOfModules
Get list of modules.
def SetChoices
Sets the choices available in the popup wx.ListBox.
def OnTextSelectionChanged
Copy selected text to clipboard and skip event.
def OnUpdateStatusBar
Update Layer Manager status bar.
def ShowStatusText
Sets statusbar text, if it's too long, it is cut off.
def GetInput
Get main prompt widget.
def _setListSize
Set list size.
def GetRealCmd
Return real command name - only for MS Windows.
def GetWordLeft
Get word left from current cursor position.
def split
Platform spefic shlex.split.
def OnKeyPressed
Key pressed capture special treatment for tabulator to show help.
def ListOfMapsets
Get list of available/accessible mapsets.
def EntityToComplete
Determines which part of command (flags, parameters) should be completed at current cursor position...
def OnKeyDown
Do some work when the user press on the keys: up and down: move the cursor left and right: move the s...
def OnItemSelected
Item selected from the list.
def _setModule
Set module's choices (flags, parameters)
def _setValueFromSelected
Sets the wx.TextCtrl value from the selected wx.ListCtrl item.
def ListSortLower
Sort list items (not case-sensitive)
def OnCommandSelect
Command selected from history.
def OnListItemSelected
Item selected.
def OnItemChanged
Change text in statusbar if the item selection in the auto-completion list is changed.
Abstract class for interactive wxGUI prompt.
def GetCommands
Get list of launched commands.
def OnDestroy
The clipboard contents can be preserved after the app has exited.
def _updateDataList
Update data list.
def _getListOfMaps
Get list of maps.
def OnListClick
Left mouse button pressed.
def GetCommandItems
Get list of available commands.
def OnListColClick
Left mouse button pressed on column.
def ShowList
Show sorted auto-completion list if it is not empty.
def UpdateCmdHistory
Update command history.
def ClearCommands
Clear list of commands.
def OnEnteredText
Text entered.
def OnListDClick
Mouse button double click.
def _showDropDown
Either display the drop down list (show = True) or hide it (show = False).
def GetTextLeft
Returns all text left of the caret.
def OnChar
Key char capture for autocompletion, calltips, and command history.
Auto complete text area used by GPromptPopUp.
def OnControlChanged
Control changed.
Styled wxGUI prompt with autocomplete and calltips.
def _readHistory
Get list of commands from history file.
def OnCmdErase
Erase command prompt.
def GetPanel
Get main widget panel.