瀏覽代碼

wxGUI/vdigit: toolbar cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58424 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 年之前
父節點
當前提交
80060b54c7
共有 3 個文件被更改,包括 27 次插入22 次删除
  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)
         menu.Destroy()
 
-    def CreateSelectionButton(self):
+    def CreateSelectionButton(self, tooltip = _("Select graphics tool")):
         """!Add button to toolbar for selection of graphics drawing mode.
 
         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)
         button =  wx.BitmapButton(parent = self, id = wx.ID_ANY, size = ((-1, self.GetSize()[1])),
                                   bitmap = bitmap, style = wx.NO_BORDER)
-        button.SetToolTipString(_("Select graphics tool"))
+        button.SetToolTipString(tooltip)
 
         return button
 

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

@@ -323,7 +323,7 @@ class IClassMapFrame(DoubleMapFrame):
                                                 digitClass=IClassVDigit, giface=self._giface,
                                                 tools = ['addArea', 'moveVertex', 'addVertex',
                                                          'removeVertex', 'editLine', 'moveLine',
-                                                         'deleteLine', 'deleteArea',
+                                                         'deleteArea',
                                                          'undo', 'redo'])
             self._mgr.AddPane(self.toolbars[name],
                               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
         # 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
         self.Realize()
@@ -119,16 +124,16 @@ class VDigitToolbar(BaseToolbar):
                                          label = _('Digitize new centroid'),
                                          desc = _('Left: new point')),
             'addArea'         : MetaIcon(img = 'polygon-create',
-                                         label = _('Digitize new area'),
+                                         label = _('Digitize new area (boundary without category)'),
                                          desc = _('Left: new point')),
             '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')),
             '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')),
             'deleteArea'      : MetaIcon(img = 'polygon-delete',
-                                         label = _('Delete area(s)'),
+                                         label = _('Delete selected area(s)'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'displayAttr'     : MetaIcon(img = 'attributes-display',
                                          label = _('Display/update attributes'),
@@ -137,16 +142,16 @@ class VDigitToolbar(BaseToolbar):
                                          label = _('Display/update categories'),
                                          desc = _('Left: Select')),
             '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')),
             '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')),
             'moveVertex'      : MetaIcon(img = 'vertex-move',
-                                         label = _('Move vertex'),
+                                         label = _('Move selected vertex'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'removeVertex'    : MetaIcon(img = 'vertex-delete',
-                                         label = _('Remove vertex'),
+                                         label = _('Remove selected vertex'),
                                          desc = _('Left: Select; Ctrl+Left: Unselect; Right: Confirm')),
             'settings'        : BaseIcons['settings'].SetLabel(_('Digitization settings')),
             'quit'            : BaseIcons['quit'].SetLabel(label = _('Quit digitizer'),
@@ -179,6 +184,14 @@ class VDigitToolbar(BaseToolbar):
             data.append(("addArea", self.icons["addArea"],
                         self.OnAddAreaTool,
                         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:            
             data.append(("moveVertex", self.icons["moveVertex"],
                          self.OnMoveVertex,
@@ -199,14 +212,6 @@ class VDigitToolbar(BaseToolbar):
             data.append(("moveLine", self.icons["moveLine"],
                          self.OnMoveLine,
                          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:
             data.append(("displayCats", self.icons["displayCats"],
                          self.OnDisplayCats,