[GRASS-SVN] r43151 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 16 14:38:17 EDT 2010


Author: martinl
Date: 2010-08-16 18:38:17 +0000 (Mon, 16 Aug 2010)
New Revision: 43151

Modified:
   grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/wxnviz.py
Log:
wxGUI: don't crash when wxnviz is broken
(merge r43149 from trunk)


Modified: grass/trunk/gui/wxpython/gui_modules/nviz_tools.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 18:37:38 UTC (rev 43150)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_tools.py	2010-08-16 18:38:17 UTC (rev 43151)
@@ -36,11 +36,13 @@
 import gselect
 import gcmd
 from preferences import globalSettings as UserSettings
-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/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2010-08-16 18:37:38 UTC (rev 43150)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2010-08-16 18:38:17 UTC (rev 43151)
@@ -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/trunk/gui/wxpython/gui_modules/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2010-08-16 18:37:38 UTC (rev 43150)
+++ grass/trunk/gui/wxpython/gui_modules/wxnviz.py	2010-08-16 18:38:17 UTC (rev 43151)
@@ -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