Browse Source

wxGUI: remove '3D view' from toolbar if Nviz extension is not available
(merge from relbr64, https://trac.osgeo.org/grass/changeset/37040)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@37042 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 years ago
parent
commit
7f47d0a35e

+ 1 - 0
gui/wxpython/gui_modules/nviz.py

@@ -38,6 +38,7 @@ try:
 except ImportError, e:
     haveNviz = False
     errorMsg = e
+    print >> sys.stderr, "\nWARNING: Nviz extension (3D view) is not available (%s). " % e
 
 if haveNviz:
     GLWindow = nviz_mapdisp.GLWindow

+ 6 - 3
gui/wxpython/gui_modules/toolbars.py

@@ -32,7 +32,8 @@ import gcmd
 import gdialogs
 import vdigit
 from vdigit import VDigitSettingsDialog as VDigitSettingsDialog
-from vdigit import hasVDigit
+from vdigit import haveVDigit
+from nviz import haveNviz
 from debug import Debug as Debug
 from icon import Icons as Icons
 from preferences import globalSettings as UserSettings
@@ -162,9 +163,11 @@ class MapToolbar(AbstractToolbar):
         
         # optional tools
         self.combo = wx.ComboBox(parent=self.toolbar, id=wx.ID_ANY, value=_('2D view'),
-                                 choices=[_('2D view'), _('3D view')], 
+                                 choices=[_('2D view'), ], 
                                  style=wx.CB_READONLY, size=(90, -1))
-        if hasVDigit:
+        if haveNviz:
+            self.combo.Append(_('3D view'))
+        if haveVDigit:
             self.combo.Append(_('Digitize'))
         
         self.comboid = self.toolbar.AddControl(self.combo)

+ 3 - 5
gui/wxpython/gui_modules/vdigit.py

@@ -54,16 +54,14 @@ try:
     import grass7_wxvdigit as wxvdigit
     GV_LINES = wxvdigit.GV_LINES
     PseudoDC = wxvdigit.PseudoDC
-    hasVDigit = True
+    haveVDigit = True
     digitErr = ''
 except ImportError, err:
-    hasVDigit = False
+    haveVDigit = False
     GV_LINES = None
     PseudoDC = wx.PseudoDC
     digitErr = err
-    print >> sys.stderr, "%sWARNING: Digitization tool is disabled (%s). " \
-          "Detailed information in README file." % \
-          (os.linesep, err)
+    print >> sys.stderr, "\nWARNING: Vector digitizer is not available (%s). " % err
 
 class AbstractDigit:
     """

+ 3 - 2
gui/wxpython/gui_modules/wxgui_utils.py

@@ -35,6 +35,7 @@ import grass
 import gdialogs
 import globalvar
 import menuform
+import toolbars
 import mapdisp
 import render
 import histogram
@@ -43,7 +44,7 @@ import profile
 from debug import Debug as Debug
 from icon import Icons as Icons
 from preferences import globalSettings as UserSettings
-from vdigit import hasVDigit
+from vdigit import haveVDigit
 try:
     import subprocess
 except:
@@ -290,7 +291,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.Bind (wx.EVT_MENU, self.lmgr.OnShowAttributeTable, id=self.popupID4)
 
             self.popupMenu.Append(self.popupID5, text=_("Start editing"))
-            if not hasVDigit:
+            if not haveVDigit:
                 self.popupMenu.Enable(self.popupID5, False)
             self.popupMenu.Append(self.popupID6, text=_("Stop editing"))
             self.popupMenu.Enable(self.popupID6, False)