[GRASS-SVN] r42771 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jul 12 15:53:00 EDT 2010
Author: martinl
Date: 2010-07-12 19:53:00 +0000 (Mon, 12 Jul 2010)
New Revision: 42771
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI/modeler: various loop-related fixes
(merge r42770 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-12 19:50:17 UTC (rev 42770)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-07-12 19:53:00 UTC (rev 42771)
@@ -302,7 +302,7 @@
width = loop['size'][0],
height = loop['size'][1],
text = loop['text'],
- actions = alist,
+ items = alist,
id = loop['id'])
for action in loopItem.GetItems():
@@ -1210,7 +1210,7 @@
cond = ModelCondition(self, x = width/2, y = height/2,
id = len(self.model.GetActions()) + 1)
self.canvas.diagram.AddShape(cond)
- loop.Show(True)
+ cond.Show(True)
self._addEvent(cond)
@@ -1270,7 +1270,10 @@
win.Raise()
def OnAddData(self, event):
- """!Add data item to model"""
+ """!Add data item to model
+
+ @todo
+ """
# add action to canvas
width, height = self.canvas.GetSize()
data = ModelData(self, x = width/2, y = height/2)
@@ -1278,7 +1281,7 @@
data.Show(True)
self._addEvent(data)
- self.model.AddData(data)
+ # self.model.AddData(data)
self.canvas.Refresh()
@@ -3361,6 +3364,7 @@
wx.LC_VRULES, **kwargs):
"""!List of model variables"""
self.parent = parent
+ self.columns = columns
try:
self.frame = parent.parent
except AttributeError:
@@ -3661,7 +3665,7 @@
menu.Destroy()
class ModelLoop(ModelObject, ogl.RectangleShape):
- 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 loop"""
ModelObject.__init__(self, id)
@@ -3707,6 +3711,13 @@
self.text = cond
self.ClearText()
self.AddText('(' + str(self.id) + ') ' + self.text)
+
+ def GetLog(self):
+ """!Get log info"""
+ if self.text:
+ return _("Condition: ") + self.text
+ else:
+ return _("Condition: not defined")
class ModelLoopDialog(wx.Dialog):
"""!Loop properties dialog"""
@@ -3728,13 +3739,12 @@
self.actionList = ActionCheckListCtrl(parent = self.panel,
columns = [_("ID"), _("Name"),
_("Command")])
-
self.actionList.Populate(self.parent.GetModel().GetActions())
self.btnCancel = wx.Button(parent = self.panel, id = wx.ID_CANCEL)
self.btnOk = wx.Button(parent = self.panel, id = wx.ID_OK)
self.btnOk.SetDefault()
-
+
#self.Bind(wx.EVT_BUTTON, self.OnOK, self.btnOK)
#self.Bind(wx.EVT_BUTTON, self.OnCancel, self.btnCancel)
@@ -3839,11 +3849,14 @@
"""!Populate the list"""
self.itemDataMap = dict()
i = 0
+ if len(self.columns) == 3:
+ checked = list()
for action in data:
- if self.GetItemCount() == 3:
+ if len(self.columns) == 3:
self.itemDataMap[i] = [str(action.GetId()),
action.GetName(),
action.GetLog()]
+ checked.append(action.GetLoopId())
else:
self.itemDataMap[i] = [str(action.GetId()),
action.GetName(),
@@ -3855,13 +3868,15 @@
self.itemCount = len(self.itemDataMap.keys())
self.DeleteAllItems()
i = 0
- if self.GetItemCount() == 3:
+ if len(self.columns) == 3:
for aid, name, desc in self.itemDataMap.itervalues():
index = self.InsertStringItem(sys.maxint, aid)
self.SetStringItem(index, 0, aid)
self.SetStringItem(index, 1, name)
self.SetStringItem(index, 2, desc)
self.SetItemData(index, i)
+ if checked[i]:
+ self.CheckItem(index, True)
i += 1
else:
for aid, name, inloop, desc in self.itemDataMap.itervalues():
@@ -4003,14 +4018,17 @@
if self.parent.GetCanvas():
ogl.PolygonShape.__init__(self)
- points = [(x, y - height / 2),
- (x + width / 2, y),
- (x, y + height / 2),
- (x - width / 2, y)]
- 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-12 19:50:17 UTC (rev 42770)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2010-07-12 19:53:00 UTC (rev 42771)
@@ -564,12 +564,12 @@
'loop' : {
'size' : {
'width' : 175,
- 'height' : 50,
+ 'height' : 40,
},
},
'condition' : {
'size' : {
- 'width' : 100,
+ 'width' : 150,
'height' : 40,
},
},
More information about the grass-commit
mailing list