Browse Source

wxGUI: add SeperatorSelect? widget
libgis: define gisprompt for G_OPT_F_SEP
(merge r60640-1 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60738 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 11 years ago
parent
commit
1e2c05a245

+ 13 - 1
gui/wxpython/gui_core/forms.py

@@ -1135,6 +1135,7 @@ class CmdPanel(wx.Panel):
                 if p.get('prompt','') not in ('color',
                 if p.get('prompt','') not in ('color',
                                               'subgroup',
                                               'subgroup',
                                               'sigfile',
                                               'sigfile',
+                                              'separator',
                                               'dbdriver',
                                               'dbdriver',
                                               'dbname',
                                               'dbname',
                                               'dbtable',
                                               'dbtable',
@@ -1300,6 +1301,17 @@ class CmdPanel(wx.Panel):
                     which_sizer.Add(item = selection, proportion = 0,
                     which_sizer.Add(item = selection, proportion = 0,
                                     flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
                                     flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
                                     border = 5)
                                     border = 5)
+
+                # separator
+                elif prompt == 'separator':
+                    win = gselect.SeparatorSelect(parent = which_panel)
+                    value = self._getValue(p)
+                    win.SetValue(value)
+                    p['wxId'] = [ win.GetId() ]
+                    win.Bind(wx.EVT_TEXT, self.OnSetValue)
+                    which_sizer.Add(item = win, proportion = 0,
+                                    flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
+                                    border = 5)
                 
                 
                 # layer, dbdriver, dbname, dbcolumn, dbtable entry
                 # layer, dbdriver, dbname, dbcolumn, dbtable entry
                 elif prompt in ('dbdriver',
                 elif prompt in ('dbdriver',
@@ -1595,7 +1607,7 @@ class CmdPanel(wx.Panel):
                     cb.GetTextCtrl().Bind(wx.EVT_TEXT, self.OnSetValue)
                     cb.GetTextCtrl().Bind(wx.EVT_TEXT, self.OnSetValue)
                     if p.get('guidependency', ''):
                     if p.get('guidependency', ''):
                         cb.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
                         cb.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
-                
+
             if self.parent.GetName() == 'MainFrame' and (self._giface and hasattr(self._giface, "_model")):
             if self.parent.GetName() == 'MainFrame' and (self._giface and hasattr(self._giface, "_model")):
                 parChk = wx.CheckBox(parent = which_panel, id = wx.ID_ANY,
                 parChk = wx.CheckBox(parent = which_panel, id = wx.ID_ANY,
                                      label = _("Parameterized in model"))
                                      label = _("Parameterized in model"))

+ 10 - 0
gui/wxpython/gui_core/gselect.py

@@ -25,6 +25,7 @@ Classes:
  - gselect::OgrTypeSelect
  - gselect::OgrTypeSelect
  - gselect::CoordinatesSelect
  - gselect::CoordinatesSelect
  - gselect::SignatureSelect
  - gselect::SignatureSelect
+ - gselect::SeparatorSelect
 
 
 (C) 2007-2014 by the GRASS Development Team 
 (C) 2007-2014 by the GRASS Development Team 
 
 
@@ -2301,3 +2302,12 @@ class SignatureSelect(wx.ComboBox):
         except OSError:
         except OSError:
             self.SetItems([])
             self.SetItems([])
         self.SetValue('')
         self.SetValue('')
+
+class SeparatorSelect(wx.ComboBox):
+    """!Widget for selecting seperator"""
+    def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE, 
+                 **kwargs):
+        super(SeparatorSelect, self).__init__(parent, id, size = size, 
+                                              **kwargs)
+        self.SetName("SeparatorSelect")
+        self.SetItems(['pipe', 'comma', 'space', 'tab', 'newline'])

+ 1 - 0
lib/gis/parser_standard_options.c

@@ -544,6 +544,7 @@ struct Option *G_define_standard_option(int opt)
 	Opt->type = TYPE_STRING;
 	Opt->type = TYPE_STRING;
 	Opt->key_desc = "character";
 	Opt->key_desc = "character";
 	Opt->required = NO;
 	Opt->required = NO;
+        Opt->gisprompt = "old,separator,separator";
 	Opt->answer = "pipe";
 	Opt->answer = "pipe";
 	Opt->label = _("Field separator");
 	Opt->label = _("Field separator");
 	Opt->description = _("Special characters: pipe, comma, space, tab, newline");
 	Opt->description = _("Special characters: pipe, comma, space, tab, newline");