[GRASS-SVN] r40141 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 25 16:11:26 EST 2009
Author: martinl
Date: 2009-12-25 16:11:25 -0500 (Fri, 25 Dec 2009)
New Revision: 40141
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py
Log:
wxGUI/prompt: read cmd history on start-up
(merge r40140 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 20:37:11 UTC (rev 40140)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/prompt.py 2009-12-25 21:11:25 UTC (rev 40141)
@@ -517,8 +517,29 @@
# command description (menuform.grassTask)
self.cmdDesc = None
- self.cmdbuffer = list()
+ self.cmdbuffer = self._readHistory()
+ self.cmdindex = len(self.cmdbuffer)
+ def _readHistory(self):
+ """!Get list of commands from history file"""
+ hist = list()
+ env = grass.gisenv()
+ try:
+ fileHistory = open(os.path.join(env['GISDBASE'],
+ env['LOCATION_NAME'],
+ env['MAPSET'],
+ '.bash_history'), 'r')
+ except IOError:
+ return hist
+
+ try:
+ for line in fileHistory.readlines():
+ hist.append(line.replace('\n', ''))
+ finally:
+ fileHistory.close()
+
+ return hist
+
def _getListOfModules(self):
"""!Get list of modules"""
result = dict()
@@ -811,12 +832,9 @@
elif event.GetKeyCode() in [wx.WXK_UP, wx.WXK_DOWN] and event.ControlDown():
# Command history using ctrl-up and ctrl-down
-
if len(self.cmdbuffer) < 1:
return
- txt = ''
-
self.DocumentEnd()
# move through command history list index values
@@ -832,8 +850,8 @@
try:
txt = self.cmdbuffer[self.cmdindex]
except:
- pass
-
+ txt = ''
+
# clear current line and insert command history
self.DelLineLeft()
self.DelLineRight()
More information about the grass-commit
mailing list