ソースを参照

wxGUI/nviz: various minor fixes

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42925 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年 前
コミット
89b013311c

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

@@ -28,6 +28,7 @@ try:
     from wx import glcanvas
     import nviz_mapdisp
     import nviz_tools
+    import wxnviz
     haveNviz = True
 except ImportError, err:
     haveNviz = False

+ 2 - 0
gui/wxpython/gui_modules/toolbars.py

@@ -189,6 +189,8 @@ class MapToolbar(AbstractToolbar):
             from wxnviz import errorMsg as errorMsg2
             if errorMsg2:
                 errorMsg = str(errorMsg1) + ' (' + str(errorMsg2) + ')'
+            else:
+                errorMsg = str(errorMsg1)
             log.WriteCmdLog(_('3D view mode not available'))
             log.WriteWarning(_('Reason: %s') % errorMsg)
             log.WriteLog(_('Note that the 3D view mode is currently not working under MS Windows '

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

@@ -38,7 +38,6 @@ from preferences import globalSettings as UserSettings
 
 #sys.path.append(os.path.join(globalvar.ETCWXDIR, "nviz"))
 try:
-    #import grass7_wxnviz as wxnviz
     import wxnviz
 except ImportError:
     wxnviz = None
@@ -456,11 +455,11 @@ class Nviz:
 
             data['draw'][control] = { 'value' : value }
             data['draw'][control]['update'] = None
-            
+        
         value, desc = self.GetDrawMode(UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'mode']),
                                        UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'style']),
                                        UserSettings.Get(group='nviz', key='surface', subkey=['draw', 'shading']))
-
+    
         data['draw']['mode'] = { 'value' : value,
                                  'desc' : desc, 
                                  'update': None }

+ 33 - 9
gui/wxpython/gui_modules/wxnviz.py

@@ -487,8 +487,11 @@ class Nviz(object):
         Debug.msg(3, "Nviz::SetSurfaceAttr(): id=%d, attr=%d, map=%d, value=%s",
                   id, attr, map, value)
         
-        return 1 if ret else -2
-
+        if ret < 0:
+            return -2
+        
+        return 1
+    
     def UnsetSurfaceMask(self, id):
         """!Unset surface mask
         
@@ -541,7 +544,10 @@ class Nviz(object):
         
         ret = Nviz_unset_attr(id, MAP_OBJ_SURF, attr)
         
-        return 1 if ret else -2
+        if ret < 0:
+            return -2
+        
+        return 1
 
     def SetSurfaceRes(self, id, fine, coarse):
         """!Set surface resolution
@@ -852,7 +858,10 @@ class Nviz(object):
         
         ret = GVL_isosurf_del(id, isosurf_id)
         
-        return -3 if ret < 0 else 1
+        if ret < 0:
+            return -3
+
+        return 1
     
     def MoveIsosurface(self, id, isosurf_id, up):
         """!Move isosurface up/down in the list
@@ -877,7 +886,10 @@ class Nviz(object):
         else:
             ret = GVL_isosurf_move_down(id, isosurf_id)
         
-        return -3 if ret < 0 else 1
+        if ret < 0:
+            return -3
+
+        return 1
 
     def SetIsosurfaceColor(self, id, isosurf_id, map, value):
         """!Set isosurface color
@@ -990,7 +1002,10 @@ class Nviz(object):
                   "attr=%d, map=%d, value=%s",
                   id, isosurf_id, attr, map, value)
         
-        return 1 if ret > 0 else -2
+        if ret < 0:
+            return -2
+        
+        return 1
     
     def UnsetIsosurfaceMask(self, id, isosurf_id):
         """!Unset isosurface mask
@@ -1054,7 +1069,10 @@ class Nviz(object):
         
         ret = GVL_isosurf_unset_att(id, isosurf_id, attr)
         
-        return 1 if ret > 0 else -2
+        if ret < 0:
+            return -2
+        
+        return 1
 
     def SetIsosurfaceMode(self, id, mode):
         """!Set draw mode for isosurfaces
@@ -1070,7 +1088,10 @@ class Nviz(object):
         
         ret = GVL_isosurf_set_drawmode(id, mode)
         
-        return -2 if ret < 0 else 1
+        if ret < 0:
+            return -2
+        
+        return 1
     
     def SetIsosurfaceRes(self, id, res):
         """!Set draw resolution for isosurfaces
@@ -1086,7 +1107,10 @@ class Nviz(object):
         
         ret = GVL_isosurf_set_drawres(id, res, res, res)
         
-        return -2 if ret < 0 else 1
+        if ret < 0:
+            return -2
+        
+        return 1
 
     def SaveToFile(self, filename, width = 20, height = 20, itype = 'ppm'):
         """!Save current GL screen to ppm/tif file