瀏覽代碼

wxGUI/modeler: show in item list parameterized options

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@66942 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 年之前
父節點
當前提交
1bb224bfd6
共有 3 個文件被更改,包括 42 次插入17 次删除
  1. 12 3
      gui/wxpython/gmodeler/dialogs.py
  2. 2 2
      gui/wxpython/gmodeler/frame.py
  3. 28 12
      gui/wxpython/gmodeler/model.py

+ 12 - 3
gui/wxpython/gmodeler/dialogs.py

@@ -790,7 +790,7 @@ class ItemListCtrl(ModelListCtrl):
         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 @@ class ItemListCtrl(ModelListCtrl):
                     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 @@ class ItemListCtrl(ModelListCtrl):
                     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
                 

+ 2 - 2
gui/wxpython/gmodeler/frame.py

@@ -1585,9 +1585,9 @@ class ItemPanel(wx.Panel):
                                     label=" %s " % _("List of items - right-click to delete"))
         
         self.list = ItemListCtrl(parent = self,
-                                 columns = [_("Label"), _("In loop"),
+                                 columns = [_("Label"), _("In loop"), _("Parametrized"),
                                             _("Command")],
-                                 columnsNotEditable = [1, 2],
+                                 columnsNotEditable = [1, 2, 3],
                                  frame = self.parent)
         
         self.btnMoveUp = wx.Button(parent=self, id=wx.ID_UP)

+ 28 - 12
gui/wxpython/gmodeler/model.py

@@ -1186,20 +1186,20 @@ class ModelAction(ModelObject, ogl.DividedShape):
         :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
-                break
-        
+
+        options = self.GetParameterizedParams()
+        if options['flags'] or options['params']:
+            self.isParameterized = True
+        else:
+            self.isParameterized = False
+
+        options = self.GetParams()
         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
+                break
         
         if self.parent.GetCanvas():
             self._setBrush()
@@ -1212,7 +1212,23 @@ class ModelAction(ModelObject, ogl.DividedShape):
     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():