Przeglądaj źródła

wxGUI/vdigit: show error message dialog if no vector map is open for editing, after activate 'Z bulk-labeling of 3D lines' tool (#1877)

* wxGUI/vdigit: show error message dialog if no vector map is open for editing, after activate 'Z bulk-labeling of 3D lines' tool
Tomas Zigo 3 lat temu
rodzic
commit
c84312ab38
1 zmienionych plików z 18 dodań i 2 usunięć
  1. 18 2
      gui/wxpython/vdigit/toolbars.py

+ 18 - 2
gui/wxpython/vdigit/toolbars.py

@@ -354,6 +354,21 @@ class VDigitToolbar(BaseToolbar):
 
         return self._getToolbarData(data)
 
+    def _noVMapOpenForEditingErrDlg(self):
+        """Show error message dialog if no vector map is open for editing
+
+        :return: True if no vector map is open for editing else None
+        """
+        if not self.digit:
+            GError(
+                _(
+                    "No vector map is open for editing. Please select first"
+                    "a vector map from the combo box."
+                ),
+                self.parent,
+            )
+            return True
+
     def OnTool(self, event):
         """Tool selected -> untoggles previusly selected tool in
         toolbar"""
@@ -687,8 +702,7 @@ class VDigitToolbar(BaseToolbar):
 
     def OnCopy(self, event):
         """Copy selected features from (background) vector map"""
-        if not self.digit:
-            GError(_("No vector map open for editing."), self.parent)
+        if self._noVMapOpenForEditingErrDlg():
             return
 
         # select background map
@@ -847,6 +861,8 @@ class VDigitToolbar(BaseToolbar):
 
     def OnZBulk(self, event):
         """Z bulk-labeling selected lines/boundaries"""
+        if self._noVMapOpenForEditingErrDlg():
+            return
         if not self.digit.IsVector3D():
             GError(
                 parent=self.parent,