[GRASS-SVN] r43149 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 16 14:35:52 EDT 2010


Author: martinl
Date: 2010-08-16 18:35:52 +0000 (Mon, 16 Aug 2010)
New Revision: 43149

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
Log:
wxGUI: don't crash when wxnviz is broken

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 17:02:58 UTC (rev 43148)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 18:35:52 UTC (rev 43149)
@@ -37,11 +37,13 @@
 import gcmd
 from preferences import globalSettings as UserSettings
 from preferences import PreferencesBaseDialog
-from nviz_mapdisp import wxUpdateView, wxUpdateLight, wxUpdateProperties
+try:
+    from nviz_mapdisp import wxUpdateView, wxUpdateLight, wxUpdateProperties
+    import wxnviz
+except ImportError:
+    pass
 from debug import Debug
 
-import wxnviz
-
 class NvizToolWindow(FN.FlatNotebook):
     """!Nviz (3D view) tools panel
     """

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-08-16 17:02:58 UTC (rev 43148)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py	2010-08-16 18:35:52 UTC (rev 43149)
@@ -184,14 +184,9 @@
             choices.append(_('3D view'))
             self.toolId['3d'] = 1
         else:
-            from nviz import errorMsg as errorMsg1
-            from wxnviz import errorMsg as errorMsg2
-            if errorMsg2:
-                errorMsg = str(errorMsg1) + ' (' + str(errorMsg2) + ')'
-            else:
-                errorMsg = str(errorMsg1)
+            from nviz import errorMsg
             log.WriteCmdLog(_('3D view mode not available'))
-            log.WriteWarning(_('Reason: %s') % errorMsg)
+            log.WriteWarning(_('Reason: %s') % str(errorMsg))
             log.WriteLog(_('Note that the 3D view mode is currently not working under MS Windows '
                            '(hopefully this will be fixed soon). '
                            'Please keep an eye out for updated versions of GRASS.'), wrap = 60)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py	2010-08-16 17:02:58 UTC (rev 43148)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxnviz.py	2010-08-16 18:35:52 UTC (rev 43149)
@@ -22,15 +22,16 @@
 from threading import Thread
 
 from ctypes import *
-try:
-    from grass.lib.grass import *
-    from grass.lib.g3d   import *
-    from grass.lib.ogsf  import *
-    from grass.lib.nviz  import *
-    errorMsg = ''
-except ImportError, err:
-    errorMsg = err
+from grass.lib.grass import *
+from grass.lib.g3d   import *
+from grass.lib.ogsf  import *
+from grass.lib.nviz  import *
 
+errtype = CFUNCTYPE(UNCHECKED(c_int), String, c_int)
+errfunc = errtype(print_error)
+pertype = CFUNCTYPE(UNCHECKED(c_int), c_int)
+perfunc = pertype(print_progress)
+
 from debug import Debug
 
 log      = None
@@ -56,12 +57,6 @@
     
     return 0
 
-errtype = CFUNCTYPE(UNCHECKED(c_int), String, c_int)
-errfunc = errtype(print_error)
-
-pertype = CFUNCTYPE(UNCHECKED(c_int), c_int)
-perfunc = pertype(print_progress)
-
 class Nviz(object):
     def __init__(self, glog, gprogress):
         """!Initialize Nviz class instance



More information about the grass-commit mailing list