[GRASS-SVN] r57401 - grass/branches/releasebranch_6_4/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 4 12:26:36 PDT 2013


Author: annakrat
Date: 2013-08-04 12:26:36 -0700 (Sun, 04 Aug 2013)
New Revision: 57401

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py
Log:
wxGUI/forms: fix #2054

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py	2013-08-04 17:51:16 UTC (rev 57400)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py	2013-08-04 19:26:36 UTC (rev 57401)
@@ -1260,8 +1260,9 @@
                         this_sizer = which_sizer
                     colorSize = 150
                     # For color selectors, this is a three-member array, holding the IDs of
-                    # the text control for multiple colors (or None),
-                    # the selector proper and either a "transparent" checkbox or None
+                    # the color picker,  the text control for multiple colors (or None),
+                    # and either a "transparent" checkbox or None
+                    p['wxId'] = [None] * 3
                     if p.get('multiple', False):
                         txt = wx.TextCtrl(parent = which_panel, id = wx.ID_ANY)
                         this_sizer.Add(item = txt, proportion = 1,
@@ -1269,10 +1270,8 @@
                         txt.Bind(wx.EVT_TEXT, self.OnSetValue)
                         colorSize = 40
                         label_color = ''
-                        p['wxId'] = [txt.GetId(),]
+                        p['wxId'][1] = txt.GetId()
                         which_sizer.Add(this_sizer, flag = wx.EXPAND | wx.RIGHT, border = 5)
-                    else:
-                        p['wxId'] = [None,]
 
                     btn_colour = csel.ColourSelect(parent = which_panel, id = wx.ID_ANY,
                                                    label = label_color, colour = default_color,
@@ -1280,7 +1279,7 @@
                     this_sizer.Add(item = btn_colour, proportion = 0,
                                    flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border = 5)
                     btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange)
-                    p['wxId'].append(btn_colour.GetId())
+                    p['wxId'][0] = btn_colour.GetId()
 
                     if p.get('prompt', '') ==  'color_none':
                         none_check = wx.CheckBox(which_panel, wx.ID_ANY, _("Transparent"))
@@ -1292,9 +1291,8 @@
                                        flag = wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT | wx.TOP, border = 5)
                         which_sizer.Add(this_sizer)
                         none_check.Bind(wx.EVT_CHECKBOX, self.OnColorChange)
-                        p['wxId'].append(none_check.GetId())
-                    else:
-                        p['wxId'].append(None)
+                        p['wxId'][2] = none_check.GetId()
+
                 # file selector
                 elif p.get('prompt','') !=  'color' and p.get('element', '') ==  'file':
                     if p.get('age', 'new_file') == 'new_file':
@@ -1631,14 +1629,14 @@
         myId = event.GetId()
         for p in self.task.params:
             if 'wxId' in p and myId in p['wxId']:
-                multiple = p['wxId'][0] is not None # multiple colors
+                multiple = p['wxId'][1] is not None # multiple colors
                 hasTransp = p['wxId'][2] is not None
                 if multiple:
                     # selected color is added at the end of textCtrl
-                    colorchooser = wx.FindWindowById(p['wxId'][1])
+                    colorchooser = wx.FindWindowById(p['wxId'][0])
                     new_color = colorchooser.GetValue()[:]
                     new_label = rgb2str.get(new_color, ':'.join(map(str, new_color)))
-                    textCtrl = wx.FindWindowById(p['wxId'][0])
+                    textCtrl = wx.FindWindowById(p['wxId'][1])
                     val = textCtrl.GetValue()
                     sep = ','
                     if val and val[-1] != sep:
@@ -1649,7 +1647,7 @@
                 elif hasTransp and wx.FindWindowById(p['wxId'][2]).GetValue():
                     p[ 'value' ] = 'none'
                 else:
-                    colorchooser = wx.FindWindowById(p['wxId'][1])
+                    colorchooser = wx.FindWindowById(p['wxId'][0])
                     new_color = colorchooser.GetValue()[:]
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # under wx2.8.1



More information about the grass-commit mailing list