[GRASS-SVN] r65390 - grass/branches/releasebranch_7_0/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 6 12:11:38 PDT 2015


Author: martinl
Date: 2015-06-06 12:11:38 -0700 (Sat, 06 Jun 2015)
New Revision: 65390

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
Log:
wxGUI/import: add encoding widget when importing vectors
              (crucial feature, backported from trunk r65382-3)


Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2015-06-06 15:58:45 UTC (rev 65389)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2015-06-06 19:11:38 UTC (rev 65390)
@@ -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 p in task.get_options()['params']:
+            name = p.get('name', '')
+            desc = p.get('label', '')
+            if not desc:
+                desc = p.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)
         
@@ -1926,6 +1950,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