[GRASS-SVN] r40144 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 25 16:41:28 EST 2009


Author: martinl
Date: 2009-12-25 16:41:28 -0500 (Fri, 25 Dec 2009)
New Revision: 40144

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/prompt: fix GPromptPopUp
	      (merge r40142 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-12-25 21:41:03 UTC (rev 40143)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py	2009-12-25 21:41:28 UTC (rev 40144)
@@ -97,12 +97,11 @@
         self.SetChoices(self._choicesCmd)
         
         self.SetMinSize(self.GetSize())
-        # read history
-        self.SetHistoryItems()
         
         # bindings...
         self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
         self.Bind(wx.EVT_TEXT, self.OnEnteredText)
+        self.Bind(wx.EVT_TEXT_ENTER, self.OnRunCmd)
         self.Bind(wx.EVT_KEY_DOWN , self.OnKeyDown)
         ### self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
 
@@ -251,30 +250,6 @@
         """!Method required by listmix.ColumnSorterMixin"""
         return self.dropdownlistbox
     
-    def SetHistoryItems(self):
-        """!Read history file and update combobox items"""
-        env = grass.gisenv()
-        try:
-            fileHistory = open(os.path.join(env['GISDBASE'],
-                                            env['LOCATION_NAME'],
-                                            env['MAPSET'],
-                                            '.bash_history'), 'r')
-        except IOError:
-            self.SetItems([])
-            return
-        
-        try:
-            hist = []
-            for line in fileHistory.readlines():
-                hist.append(line.replace('\n', ''))
-            
-            self.SetItems(hist)
-        finally:
-            fileHistory.close()
-            return
-        
-        self.SetItems([])
-        
     def SetChoices(self, choices, type = 'module'):
         """!Sets the choices available in the popup wx.ListBox.
         The items will be sorted case insensitively.
@@ -579,9 +554,9 @@
         
         cmd = shlex.split(str(cmdString))
         if len(cmd) > 1:
-            self.parent.goutput.RunCmd(cmd, switchPage = True)
+            self.parent.RunCmd(cmd, switchPage = True)
         else:
-            self.parent.goutput.RunCmd(cmd, switchPage = False)
+            self.parent.RunCmd(cmd, switchPage = False)
         
         self.OnUpdateStatusBar(None)
         
@@ -591,9 +566,9 @@
             return
         
         if event is None:
-            self.parent.statusbar.SetStatusText("")
+            self.parent.parent.statusbar.SetStatusText("")
         else:
-            self.parent.statusbar.SetStatusText(_("Type GRASS command and run by pressing ENTER"))
+            self.parent.parent.statusbar.SetStatusText(_("Type GRASS command and run by pressing ENTER"))
             event.Skip()
         
     def GetPanel(self):
@@ -616,6 +591,7 @@
                                           value = "",
                                           style = wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
                                           statusbar = self.parent.parent.statusbar)
+            self.SetItems(self._readHistory())
         except NotImplementedError:
             # wx.PopupWindow may be not available in wxMac
             # see http://trac.wxwidgets.org/ticket/9377



More information about the grass-commit mailing list