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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 14 08:11:38 EDT 2010


Author: martinl
Date: 2010-07-14 12:11:38 +0000 (Wed, 14 Jul 2010)
New Revision: 42785

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI/modeler: fix if-else statements (loading from file)
(merge r42784 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-07-14 12:10:13 UTC (rev 42784)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-07-14 12:11:38 UTC (rev 42785)
@@ -329,7 +329,6 @@
                 alist.append(action)
             
             loopItem = self.GetItem(loop['id'])
-            print alist
             loopItem.SetItems(alist)
             
             for action in loopItem.GetItems():
@@ -1441,7 +1440,8 @@
                 rel.InsertLineControlPoint(point = wx.RealPoint(x, y))
             
         self._addEvent(rel)
-        print fromShape, toShape, rel
+        if isinstance(fromShape, ModelCondition): ### ???
+            fromShape = toShape
         fromShape.AddLine(rel, toShape)
         
         self.canvas.diagram.AddShape(rel)
@@ -1562,7 +1562,6 @@
                                                                 parent.GetY() + dy / 2))
                 rel.InsertLineControlPoint(point = wx.RealPoint(parent.GetX() + dx,
                                                                 parent.GetY() + dy / 2))
-
             parent = action
         
         # close loop
@@ -1583,8 +1582,9 @@
                                                         action.GetY() + dy))
         rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX() - dx,
                                                         loop.GetY()))
-        self.canvas.Refresh()
         
+        self.canvas.Refresh(False)
+        
 class ModelCanvas(ogl.ShapeCanvas):
     """!Canvas where model is drawn"""
     def __init__(self, parent):
@@ -2207,11 +2207,10 @@
             self._previousHandler.OnEndDragLeft(x, y, keys, attachment)
         
         shape = self.GetShape()
-        if isinstance(shape, ModelAction):
-            loop = shape.GetLoop()
-            if loop:
-                self.frame.DefineLoop(loop)
-
+        loop = shape.GetLoop()
+        if loop:
+            self.frame.DefineLoop(loop)
+        
     def OnEndSize(self, x, y):
         """!Resize shape"""
         self.frame.ModelChanged()
@@ -4143,33 +4142,33 @@
         event.Veto()
 
 class ModelCondition(ModelItem, ogl.PolygonShape):
-    def __init__(self, parent, x, y, id = -1, width = None, height = None, text = None, items = []):
+    def __init__(self, parent, x, y, id = -1, width = None, height = None, text = '', items = []):
         """!Defines a condition"""
         ModelItem.__init__(self, parent, x, y, id, width, height, text, items)
         
         if not width:
-            self.width = UserSettings.Get(group='modeler', key='condition', subkey=('size', 'width'))
+            self.width = UserSettings.Get(group='modeler', key='if-else', subkey=('size', 'width'))
         else:
             self.width = width
         if not height:
-            self.height = UserSettings.Get(group='modeler', key='condition', subkey=('size', 'height'))
+            self.height = UserSettings.Get(group='modeler', key='if-else', subkey=('size', 'height'))
         else:
             self.height = height
         
         if self.parent.GetCanvas():
             ogl.PolygonShape.__init__(self)
             
+            points = [(0, - self.height / 2),
+                      (self.width / 2, 0),
+                      (0, self.height / 2),
+                      (- self.width / 2, 0)]
+            self.Create(points)
+            
             self.SetCanvas(self.parent)
             self.SetX(x)
             self.SetY(y)
             self.SetPen(wx.BLACK_PEN)
             
-            points = [(0, - height / 2),
-                      (width / 2, 0),
-                      (0, height / 2),
-                      (- width / 2, 0)]
-            self.Create(points)
-                        
             if text:
                 self.AddText('(' + str(self.id) + ') ' + text)
             else:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2010-07-14 12:10:13 UTC (rev 42784)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2010-07-14 12:11:38 UTC (rev 42785)
@@ -567,7 +567,7 @@
                         'height' : 40,
                         },
                     },
-                'condition' : {
+                'if-else' : {
                     'size' : {
                         'width' : 150,
                         'height' : 40,



More information about the grass-commit mailing list