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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 21 02:22:34 EST 2009


Author: cmbarton
Date: 2009-12-21 02:22:32 -0500 (Mon, 21 Dec 2009)
New Revision: 40099

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
Log:
Fix clear output and trapping errant key presses in output window.

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2009-12-20 23:44:04 UTC (rev 40098)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2009-12-21 07:22:32 UTC (rev 40099)
@@ -241,7 +241,7 @@
         boxsizer.Add(item=buttonsizer, proportion=0,
                       flag=wx.ALIGN_CENTER)
         
-        boxsizer.Add(item=self.console_progressbar, proportion=1,
+        boxsizer.Add(item=self.console_progressbar, proportion=0,
                       flag=wx.EXPAND | wx.ALIGN_CENTRE_VERTICAL | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=3)
         
         boxsizer.Fit(self)
@@ -379,9 +379,6 @@
                 self.parent.cmdinput.SetHistoryItems()
             except AttributeError:
                 pass
-
-        # allow writing to output window
-        self.cmd_output.SetReadOnly(False)
                 
         if cmdlist[0] in globalvar.grassCmd['all']:
             # send GRASS command without arguments to GUI command interface
@@ -471,9 +468,6 @@
             self.btn_abort.Enable()
             self.cmd_output_timer.Start(50)
 
-        # reset output window to read only
-        self.cmd_output.SetReadOnly(True)
-        
         return None
 
     def ClearHistory(self, event):
@@ -785,7 +779,6 @@
         wx.stc.StyledTextCtrl.__init__(self, parent, id)
         self.parent = parent
         self.SetUndoCollection(True)
-        self.SetReadOnly(True)
 
         #
         # styles
@@ -818,7 +811,19 @@
         # bindings
         #
         self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
+        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
+
+    def OnKeyPressed(self, event):
+        """!Traps key presses so that the STC behaves like read only to
+        key presses, but not to logged output or errors. Exception for 
+        key press modified by ctrl or cmd (Mac) to allow cut, copy, paste
+        through key filter"""
         
+        if event.ControlDown() or event.CmdDown():
+            event.Skip()
+        else:
+            return
+        
     def SetStyle(self):
         """!Set styles for styled text output windows with type face 
         and point size selected by user (Courier New 10 is default)"""



More information about the grass-commit mailing list