[GRASS-SVN] r58604 - grass/trunk/gui/wxpython/gmodeler

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 4 08:40:39 PST 2014


Author: martinl
Date: 2014-01-04 08:40:37 -0800 (Sat, 04 Jan 2014)
New Revision: 58604

Modified:
   grass/trunk/gui/wxpython/gmodeler/dialogs.py
   grass/trunk/gui/wxpython/gmodeler/frame.py
Log:
wxGUI/modeler: allow multiple selection, label size column width

Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py	2014-01-04 04:11:39 UTC (rev 58603)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py	2014-01-04 16:40:37 UTC (rev 58604)
@@ -790,7 +790,8 @@
         ModelListCtrl.__init__(self, parent, columns, frame, **kwargs)
         self.itemIdMap = list()
         
-        self.SetColumnWidth(1, 100)
+        self.SetColumnWidth(0, 100)
+        self.SetColumnWidth(1, 75)
         self.SetColumnWidth(2, 65)
         
     def GetListCtrl(self):

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2014-01-04 04:11:39 UTC (rev 58603)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2014-01-04 16:40:37 UTC (rev 58604)
@@ -1084,7 +1084,17 @@
                 yNew += yBox * 3
 
         return xNew, yNew
-    
+
+    def GetShapesSelected(self):
+        """!Get list of selected shapes"""
+        selected = list()
+        diagram = self.GetDiagram()
+        for shape in diagram.GetShapeList():
+            if shape.Selected():
+                selected.append(shape)
+
+        return selected
+
 class ModelEvtHandler(ogl.ShapeEvtHandler):
     """!Model event handler class"""
     def __init__(self, log, frame):
@@ -1098,6 +1108,7 @@
         shape = self.GetShape()
         canvas = shape.GetCanvas()
         dc = wx.ClientDC(canvas)
+        
         # probably does nothing, removed from wxPython 2.9
         # canvas.PrepareDC(dc)
         
@@ -1128,7 +1139,7 @@
                 del self.frame.defineRelation
         
         # select object
-        self._onSelectShape(shape)
+        self._onSelectShape(shape, append = True if keys == 1 else False)
         
         if hasattr(shape, "GetLog"):
             self.log.SetStatusText(shape.GetLog(), 0)
@@ -1335,7 +1346,7 @@
             self.frame.ModelChanged()
         dlg.Destroy()
 
-    def _onSelectShape(self, shape):
+    def _onSelectShape(self, shape, append=False):
         canvas = shape.GetCanvas()
         dc = wx.ClientDC(canvas)
         
@@ -1346,9 +1357,10 @@
             shapeList = canvas.GetDiagram().GetShapeList()
             toUnselect = list()
             
-            for s in shapeList:
-                if s.Selected():
-                    toUnselect.append(s)
+            if not append:
+                for s in shapeList:
+                    if s.Selected():
+                        toUnselect.append(s)
             
             shape.Select(True, dc)
             



More information about the grass-commit mailing list