[GRASS-SVN] r58613 - grass/trunk/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 5 05:56:47 PST 2014
Author: martinl
Date: 2014-01-05 05:56:47 -0800 (Sun, 05 Jan 2014)
New Revision: 58613
Modified:
grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI: fix enabling/disabling loops
Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-05 11:34:08 UTC (rev 58612)
+++ grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-05 13:56:47 UTC (rev 58613)
@@ -1421,7 +1421,7 @@
self.fromShape.rels.remove(self)
if self in self.toShape.rels:
self.toShape.rels.remove(self)
-
+
def GetFrom(self):
"""!Get id of 'from' shape"""
return self.fromShape
@@ -1479,7 +1479,17 @@
"""!Abstract class for loops and conditions"""
ModelObject.__init__(self, id, label)
self.parent = parent
+
+ def _setPen(self):
+ """!Set pen"""
+ if self.isEnabled:
+ style = wx.SOLID
+ else:
+ style = wx.DOT
+ pen = wx.Pen(wx.BLACK, 1, style)
+ self.SetPen(pen)
+
def SetId(self, id):
"""!Set loop id"""
self.id = id
@@ -1523,12 +1533,11 @@
self.SetCanvas(self.parent)
self.SetX(x)
self.SetY(y)
- self.SetPen(wx.BLACK_PEN)
+ self._setPen()
+ self._setBrush()
self.SetCornerRadius(100)
self.SetLabel(label)
- self._setBrush()
-
def _setBrush(self):
"""!Set brush"""
if not self.isEnabled:
@@ -1543,14 +1552,16 @@
def Enable(self, enabled = True):
"""!Enable/disable action"""
- for item in self.items:
- if not isinstance(item, ModelAction):
- continue
- item.Enable(enabled)
+ for idx in self.itemIds:
+ item = self.parent.FindAction(idx)
+ if item:
+ item.Enable(enabled)
ModelObject.Enable(self, enabled)
-
+ self.Update()
+
def Update(self):
+ self._setPen()
self._setBrush()
def GetItems(self, items):
More information about the grass-commit
mailing list