[GRASS-SVN] r37791 - in grass/trunk/gui/wxpython: . gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jun 9 14:18:52 EDT 2009
Author: martinl
Date: 2009-06-09 14:18:52 -0400 (Tue, 09 Jun 2009)
New Revision: 37791
Modified:
grass/trunk/gui/wxpython/gui_modules/prompt.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: fix interactive prompting (option not found)
Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py 2009-06-09 17:03:10 UTC (rev 37790)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py 2009-06-09 18:18:52 UTC (rev 37791)
@@ -70,7 +70,8 @@
cmdinput = TextCtrlAutoComplete(parent = cmdprompt, id = wx.ID_ANY,
value = "",
style = wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
- size = (-1, winHeight))
+ size = (-1, winHeight),
+ statusbar = self.parent.statusbar)
except NotImplementedError:
# wx.PopupWindow may be not available in wxMac
# see http://trac.wxwidgets.org/ticket/9377
@@ -218,13 +219,16 @@
listmix.ListCtrlAutoWidthMixin.__init__(self)
class TextCtrlAutoComplete(wx.TextCtrl, listmix.ColumnSorterMixin):
- def __init__ (self, parent, id = wx.ID_ANY, choices = [], **kwargs):
+ def __init__ (self, parent, statusbar,
+ id = wx.ID_ANY, choices = [], **kwargs):
"""!Constructor works just like wx.TextCtrl except you can pass in a
list of choices. You can also change the choice list at any time
by calling setChoices.
Inspired by http://wiki.wxpython.org/TextCtrlAutoComplete
"""
+ self.statusbar = statusbar
+
if kwargs.has_key('style'):
kwargs['style'] = wx.TE_PROCESS_ENTER | kwargs['style']
else:
@@ -482,13 +486,22 @@
self.dropdownlistbox.Select(self.dropdownlistbox.GetFirstSelected(), False)
if self._hideOnNoMatch:
self._showDropDown(False)
-
- if self._module and cmd[-1][-2] == '=':
- optType = self._module.get_param(cmd[-1][:-2])['prompt']
- if optType in ('raster', 'vector'):
- # -> raster/vector map
- self.SetChoices(self._choicesMap[optType], optType)
-
+ if self._module and '=' not in cmd[-1]:
+ message = ''
+ if cmd[-1][0] == '-': # flag
+ message = "Warning: flag <%s> not found in '%s'" % \
+ (cmd[-1][1:], self._module.name)
+ else: # option
+ message = "Warning: option <%s> not found in '%s'" % \
+ (cmd[-1], self._module.name)
+ self.statusbar.SetStatusText(message)
+
+ if self._module and len(cmd[-1]) == 2 and cmd[-1][-2] == '=':
+ optType = self._module.get_param(cmd[-1][:-2])['prompt']
+ if optType in ('raster', 'vector'):
+ # -> raster/vector map
+ self.SetChoices(self._choicesMap[optType], optType)
+
self._listItemVisible()
event.Skip()
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2009-06-09 17:03:10 UTC (rev 37790)
+++ grass/trunk/gui/wxpython/wxgui.py 2009-06-09 18:18:52 UTC (rev 37791)
@@ -127,10 +127,10 @@
# -> self.notebook, self.goutput, self.outpage
self.notebook = self.__createNoteBook()
self.menubar, self.menudata = self.__createMenuBar()
+ self.statusbar = self.CreateStatusBar(number=1)
self.cmdprompt, self.cmdinput = self.__createCommandPrompt()
self.toolbar = self.__createToolBar()
- self.statusbar = self.CreateStatusBar(number=1)
-
+
# bindings
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.Bind(wx.EVT_LEFT_DOWN, self.AddRaster, self.notebook)
More information about the grass-commit
mailing list