Browse Source

wxGUI/vdigit: toolbar cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58424 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 years ago
parent
commit
80060b54c7
3 changed files with 27 additions and 22 deletions
  1. 2 2
      gui/wxpython/gui_core/toolbars.py
  2. 1 1
      gui/wxpython/iclass/frame.py
  3. 24 19
      gui/wxpython/vdigit/toolbars.py

+ 2 - 2
gui/wxpython/gui_core/toolbars.py

@@ -250,7 +250,7 @@ class BaseToolbar(wx.ToolBar):
         self.PopupMenu(menu)
         self.PopupMenu(menu)
         menu.Destroy()
         menu.Destroy()
 
 
-    def CreateSelectionButton(self):
+    def CreateSelectionButton(self, tooltip = _("Select graphics tool")):
         """!Add button to toolbar for selection of graphics drawing mode.
         """!Add button to toolbar for selection of graphics drawing mode.
 
 
         Button must be custom (not toolbar tool) to set smaller width.
         Button must be custom (not toolbar tool) to set smaller width.
@@ -262,7 +262,7 @@ class BaseToolbar(wx.ToolBar):
             bitmap = wx.ArtProvider.GetBitmap(id = wx.ART_MISSING_IMAGE, client = wx.ART_TOOLBAR)
             bitmap = wx.ArtProvider.GetBitmap(id = wx.ART_MISSING_IMAGE, client = wx.ART_TOOLBAR)
         button =  wx.BitmapButton(parent = self, id = wx.ID_ANY, size = ((-1, self.GetSize()[1])),
         button =  wx.BitmapButton(parent = self, id = wx.ID_ANY, size = ((-1, self.GetSize()[1])),
                                   bitmap = bitmap, style = wx.NO_BORDER)
                                   bitmap = bitmap, style = wx.NO_BORDER)
-        button.SetToolTipString(_("Select graphics tool"))
+        button.SetToolTipString(tooltip)
 
 
         return button
         return button
 
 

+ 1 - 1
gui/wxpython/iclass/frame.py

