[GRASS-SVN] r66949 - grass/branches/releasebranch_7_0/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 27 15:53:04 PST 2015
Author: martinl
Date: 2015-11-27 15:53:04 -0800 (Fri, 27 Nov 2015)
New Revision: 66949
Modified:
grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/dialogs.py
grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/frame.py
grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: fix setting parametrized options multiple times
update item panel when page changed
add Refresh button to the items panel
show in item list parameterized options
(merge r66942:7 from trunk)
Modified: grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/dialogs.py 2015-11-27 23:48:07 UTC (rev 66948)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/dialogs.py 2015-11-27 23:53:04 UTC (rev 66949)
@@ -790,7 +790,7 @@
self.SetColumnWidth(0, 100)
self.SetColumnWidth(1, 75)
if len(self.columns) >= 3:
- self.SetColumnWidth(2, 65)
+ self.SetColumnWidth(2, 100)
def GetData(self):
"""Get list data"""
@@ -837,8 +837,16 @@
bId = _('No')
else:
bId = _("Yes")
+ options = action.GetParameterizedParams()
+ params = []
+ for f in options['flags']:
+ params.append('-{}'.format(f['name']))
+ for p in options['params']:
+ params.append(p['name'])
+
self.itemDataMap[i] = [action.GetLabel(),
bId,
+ ','.join(params),
action.GetLog()]
i += 1
@@ -856,11 +864,12 @@
self.CheckItem(index, True)
i += 1
else:
- for name, inloop, desc in self.itemDataMap.itervalues():
+ for name, inloop, param, desc in self.itemDataMap.itervalues():
index = self.InsertStringItem(sys.maxint, str(i))
self.SetStringItem(index, 0, name)
self.SetStringItem(index, 1, inloop)
- self.SetStringItem(index, 2, desc)
+ self.SetStringItem(index, 2, param)
+ self.SetStringItem(index, 3, desc)
self.SetItemData(index, i)
i += 1
Modified: grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/frame.py 2015-11-27 23:48:07 UTC (rev 66948)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/frame.py 2015-11-27 23:53:04 UTC (rev 66949)
@@ -201,7 +201,9 @@
self.SetStatusText(_('Python script contains local modifications'), 0)
else:
self.SetStatusText(_('Python script is up-to-date'), 0)
-
+ elif page == self.notebook.GetPageIndexByName('items'):
+ self.itemPanel.Update()
+
event.Skip()
def OnVariables(self, event):
@@ -1585,17 +1587,19 @@
label=" %s " % _("List of items - right-click to delete"))
self.list = ItemListCtrl(parent = self,
- columns = [_("Label"), _("In loop"),
+ columns = [_("Label"), _("In loop"), _("Parameterized"),
_("Command")],
- columnsNotEditable = [1, 2],
+ columnsNotEditable = [1, 2, 3],
frame = self.parent)
self.btnMoveUp = wx.Button(parent=self, id=wx.ID_UP)
self.btnMoveDown = wx.Button(parent=self, id=wx.ID_DOWN)
+ self.btnRefresh = wx.Button(parent=self, id=wx.ID_REFRESH)
self.btnMoveUp.Bind(wx.EVT_BUTTON, self.OnMoveItemsUp)
self.btnMoveDown.Bind(wx.EVT_BUTTON, self.OnMoveItemsDown)
-
+ self.btnRefresh.Bind(wx.EVT_BUTTON, self.list.OnReload)
+
self._layout()
def _layout(self):
@@ -1607,6 +1611,8 @@
manageSizer = wx.BoxSizer(wx.VERTICAL)
manageSizer.Add(item=self.btnMoveUp, border = 5, flag = wx.ALL)
manageSizer.Add(item=self.btnMoveDown, border = 5,
+ flag = wx.LEFT | wx.RIGHT | wx.BOTTOM)
+ manageSizer.Add(item=self.btnRefresh, border = 5,
flag = wx.LEFT | wx.RIGHT)
mainSizer = wx.BoxSizer(wx.HORIZONTAL)
Modified: grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/model.py 2015-11-27 23:48:07 UTC (rev 66948)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gmodeler/model.py 2015-11-27 23:53:04 UTC (rev 66949)
@@ -1186,17 +1186,16 @@
:param options: dictionary with flags and params (gtask)
"""
self.isValid = True
- self.isParameterized = False
-
+
for f in options['flags']:
if f.get('parameterized', False):
- self.IsParameterized = True
+ self.isParameterized = True
break
-
+
for p in options['params']:
if self.isValid and p.get('required', False) and \
- p.get('value', '') == '' and \
- p.get('default', '') == '':
+ p.get('value', '') == '' and \
+ p.get('default', '') == '':
self.isValid = False
if not self.isParameterized and p.get('parameterized', False):
self.isParameterized = True
@@ -1212,7 +1211,23 @@
def IsParameterized(self):
"""Check if action is parameterized"""
return self.isParameterized
-
+
+ def GetParameterizedParams(self):
+ """Return parameterized flags and options"""
+ param = { 'flags': [], 'params' : [] }
+
+ options = self.GetParams()
+
+ for f in options['flags']:
+ if f.get('parameterized', False):
+ param['flags'].append(f)
+
+ for p in options['params']:
+ if p.get('parameterized', False):
+ param['params'].append(p)
+
+ return param
+
def FindData(self, name):
"""Find data item by name"""
for rel in self.GetRelations():
@@ -1329,10 +1344,10 @@
action = rel.GetTo()
else:
action = rel.GetFrom()
-
+
task = GUI(show = None).ParseCommand(cmd = action.GetLog(string = False))
task.set_param(rel.GetLabel(), self.value)
- action.SetParams(params = task.get_options())
+ action.MergeParams(task.get_options())
def GetPropDialog(self):
"""Get properties dialog"""
More information about the grass-commit
mailing list