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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 29 15:39:27 EDT 2011


Author: martinl
Date: 2011-08-29 12:39:27 -0700 (Mon, 29 Aug 2011)
New Revision: 47958

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: only output name editable in gdialogs.ImportDialog
       (merge r47957 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-08-29 19:36:51 UTC (rev 47957)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2011-08-29 19:39:27 UTC (rev 47958)
@@ -32,6 +32,7 @@
 import os
 import sys
 import re
+from bisect import bisect
 
 import wx
 import wx.lib.filebrowsebutton as filebrowse
@@ -1451,9 +1452,9 @@
         listmix.ListCtrlAutoWidthMixin.__init__(self)
         listmix.TextEditMixin.__init__(self)
 
-        self.InsertColumn(0, _('Layer'))
+        self.InsertColumn(0, _('Layer id'))
         self.InsertColumn(1, _('Layer name'))
-        self.InsertColumn(2, _('Name for GRASS map'))
+        self.InsertColumn(2, _('Name for GRASS map (editable)'))
         
         self.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnPopupMenu) #wxMSW
         self.Bind(wx.EVT_RIGHT_UP,            self.OnPopupMenu) #wxGTK
@@ -1470,9 +1471,9 @@
             self.SetStringItem(index, 1, "%s" % str(name))
             self.SetStringItem(index, 2, "%s" % str(grassName))
             # check by default
-            self.CheckItem(index, True)
+            ### self.CheckItem(index, True)
         
-        self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE_USEHEADER)
+        self.SetColumnWidth(col = 0, width = wx.LIST_AUTOSIZE_USEHEADER)
 
     def OnPopupMenu(self, event):
         """!Show popup menu"""
@@ -1518,6 +1519,26 @@
 
         event.Skip()
         
+    def OnLeftDown(self, event):
+        """!Allow editing only output name
+
+        Code taken from TextEditMixin class.
+        """
+        x, y = event.GetPosition()
+        
+        colLocs = [0]
+        loc = 0
+        for n in range(self.GetColumnCount()):
+            loc = loc + self.GetColumnWidth(n)
+            colLocs.append(loc)
+        
+        col = bisect(colLocs, x + self.GetScrollPos(wx.HORIZONTAL)) - 1
+        
+        if col == 2:
+            listmix.TextEditMixin.OnLeftDown(self, event)
+        else:
+            event.Skip()
+        
     def GetLayers(self):
         """!Get list of layers (layer name, output name)"""
         data = []



More information about the grass-commit mailing list