[GRASS-SVN] r46609 - in grass/branches/releasebranch_6_4/gui/wxpython: . docs gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 8 05:23:57 EDT 2011


Author: martinl
Date: 2011-06-08 02:23:57 -0700 (Wed, 08 Jun 2011)
New Revision: 46609

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/docs/wxGUI.html
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
   grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
wxGUI: copy&paste customization (done by Vaclav Petras)
      (merge r46607 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/docs/wxGUI.html
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/docs/wxGUI.html	2011-06-08 09:20:38 UTC (rev 46608)
+++ grass/branches/releasebranch_6_4/gui/wxpython/docs/wxGUI.html	2011-06-08 09:23:57 UTC (rev 46609)
@@ -585,7 +585,8 @@
 Daniel Calvelo Aros<br>
 Jachym Cepicky<br>
 Markus Metz, Germany<br>
-Anna Kratochvilova, <a href="http://www.cvut.cz">Czech Technical University in Prague</a>, Czech Republic<br><br>
+Anna Kratochvilova, <a href="http://www.cvut.cz">Czech Technical University in Prague</a>, Czech Republic<br>
+Vaclav Petras, <a href="http://www.cvut.cz">Czech Technical University in Prague</a>, Czech Republic<br><br>
 
 Icons created by <a href="http://robert.szczepanek.pl">Robert Szczepanek</a>, Poland (<a href="https://svn.osgeo.org/osgeo/graphics/trunk/toolbar-icons/24x24/">SVN</a>)
 

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-06-08 09:20:38 UTC (rev 46608)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-06-08 09:23:57 UTC (rev 46609)
@@ -9,13 +9,14 @@
  - GMStdout
  - GMStderr
 
-(C) 2007-2010 by the GRASS Development Team
+(C) 2007-2011 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
 @author Michael Barton (Arizona State University)
 @author Martin Landa <landa.martin gmail.com>
+ at author Vaclav Petras <wenzeslaus gmail.com> (copy&paste customization)
 """
 
 import os
@@ -619,6 +620,19 @@
         """!Get running command or None"""
         return self.requestQ.get()
     
+    def SetCopyingOfSelectedText(self, copy):
+        """!Enable or disable copying of selected text in to clipboard.
+        Effects prompt and output.
+        
+        @param copy True for enable, False for disable
+        """
+        if copy:
+            self.cmd_prompt.Bind(wx.stc.EVT_STC_PAINTED, self.cmd_prompt.OnTextSelectionChanged)
+            self.cmd_output.Bind(wx.stc.EVT_STC_PAINTED, self.cmd_output.OnTextSelectionChanged)
+        else:
+            self.cmd_prompt.Unbind(wx.stc.EVT_STC_PAINTED)
+            self.cmd_output.Unbind(wx.stc.EVT_STC_PAINTED)
+        
     def OnUpdateStatusBar(self, event):
         """!Update statusbar text"""
         if event.GetString():
@@ -991,6 +1005,13 @@
         #
         self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
         
+    def OnTextSelectionChanged(self, event):
+        """!Copy selected text to clipboard and skip event.
+        The same function is in TextCtrlAutoComplete class (prompt.py).
+        """
+        self.Copy()
+        event.Skip()
+        
     def SetStyle(self):
         """!Set styles for styled text output windows with type face 
         and point size selected by user (Courier New 10 is default)"""

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py	2011-06-08 09:20:38 UTC (rev 46608)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py	2011-06-08 09:23:57 UTC (rev 46609)
@@ -117,6 +117,9 @@
                     'search' : False,
                     'pyshell' : False,
                     },
+                'copySelectedTextToClipboard' : {
+                    'enabled' : False
+                    },
                 },
             #
             # appearance
@@ -1145,6 +1148,19 @@
         gridSizer.Add(item = hidePyShell,
                       pos = (row, 0), span = (1, 2))
         
+        #
+        # Selected text is copied to clipboard
+        #
+        row += 1
+        copySelectedTextToClipboard = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+                                                  label = _("Automatically copy selected text to clipboard (in Command console)"),
+                                                  name = 'IsChecked')
+        copySelectedTextToClipboard.SetValue(self.settings.Get(group = 'manager', key = 'copySelectedTextToClipboard', subkey = 'enabled'))
+        self.winId['manager:copySelectedTextToClipboard:enabled'] = copySelectedTextToClipboard.GetId()
+        
+        gridSizer.Add(item = copySelectedTextToClipboard,
+                      pos = (row, 0), span = (1, 2))
+        
         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
         border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
         

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2011-06-08 09:20:38 UTC (rev 46608)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/prompt.py	2011-06-08 09:23:57 UTC (rev 46609)
@@ -10,13 +10,14 @@
  - GPromptPopUp
  - GPromptSTC
 
-(C) 2009-2010 by the GRASS Development Team
+(C) 2009-2011 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
 @author Martin Landa <landa.martin gmail.com>
 @author Michael Barton <michael.barton at asu.edu>
+ at author Vaclav Petras <wenzeslaus gmail.com> (copy&paste customization)
 """
 
 import os
@@ -706,6 +707,13 @@
         self.Bind(wx.stc.EVT_STC_AUTOCOMP_SELECTION, self.OnItemSelected)
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemChanged)
         
+    def OnTextSelectionChanged(self, event):
+        """!Copy selected text to clipboard and skip event.
+        The same function is in GMStc class (goutput.py).
+        """
+        self.Copy()
+        event.Skip()
+        
     def OnItemChanged(self, event):
         """!Change text in statusbar 
         if the item selection in the auto-completion list is changed"""

Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2011-06-08 09:20:38 UTC (rev 46608)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py	2011-06-08 09:23:57 UTC (rev 46609)
@@ -232,6 +232,10 @@
         self.SetMenuBar(self.menubar)
         self.menucmd = self.menubar.GetCmd()
         
+    def _setCopyingOfSelectedText(self):
+        copy = UserSettings.Get(group = 'manager', key = 'copySelectedTextToClipboard', subkey = 'enabled')
+        self.goutput.SetCopyingOfSelectedText(copy)
+        
     def _createNoteBook(self):
         """!Creates notebook widgets"""
         self.notebook = menuform.GNotebook(parent = self, style = globalvar.FNPageDStyle)
@@ -247,6 +251,7 @@
         # create 'command output' text area
         self.goutput = goutput.GMConsole(self)
         self.notebook.AddPage(page = self.goutput, text = _("Command console"), name = 'console')
+        self._setCopyingOfSelectedText()
         
         # create 'search module' notebook page
         if not UserSettings.Get(group = 'manager', key = 'hideTabs', subkey = 'search'):
@@ -293,9 +298,10 @@
         
     def OnSettingsChanged(self, event):
         """!Here can be functions which have to be called after EVT_SETTINGS_CHANGED. 
-        Now recreates menu only.
+        Now recreates menu and set copying of selected text to clipboard (in goutput).
         """
         self._createMenuBar()
+        self._setCopyingOfSelectedText()
         
     def OnGCPManager(self, event):
         """!Launch georectifier module



More information about the grass-commit mailing list