@@ -323,7 +323,7 @@ class IClassMapFrame(DoubleMapFrame):
                                                 digitClass=IClassVDigit, giface=self._giface,
                                                 digitClass=IClassVDigit, giface=self._giface,
                                                 tools = ['addArea', 'moveVertex', 'addVertex',
                                                 tools = ['addArea', 'moveVertex', 'addVertex',
                                                          'removeVertex', 'editLine', 'moveLine',
                                                          'removeVertex', 'editLine', 'moveLine',
-                                                         'deleteLine', 'deleteArea',
+                                                         'deleteArea',
                                                          'undo', 'redo'])
                                                          'undo', 'redo'])
             self._mgr.AddPane(self.toolbars[name],
             self._mgr.AddPane(self.toolbars[name],
                               wx.aui.AuiPaneInfo().
                               wx.aui.AuiPaneInfo().

+ 24 - 19
gui/wxpython/vdigit/toolbars.py

@@ -81,9 +81,14 @@ class VDigitToolbar(BaseToolbar):
         
         
         # custom button for digitization of area/boundary/centroid
         # custom button for digitization of area/boundary/centroid
         # TODO: could this be somehow generalized?
         # TODO: could this be somehow generalized?
-        self.areaButton = self.CreateSelectionButton()
-        self.areaButtonId = self.InsertControl(5, self.areaButton)
-        self.areaButton.Bind(wx.EVT_BUTTON, self.OnAddAreaMenu)
+        nAreaTools = 0
+        if self.tools and 'addBoundary' in self.tools: nAreaTools += 1
+        if self.tools and 'addCentroid' in self.tools: nAreaTools += 1
+        if self.tools and 'addArea' in self.tools: nAreaTools += 1
+        if nAreaTools != 1:
+            self.areaButton = self.CreateSelectionButton(_("Select area/boundary/centroid tool"))
+            self.areaButtonId = self.InsertControl(5, self.areaButton)
+            self.areaButton.Bind(wx.EVT_BUTTON, self.OnAddAreaMenu)
         
         
         # realize toolbar
         # realize toolbar
         self.Realize()
         self.Realize()
@@ -119,16 +124,16 @@ class VDigitToolbar(BaseToolbar):
                                          label = _('Digitize new centroid'),
                                          label = _('Digitize new centroid'),
                                          desc = _('Left: new point')),
                                          desc = _('Left: new point')),
             'addArea'         : MetaIcon(img = 'polygon-create',
             'addArea'         : MetaIcon(img = 'polygon-create',
-                                         label = _('Digitize new area'),
+                                         label = _('Digitize new area (boundary without category)'),
                                          desc = _('Left: new point')),
                                          desc = _('Left: new point')),
             'addVertex'       : MetaIcon(img = 'vertex-create',
             'addVertex'       : MetaIcon(img = 'vertex-create',
-                                         label = _('Add new vertex'),
+                                         label = _('Add new vertex to line or boundary'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'deleteLine'      : MetaIcon(img = 'line-delete',
             'deleteLine'      : MetaIcon(img = 'line-delete',
-                                         label = _('Delete feature(s)'),
+                                         label = _('Delete selected point(s), line(s), boundary(ies) or centroid(s)'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'deleteArea'      : MetaIcon(img = 'polygon-delete',
             'deleteArea'      : MetaIcon(img = 'polygon-delete',
-                                         label = _('Delete area(s)'),
+                                         label = _('Delete selected area(s)'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'displayAttr'     : MetaIcon(img = 'attributes-display',
             'displayAttr'     : MetaIcon(img = 'attributes-display',
                                          label = _('Display/update attributes'),
                                          label = _('Display/update attributes'),
@@ -137,16 +142,16 @@ class VDigitToolbar(BaseToolbar):
                                          label = _('Display/update categories'),
                                          label = _('Display/update categories'),
                                          desc = _('Left: Select')),
                                          desc = _('Left: Select')),
             'editLine'        : MetaIcon(img = 'line-edit',
             'editLine'        : MetaIcon(img = 'line-edit',
-                                         label = _('Edit line/boundary'),
+                                         label = _('Edit selected line/boundary'),
                                          desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
                                          desc = _('Left: new point; Ctrl+Left: undo last point; Right: close line')),
             'moveLine'        : MetaIcon(img = 'line-move',
             'moveLine'        : MetaIcon(img = 'line-move',
-                                         label = _('Move feature(s)'),
+                                         label = _('Move selected point(s), line(s), boundary(ies) or centroid(s)'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'moveVertex'      : MetaIcon(img = 'vertex-move',
             'moveVertex'      : MetaIcon(img = 'vertex-move',
-                                         label = _('Move vertex'),
+                                         label = _('Move selected vertex'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'removeVertex'    : MetaIcon(img = 'vertex-delete',
             'removeVertex'    : MetaIcon(img = 'vertex-delete',
-                                         label = _('Remove vertex'),
+                                         label = _('Remove selected vertex'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'settings'        : BaseIcons['settings'].SetLabel(_('Digitization settings')),
             'settings'        : BaseIcons['settings'].SetLabel(_('Digitization settings')),
             'quit'            : BaseIcons['quit'].SetLabel(label = _('Quit digitizer'),
             'quit'            : BaseIcons['quit'].SetLabel(label = _('Quit digitizer'),
@@ -179,6 +184,14 @@ class VDigitToolbar(BaseToolbar):
             data.append(("addArea", self.icons["addArea"],
             data.append(("addArea", self.icons["addArea"],
                         self.OnAddAreaTool,
                         self.OnAddAreaTool,
                         wx.ITEM_CHECK))
                         wx.ITEM_CHECK))
+        if not self.tools or 'deleteLine' in self.tools:
+            data.append(("deleteLine", self.icons["deleteLine"],
+                         self.OnDeleteLine,
+                         wx.ITEM_CHECK))
+        if not self.tools or 'deleteArea' in self.tools:
+            data.append(("deleteArea", self.icons["deleteArea"],
+                         self.OnDeleteArea,
+                         wx.ITEM_CHECK))
         if not self.tools or 'moveVertex' in self.tools:            
         if not self.tools or 'moveVertex' in self.tools:            
             data.append(("moveVertex", self.icons["moveVertex"],
             data.append(("moveVertex", self.icons["moveVertex"],
                          self.OnMoveVertex,
                          self.OnMoveVertex,
@@ -199,14 +212,6 @@ class VDigitToolbar(BaseToolbar):
             data.append(("moveLine", self.icons["moveLine"],
             data.append(("moveLine", self.icons["moveLine"],
                          self.OnMoveLine,
                          self.OnMoveLine,
                          wx.ITEM_CHECK))
                          wx.ITEM_CHECK))
-        if not self.tools or 'deleteLine' in self.tools:
-            data.append(("deleteLine", self.icons["deleteLine"],
-                         self.OnDeleteLine,
-                         wx.ITEM_CHECK))
-        if not self.tools or 'deleteArea' in self.tools:
-            data.append(("deleteArea", self.icons["deleteArea"],
-                         self.OnDeleteArea,
-                         wx.ITEM_CHECK))
         if not self.tools or 'displayCats' in self.tools:
         if not self.tools or 'displayCats' in self.tools:
             data.append(("displayCats", self.icons["displayCats"],
             data.append(("displayCats", self.icons["displayCats"],
                          self.OnDisplayCats,
                          self.OnDisplayCats,