[GRASS-SVN] r37095 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun May 10 06:49:14 EDT 2009
Author: martinl
Date: 2009-05-10 06:49:14 -0400 (Sun, 10 May 2009)
New Revision: 37095
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: do not remove 'digitize' and '3d view' from the toolbar even if the extensions are not available (trac #586)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-05-10 10:14:23 UTC (rev 37094)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-05-10 10:49:14 UTC (rev 37095)
@@ -296,6 +296,19 @@
# vector digitizer
elif name == "vdigit":
+ from vdigit import haveVDigit
+ if not haveVDigit:
+ from vdigit import errorMsg
+ msg = _("Unable to start vector digitizer.\nThe VDigit python extension "
+ "was not found or loaded properly.\n"
+ "Switching back to 2D display mode.\n\nDetails: %s" % errorMsg)
+
+ self.toolbars['map'].combo.SetValue (_("2D view"))
+ wx.MessageBox(parent=self,
+ message=msg,
+ caption=_("Error"))
+ return
+
if self._layerManager:
log = self._layerManager.goutput
else:
@@ -337,16 +350,17 @@
# check for GLCanvas and OpenGL
msg = None
if not nviz.haveGLCanvas:
- msg = _("Unable to start Nviz. The GLCanvas class has not been "
+ msg = _("Unable to switch to 3D display mode.\nThe GLCanvas class has not been "
"included with this build "
- "of wxPython! Switching back to "
+ "of wxPython!\nSwitching back to "
"2D display mode.\n\nDetails: %s" % nviz.errorMsg)
if not nviz.haveNviz:
- msg = _("Unable to start Nviz. Python extension "
- "for Nviz was not found or loaded properly. "
+ msg = _("Unable to switch to 3D display mode.\nThe Nviz python extension "
+ "was not found or loaded properly.\n"
"Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg)
if msg:
+ self.toolbars['map'].combo.SetValue (_("2D view"))
wx.MessageBox(parent=self,
message=msg,
caption=_("Error"))
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2009-05-10 10:14:23 UTC (rev 37094)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2009-05-10 10:49:14 UTC (rev 37095)
@@ -32,8 +32,6 @@
import gdialogs
import vdigit
from vdigit import VDigitSettingsDialog as VDigitSettingsDialog
-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
@@ -163,12 +161,8 @@
# optional tools
self.combo = wx.ComboBox(parent=self.toolbar, id=wx.ID_ANY, value=_('2D view'),
- choices=[_('2D view'), ],
+ choices=[_('2D view'), _('3D view'), _('Digitize')],
style=wx.CB_READONLY, size=(90, -1))
- if haveNviz:
- self.combo.Append(_('3D view'))
- if haveVDigit:
- self.combo.Append(_('Digitize'))
self.comboid = self.toolbar.AddControl(self.combo)
self.mapdisplay.Bind(wx.EVT_COMBOBOX, self.OnSelectTool, self.comboid)
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-05-10 10:14:23 UTC (rev 37094)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-05-10 10:49:14 UTC (rev 37095)
@@ -55,12 +55,12 @@
GV_LINES = wxvdigit.GV_LINES
PseudoDC = wxvdigit.PseudoDC
haveVDigit = True
- digitErr = ''
+ errorMsg = ''
except ImportError, err:
haveVDigit = False
GV_LINES = None
PseudoDC = wx.PseudoDC
- digitErr = err
+ errorMsg = err
print >> sys.stderr, "\nWARNING: Vector digitizer is not available (%s). " % err
class AbstractDigit:
@@ -122,7 +122,7 @@
raise gcmd.DigitError(parent=self.mapWindow.parent,
message="%s %s (%s)" % (_('Unable to initialize display driver, '
'see README file for more information.\n\n'
- 'Details:'), e, digitErr))
+ 'Details:'), e, errorMsg))
if map and ret == -1:
raise gcmd.DigitError(parent=self.mapWindow.parent,
Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2009-05-10 10:14:23 UTC (rev 37094)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2009-05-10 10:49:14 UTC (rev 37095)
@@ -291,8 +291,6 @@
self.Bind (wx.EVT_MENU, self.lmgr.OnShowAttributeTable, id=self.popupID4)
self.popupMenu.Append(self.popupID5, text=_("Start editing"))
- if not haveVDigit:
- self.popupMenu.Enable(self.popupID5, False)
self.popupMenu.Append(self.popupID6, text=_("Stop editing"))
self.popupMenu.Enable(self.popupID6, False)
self.Bind (wx.EVT_MENU, self.OnStartEditing, id=self.popupID5)
@@ -501,6 +499,18 @@
"""
Start editing vector map layer requested by the user
"""
+ if not haveVDigit:
+ from vdigit import errorMsg
+ msg = _("Unable to start vector digitizer.\nThe VDigit python extension "
+ "was not found or loaded properly.\n"
+ "Switching back to 2D display mode.\n\nDetails: %s" % errorMsg)
+
+ self.mapdisplay.toolbars['map'].combo.SetValue (_("2D view"))
+ wx.MessageBox(parent=self.mapdisplay,
+ message=msg,
+ caption=_("Error"))
+ return
+
try:
maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
except:
More information about the grass-commit
mailing list