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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 2 03:49:32 PDT 2012


Author: martinl
Date: 2012-11-02 03:49:31 -0700 (Fri, 02 Nov 2012)
New Revision: 53653

Modified:
   grass/trunk/gui/wxpython/gmodeler/frame.py
Log:
wxGUI Modeler: select object on right click


Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2012-11-02 09:49:56 UTC (rev 53652)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2012-11-02 10:49:31 UTC (rev 53653)
@@ -120,8 +120,8 @@
         self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
         
         self._layout()
-        self.SetMinSize((475, 300))
-        self.SetSize((640, 480))
+        self.SetMinSize((640, 300))
+        self.SetSize((800, 600))
         
         # fix goutput's pane size
         if self.goutput:
@@ -1045,24 +1045,9 @@
                     dlg.Destroy()
                 del self.frame.defineRelation
         
-        if shape.Selected():
-            shape.Select(False, dc)
-        else:
-            redraw = False
-            shapeList = canvas.GetDiagram().GetShapeList()
-            toUnselect = list()
-            
-            for s in shapeList:
-                if s.Selected():
-                    toUnselect.append(s)
-            
-            shape.Select(True, dc)
-            
-            for s in toUnselect:
-                s.Select(False, dc)
-                
-        canvas.Refresh(False)
-
+        # select object
+        self._onSelectShape(shape)
+        
         if hasattr(shape, "GetLog"):
             self.log.SetStatusText(shape.GetLog(), 0)
         else:
@@ -1171,7 +1156,10 @@
         self.x = x
         self.y = y
         
+        # select object
         shape = self.GetShape()
+        self._onSelectShape(shape)
+        
         popupMenu = wx.Menu()
         popupMenu.Append(self.popupID['remove'], text=_('Remove'))
         self.frame.Bind(wx.EVT_MENU, self.OnRemove, id = self.popupID['remove'])
@@ -1225,6 +1213,28 @@
         self.frame.ModelChanged()
         self.frame.canvas.Refresh()
         
+    def _onSelectShape(self, shape):
+        canvas = shape.GetCanvas()
+        dc = wx.ClientDC(canvas)
+        
+        if shape.Selected():
+            shape.Select(False, dc)
+        else:
+            redraw = False
+            shapeList = canvas.GetDiagram().GetShapeList()
+            toUnselect = list()
+            
+            for s in shapeList:
+                if s.Selected():
+                    toUnselect.append(s)
+            
+            shape.Select(True, dc)
+            
+            for s in toUnselect:
+                s.Select(False, dc)
+        
+        canvas.Refresh(False)
+        
     def OnAddPoint(self, event):
         """!Add control point"""
         shape = self.GetShape()



More information about the grass-commit mailing list