[GRASS-SVN] r53654 - grass/branches/develbranch_6/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 2 03:51:20 PDT 2012
Author: martinl
Date: 2012-11-02 03:51:19 -0700 (Fri, 02 Nov 2012)
New Revision: 53654
Modified:
grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py
Log:
wxGUI Modeler: select object on right click
(merge r53653 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py 2012-11-02 10:49:31 UTC (rev 53653)
+++ grass/branches/develbranch_6/gui/wxpython/gmodeler/frame.py 2012-11-02 10:51:19 UTC (rev 53654)
@@ -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:
@@ -1046,24 +1046,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:
@@ -1172,7 +1157,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'])
@@ -1226,6 +1214,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