[GRASS-SVN] r65382 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 6 02:55:22 PDT 2015


Author: martinl
Date: 2015-06-06 02:55:21 -0700 (Sat, 06 Jun 2015)
New Revision: 65382

Modified:
   grass/trunk/gui/wxpython/gui_core/dialogs.py
Log:
wxGUI/import: add encoding widget when importing vectors


Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2015-06-05 21:17:01 UTC (rev 65381)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2015-06-06 09:55:21 UTC (rev 65382)
@@ -1607,6 +1607,7 @@
         self._giface = giface  # used to add layers
         self.importType = itype
         self.options = dict()   # list of options
+        self.options_par = dict()
         
         self.commandId = -1  # id of running command
         
@@ -1660,6 +1661,16 @@
             self.options[name] = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
                                              label = desc)
         
+        for f in task.get_options()['params']:
+            name = f.get('name', '')
+            desc = f.get('label', '')
+            if not desc:
+                desc = f.get('description', '')
+            if not name and not desc:
+                continue
+            if cmd == 'v.in.ogr' and name == 'encoding':
+                self.options_par[name] = (_('Encoding'),
+                                          wx.TextCtrl(parent = self.panel, id = wx.ID_ANY))
         
         self.overwrite = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
                                      label = _("Allow output files to overwrite existing files"))
@@ -1708,7 +1719,20 @@
         optionSizer = wx.StaticBoxSizer(self.optionBox, wx.VERTICAL)
         for key in self.options.keys():
             optionSizer.Add(item = self.options[key], proportion = 0)
+        if self.options_par:
+            gridBox = wx.GridBagSizer(vgap = 5, hgap = 5)
+            row = 0
+            for label, win in self.options_par.itervalues():
+                gridBox.Add(item = wx.StaticText(parent = self.panel, id = wx.ID_ANY,
+                                                 label = label + ':'),
+                            pos = (row, 0), flag = wx.ALIGN_CENTER_VERTICAL)
+                gridBox.Add(item = win, pos = (row, 1), flag = wx.EXPAND)
+                row += 1
             
+            gridBox.AddGrowableCol(1)
+            optionSizer.Add(item = gridBox, proportion = 0,
+                            flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 5)
+        
         dialogSizer.Add(item = optionSizer, proportion = 0,
                         flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 5)
         
@@ -1960,6 +1984,10 @@
             for key in self.options.keys():
                 if self.options[key].IsChecked():
                     cmd.append('-%s' % key)
+            for key in self.options_par.keys():
+                value = self.options_par[key][1].GetValue()
+                if value:
+                    cmd.append('%s=%s' % (key, value))
             
             if UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled') and \
                     '--overwrite' not in cmd:



More information about the grass-commit mailing list