소스 검색

wxGUI gcp: fix adding vector map to group when no vector maps exist (#685)

Tomas Zigo 5 년 전
부모
커밋
263845d5a5
1개의 변경된 파일19개의 추가작업 그리고 11개의 파일을 삭제
  1. 19 11
      gui/wxpython/gcp/manager.py

+ 19 - 11
gui/wxpython/gcp/manager.py

@@ -613,18 +613,26 @@ class GroupPage(TitledPage):
         if self.xygroup == '':
             self.xygroup = self.cb_group.GetValue()
 
-        dlg = VectGroup(parent=self,
-                        id=wx.ID_ANY,
-                        grassdb=self.grassdatabase,
-                        location=self.xylocation,
-                        mapset=self.xymapset,
-                        group=self.xygroup)
-
-        if dlg.ShowModal() != wx.ID_OK:
-            return
+        vector_dir = os.path.join(self.grassdatabase,
+                                  self.xylocation,
+                                  self.xymapset,
+                                  'vector')
+
+        if os.path.exists(vector_dir):
+            dlg = VectGroup(parent=self,
+                            id=wx.ID_ANY,
+                            grassdb=self.grassdatabase,
+                            location=self.xylocation,
+                            mapset=self.xymapset,
+                            group=self.xygroup)
+
+            if dlg.ShowModal() != wx.ID_OK:
+                return
 
-        dlg.MakeVGroup()
-        self.OnEnterPage()
+            dlg.MakeVGroup()
+            self.OnEnterPage()
+        else:
+            GError(parent=self, message=_('No vector maps.'))
 
     def OnExtension(self, event):
         self.extension = self.ext_txt.GetValue()