[GRASS-SVN] r67862 - in grass/trunk/gui/wxpython: gmodeler gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 17 05:22:33 PST 2016


Author: martinl
Date: 2016-02-17 05:22:33 -0800 (Wed, 17 Feb 2016)
New Revision: 67862

Modified:
   grass/trunk/gui/wxpython/gmodeler/dialogs.py
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/gmodeler/model.py
   grass/trunk/gui/wxpython/gui_core/gselect.py
Log:
wxGUI/gmodeler: limit data dialog only to raster,raster_3d and vector

Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py	2016-02-17 10:20:09 UTC (rev 67861)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py	2016-02-17 13:22:33 UTC (rev 67862)
@@ -62,9 +62,12 @@
         self.Bind(wx.EVT_BUTTON, self.OnCancel, self.btnCancel)
         if self.etype:
             self.typeSelect = ElementSelect(parent = self.panel,
+                                            elements = ['raster', 'raster_3d', 'vector'],
                                             size = globalvar.DIALOG_GSELECT_SIZE)
             self.typeSelect.Bind(wx.EVT_CHOICE, self.OnType)
-        
+            self.typeSelect.SetSelection(0)
+            self.element.SetType('raster')
+            
         if shape.GetValue():
             self.btnOK.Enable()
         
@@ -120,7 +123,9 @@
             if elem == 'raster':
                 self.shape.SetPrompt('raster')
             elif elem == 'vector':
-                self.shape.SetPrompt('raster')
+                self.shape.SetPrompt('vector')
+            elif elem == 'raster_3d':
+                self.shape.SetPrompt('raster_3d')
         
         self.parent.canvas.Refresh()
         self.parent.SetStatusText('', 0)

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2016-02-17 10:20:09 UTC (rev 67861)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2016-02-17 13:22:33 UTC (rev 67862)
@@ -725,7 +725,6 @@
         data.SetPropDialog(dlg)
         dlg.CentreOnParent()
         ret = dlg.ShowModal()
-        data.SetPrompt(dlg.GetType())
         dlg.Destroy()
         if ret != wx.ID_OK:
             return

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2016-02-17 10:20:09 UTC (rev 67861)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2016-02-17 13:22:33 UTC (rev 67862)
@@ -1378,7 +1378,7 @@
         if self.prompt == 'raster':
             color = UserSettings.Get(group = 'modeler', key = 'data',
                                      subkey = ('color', 'raster'))
-        elif self.prompt == 'raster3d':
+        elif self.prompt == 'raster_3d':
             color = UserSettings.Get(group = 'modeler', key = 'data',
                                      subkey = ('color', 'raster3d'))
         elif self.prompt == 'vector':

Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2016-02-17 10:20:09 UTC (rev 67861)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2016-02-17 13:22:33 UTC (rev 67862)
@@ -2107,11 +2107,13 @@
         self.SetValue('')
 
 class ElementSelect(wx.Choice):
-    def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
+    def __init__(self, parent, id = wx.ID_ANY, elements = None,
+                 size = globalvar.DIALOG_COMBOBOX_SIZE,
                  **kwargs):
         """Widget for selecting GIS element
 
         :param parent: parent window
+        :param elements: filter elements
         """
         super(ElementSelect, self).__init__(parent, id, size = size,
                                             **kwargs)
@@ -2121,7 +2123,18 @@
         p = task.get_param(value = 'type')
         self.values = p.get('values', [])
         self.valuesDesc = p.get('values_desc', [])
-
+        
+        if elements:
+            values = []
+            valuesDesc = []
+            for idx in range(0, len(self.values)):
+                value = self.values[idx]
+                if value in elements:
+                    values.append(value)
+                    valuesDesc.append(self.valuesDesc[idx])
+            self.values = values
+            self.valuesDesc = valuesDesc
+        
         self.SetItems(self.valuesDesc)
 
     def GetValue(self, name):



More information about the grass-commit mailing list