[GRASS-SVN] r43270 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 25 17:05:27 EDT 2010
Author: martinl
Date: 2010-08-25 21:05:27 +0000 (Wed, 25 Aug 2010)
New Revision: 43270
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: save loop settings
(merge r43269 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-08-25 21:04:02 UTC (rev 43269)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-08-25 21:05:27 UTC (rev 43270)
@@ -682,7 +682,7 @@
gcmd.RunCommand('g.manual',
quiet = True,
entry = 'wxGUI.Modeler')
-
+
def OnModelProperties(self, event):
"""!Model properties dialog"""
dlg = PropertiesDialog(parent = self)
@@ -1674,8 +1674,11 @@
def Update(self):
pass
- def SetLoop(self, loop):
- """!Register loop"""
+ def SetLoop(self, loop = None):
+ """!Register loop
+
+ @param loop reference to loop (None to unset)
+ """
self.inLoop = loop
def GetLoop(self):
@@ -1690,11 +1693,12 @@
"""!Get id of the loop
@return loop id
- @return '' if action is not in the loop
+ @return None if action is not in the loop
"""
if self.inLoop:
return self.inLoop.GetId()
- return ''
+
+ return None
class ModelAction(ModelObject, ogl.RectangleShape):
"""!Action class (GRASS module)"""
@@ -2188,8 +2192,13 @@
if dlg.ShowModal() == wx.ID_OK:
shape.SetText(dlg.GetCondition())
alist = list()
- for aId in dlg.GetItems():
+ ids = dlg.GetItems()
+ for aId in ids['unchecked']:
action = self.frame.GetModel().GetItem(aId)
+ action.SetLoop()
+ for aId in ids['checked']:
+ action = self.frame.GetModel().GetItem(aId)
+ action.SetLoop(shape)
if action:
alist.append(action)
shape.SetItems(alist)
@@ -3883,10 +3892,7 @@
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)
-
+
self._layout()
self.SetMinSize(self.GetSize())
self.SetSize((500, 400))
@@ -3922,10 +3928,14 @@
def GetItems(self):
"""!Get list of selected actions"""
- ids = list()
+ ids = { 'checked' : list(),
+ 'unchecked' : list() }
for i in range(self.itemList.GetItemCount()):
+ iId = int(self.itemList.GetItem(i, 0).GetText())
if self.itemList.IsChecked(i):
- ids.append(int(self.itemList.GetItem(i, 0).GetText()))
+ ids['checked'].append(iId)
+ else:
+ ids['unchecked'].append(iId)
return ids
More information about the grass-commit
mailing list