[GRASS-SVN] r41895 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 16 17:12:49 EDT 2010


Author: martinl
Date: 2010-04-16 17:12:48 -0400 (Fri, 16 Apr 2010)
New Revision: 41895

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI/modeler: action size configurable
(merge r41893 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-04-16 21:09:54 UTC (rev 41894)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-04-16 21:12:48 UTC (rev 41895)
@@ -1015,9 +1015,14 @@
         
 class ModelAction(ogl.RectangleShape):
     """!Action class (GRASS module)"""
-    def __init__(self, parent, x, y, cmd = None, width = 100, height = 50):
+    def __init__(self, parent, x, y, cmd = None, width = None, height = None):
         self.parent  = parent
         self.cmd     = cmd
+        if not width:
+            width = UserSettings.Get(group='modeler', key='action', subkey=('size', 'width'))
+        if not height:
+            height = UserSettings.Get(group='modeler', key='action', subkey=('size', 'height'))
+        
         if self.cmd:
             task = menuform.GUI().ParseCommand(cmd = self.cmd,
                                                show = None)
@@ -1810,68 +1815,120 @@
                                        settings = settings)
         
         # create notebook pages
-        self._createDiagramPage(self.notebook)
-        
+        self._createActionPage(self.notebook)
+        self._createDataPage(self.notebook)
+                
         self.SetMinSize(self.GetBestSize())
         self.SetSize(self.size)
 
-    def _createDiagramPage(self, notebook):
-        """!Create notebook page for diagram settings"""
+    def _createActionPage(self, notebook):
+        """!Create notebook page for action settings"""
         panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
-        notebook.AddPage(page = panel, text = _("Diagram"))
-
-        #
-        # action
-        #
+        notebook.AddPage(page = panel, text = _("Action"))
+        
+        # colors
         border = wx.BoxSizer(wx.VERTICAL)
         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
-                              label = " %s " % _("Action settings"))
+                              label = " %s " % _("Color settings"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         
-        gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
+        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
         gridSizer.AddGrowableCol(0)
         
-        # colors
         row = 0
-        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=_("Valid:")),
-                      flag=wx.ALIGN_LEFT |
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                         label = _("Valid:")),
+                      flag = wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 0))
+                      pos = (row, 0))
         vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
                                    colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'valid')),
                                    size = globalvar.DIALOG_COLOR_SIZE)
         vColor.SetName('GetColour')
         self.winId['modeler:action:color:valid'] = vColor.GetId()
         
-        gridSizer.Add(item=vColor,
-                      flag=wx.ALIGN_RIGHT |
+        gridSizer.Add(item = vColor,
+                      flag = wx.ALIGN_RIGHT |
                       wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 1))
+                      pos = (row, 1))
 
         row = 1
-        gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=_("Invalid:")),
-                      flag=wx.ALIGN_LEFT |
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                         label = _("Invalid:")),
+                      flag = wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 0))
+                      pos = (row, 0))
         iColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
                                    colour = self.settings.Get(group='modeler', key='action', subkey=('color', 'invalid')),
                                    size = globalvar.DIALOG_COLOR_SIZE)
         iColor.SetName('GetColour')
         self.winId['modeler:action:color:invalid'] = iColor.GetId()
         
-        gridSizer.Add(item=iColor,
-                      flag=wx.ALIGN_RIGHT |
+        gridSizer.Add(item = iColor,
+                      flag = wx.ALIGN_RIGHT |
                       wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 1))
+                      pos = (row, 1))
 
+        sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
+        border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
+        
+        # size
+        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
+                              label = " %s " % _("Size settings"))
+        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+        
+        gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
+        gridSizer.AddGrowableCol(0)
+
+        row = 0
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                         label = _("Width:")),
+                      flag = wx.ALIGN_LEFT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos = (row, 0))
+        
+        width = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
+                            min = 0, max = 500,
+                            initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'width')))
+        width.SetName('GetValue')
+        self.winId['modeler:action:size:width'] = width.GetId()
+        
+        gridSizer.Add(item = width,
+                      flag = wx.ALIGN_RIGHT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos = (row, 1))
+
+        row += 1
+        gridSizer.Add(item = wx.StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=_("Height:")),
+                      flag = wx.ALIGN_LEFT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos=(row, 0))
+        
+        height = wx.SpinCtrl(parent = panel, id = wx.ID_ANY,
+                             min = 0, max = 500,
+                             initial = self.settings.Get(group='modeler', key='action', subkey=('size', 'height')))
+        height.SetName('GetValue')
+        self.winId['modeler:action:size:height'] = height.GetId()
+        
+        gridSizer.Add(item = height,
+                      flag = wx.ALIGN_RIGHT |
+                      wx.ALIGN_CENTER_VERTICAL,
+                      pos = (row, 1))
+        
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
         border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
+                
+        panel.SetSizer(border)
         
-        #
-        # data
-        #
+        return panel
+
+    def _createDataPage(self, notebook):
+        """!Create notebook page for data settings"""
+        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
+        notebook.AddPage(page = panel, text = _("Data"))
+        
+        border = wx.BoxSizer(wx.VERTICAL)
         box   = wx.StaticBox (parent = panel, id = wx.ID_ANY,
                               label = " %s " % _("Data settings"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2010-04-16 21:09:54 UTC (rev 41894)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2010-04-16 21:12:48 UTC (rev 41895)
@@ -526,6 +526,10 @@
                         'valid' : (211, 211, 211, 255), # light grey
                         'invalid' : (255, 255, 255, 255), # white
                         },
+                    'size' : {
+                        'width' : 100,
+                        'height' : 50,
+                        },
                     },
                 },
             }



More information about the grass-commit mailing list