[GRASS-SVN] r29948 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 4 17:21:34 EST 2008


Author: martinl
Date: 2008-02-04 17:21:33 -0500 (Mon, 04 Feb 2008)
New Revision: 29948

Modified:
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
Log:
wxGUI/vdigit: the toolbar modified, number of rows changed from two to one. It's OK for Silk icon theme (small icons). The number of toolbar rows can be easily changed: DigitToolbar.numOfRows=1|2.

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-02-04 21:12:24 UTC (rev 29947)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-02-04 22:21:33 UTC (rev 29948)
@@ -2259,7 +2259,7 @@
         elif name == "digit":
             self.digittoolbar = toolbars.DigitToolbar(self, self.Map)
 
-            for toolRow in range(0,2):
+            for toolRow in range(0, self.digittoolbar.numOfRows):
                 self._mgr.AddPane(self.digittoolbar.toolbar[toolRow],
                                   wx.aui.AuiPaneInfo().
                                   Name("digittoolbar" + str(toolRow)).Caption("Digit Toolbar").
@@ -2299,7 +2299,7 @@
             return
         elif name == "digit":
             # TODO: not destroy only hide
-            for toolRow in range(0,2):
+            for toolRow in range(0, self.digittoolbar.numOfRows):
                 self._mgr.DetachPane (self.digittoolbar.toolbar[toolRow])
                 self.digittoolbar.toolbar[toolRow].Destroy()
             self.digittoolbar = None

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-02-04 21:12:24 UTC (rev 29947)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-02-04 22:21:33 UTC (rev 29948)
@@ -250,44 +250,39 @@
 
         # create toolbars (two rows)
         self.toolbar = []
-        numOfRows = 2
-        for row in range(0, numOfRows):
+        self.numOfRows = 1 # number of rows for toolbar
+        for row in range(0, self.numOfRows):
             self.toolbar.append(wx.ToolBar(parent=self.parent, id=wx.ID_ANY))
             self.toolbar[row].SetToolBitmapSize(wx.Size(24,24))
 
             # create toolbar
-            self.InitToolbar(self.parent, self.toolbar[row], self.ToolbarData(row))
+            if self.numOfRows ==  1:
+                rowdata=None
+            else:
+                rowdata = row
+            self.InitToolbar(self.parent, self.toolbar[row], self.ToolbarData(rowdata))
 
         # list of available vector maps
         self.UpdateListOfLayers(updateTool=True)
 
         # realize toolbar
-        for row in range(0, numOfRows):
+        for row in range(0, self.numOfRows):
             self.toolbar[row].Realize()
 
-    def ToolbarData(self, row):
+    def ToolbarData(self, row=None):
         """
         Toolbar data
         """
-
-        if row == 0:
-            self.displayCats = self.displayAttr = self.copyCats = None
-            self.settings = self.exit = None
-
-            return (("", "", "", "", "", "", ""),
-                    (self.settings, "digSettings", Icons["digSettings"].GetBitmap(),
-                     wx.ITEM_NORMAL, Icons["digSettings"].GetLabel(), Icons["digSettings"].GetDesc(),
-                     self.OnSettings),
-                    (self.exit, "digExit", Icons["digExit"].GetBitmap(),
-                     wx.ITEM_NORMAL, Icons["digExit"].GetLabel(), Icons["digExit"].GetDesc(),
-                     self.OnExit))
-        else:
+        data = []
+        if row is None or row == 0:
             self.addPoint = self.addLine = self.addBoundary = self.addCentroid = None
             self.moveVertex = self.addVertex = self.removeVertex = None
             self.splitLine = self.editLine = self.moveLine = self.deleteLine = None
-            self.additioanlTools = None
+            self.additionalTools = None
+            self.displayCats = self.displayAttr = self.copyCats = None
 
-            return ((self.addPoint, "digAddPoint", Icons["digAddPoint"].GetBitmap(),
+            data = [("", "", "", "", "", "", ""),
+                    (self.addPoint, "digAddPoint", Icons["digAddPoint"].GetBitmap(),
                      wx.ITEM_RADIO, Icons["digAddPoint"].GetLabel(), Icons["digAddPoint"].GetDesc(),
                      self.OnAddPoint),
                     (self.addLine, "digAddLine", Icons["digAddLine"].GetBitmap(),
@@ -329,11 +324,24 @@
                     (self.displayAttr, "digDispAttr", Icons["digDispAttr"].GetBitmap(),
                      wx.ITEM_RADIO, Icons["digDispAttr"].GetLabel(), Icons["digDispAttr"].GetDesc(),
                      self.OnDisplayAttr),
-                    (self.additioanlTools, "digAdditionalTools", Icons["digAdditionalTools"].GetBitmap(),
+                    (self.additionalTools, "digAdditionalTools", Icons["digAdditionalTools"].GetBitmap(),
                      wx.ITEM_RADIO, Icons["digAdditionalTools"].GetLabel(),
                      Icons["digAdditionalTools"].GetDesc(),
-                     self.OnAdditionalToolMenu))
+                     self.OnAdditionalToolMenu)]
 
+        if row is None or row == 1:
+            self.settings = self.exit = None
+
+            data.append(("", "", "", "", "", "", ""))
+            data.append((self.settings, "digSettings", Icons["digSettings"].GetBitmap(),
+                         wx.ITEM_NORMAL, Icons["digSettings"].GetLabel(), Icons["digSettings"].GetDesc(),
+                         self.OnSettings))
+            data.append((self.exit, "digExit", Icons["digExit"].GetBitmap(),
+                         wx.ITEM_NORMAL, Icons["digExit"].GetLabel(), Icons["digExit"].GetDesc(),
+                         self.OnExit))
+
+        return data
+
     def OnAddPoint(self, event):
         """Add point to the vector map Laier"""
         Debug.msg (2, "DigitToolbar.OnAddPoint()")
@@ -671,10 +679,10 @@
                 value = layerNameSelected
 
             if not self.comboid:
-                self.combo = wx.ComboBox(self.toolbar[0], id=wx.ID_ANY, value=value,
+                self.combo = wx.ComboBox(self.toolbar[self.numOfRows-1], id=wx.ID_ANY, value=value,
                                          choices=layerNameList, size=(150, -1),
                                          style=wx.CB_READONLY)
-                self.comboid = self.toolbar[0].InsertControl(0, self.combo)
+                self.comboid = self.toolbar[self.numOfRows-1].InsertControl(0, self.combo)
                 self.parent.Bind(wx.EVT_COMBOBOX, self.OnSelectMap, self.comboid)
             else:
                 self.combo.SetItems(layerNameList)
@@ -685,6 +693,6 @@
             except ValueError:
                 self.layerSelectedID = None
 
-            self.toolbar[0].Realize()
+            self.toolbar[self.numOfRows-1].Realize()
 
         return layerNameList



More information about the grass-commit mailing list