[GRASS-SVN] r49632 - in grass/trunk/gui/wxpython: core lmgr mapdisp
modules nviz vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 9 05:16:48 EST 2011
Author: martinl
Date: 2011-12-09 02:16:48 -0800 (Fri, 09 Dec 2011)
New Revision: 49632
Modified:
grass/trunk/gui/wxpython/core/workspace.py
grass/trunk/gui/wxpython/lmgr/frame.py
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/modules/colorrules.py
grass/trunk/gui/wxpython/nviz/main.py
grass/trunk/gui/wxpython/vdigit/main.py
Log:
wxGUI: fix loading wx/ctypes modules
Modified: grass/trunk/gui/wxpython/core/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/core/workspace.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/core/workspace.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -22,7 +22,9 @@
from core.utils import normalize_whitespace
from core.settings import UserSettings
-from nviz.workspace import NvizSettings
+from nviz.main import haveNviz
+if haveNviz:
+ from nviz.workspace import NvizSettings
class ProcessWorkspaceFile:
def __init__(self, tree):
@@ -55,9 +57,12 @@
self.displayIndex = -1 # first display has index '0'
self.__processFile()
+
+ if haveNviz:
+ self.nvizDefault = NvizSettings()
+ else:
+ self.nvizDefault = None
- self.nvizDefault = NvizSettings()
-
def __filterValue(self, value):
"""!Filter value
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -56,7 +56,6 @@
from gmodeler.model import Model
from gmodeler.frame import ModelFrame
from modules.vclean import VectorCleaningFrame
-from nviz.tools import NvizToolWindow
from psmap.frame import PsMapFrame
from core.debug import Debug
from gui_core.ghelp import MenuTreeWindow, AboutWindow
@@ -66,6 +65,7 @@
from lmgr.pyshell import PyShellWindow
from gui_core.forms import GUI
from gcp.manager import GCPWizard
+from nviz.main import haveNviz
class GMFrame(wx.Frame):
"""!Layer Manager frame with notebook widget for controlling GRASS
@@ -267,6 +267,11 @@
def AddNvizTools(self):
"""!Add nviz notebook page"""
Debug.msg(5, "GMFrame.AddNvizTools()")
+ if not haveNviz:
+ return
+
+ from nviz.tools import NvizToolWindow
+
# show toolbar
self._auimgr.GetPane('toolbarNviz').Show()
# reorder other toolbars
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -52,7 +52,8 @@
from wxplot.profile import ProfileFrame
from wxplot.scatter import ScatterFrame
from nviz.main import haveNviz
-from nviz.mapwindow import GLWindow
+if haveNviz:
+ from nviz.mapwindow import GLWindow
from mapdisp import statusbar as sb
Modified: grass/trunk/gui/wxpython/modules/colorrules.py
===================================================================
--- grass/trunk/gui/wxpython/modules/colorrules.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/modules/colorrules.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -42,7 +42,7 @@
from gui_core.forms import GUI
from core.debug import Debug as Debug
from core.settings import UserSettings
-from nviz.mapwindow import wxUpdateProperties
+from nviz.main import haveNviz
class RulesPanel:
def __init__(self, parent, mapType, attributeType, properties, panelWidth = 180):
@@ -1676,8 +1676,12 @@
data['vector'][self.vectorType]['thematic']['update'] = None
- event = wxUpdateProperties(data = data)
- wx.PostEvent(self.parent.mapWindow, event)
+ if haveNviz:
+ from nviz.mapwindow import wxUpdateProperties
+
+ event = wxUpdateProperties(data = data)
+ wx.PostEvent(self.parent.mapWindow, event)
+
self.parent.mapWindow.Refresh(False)
return ret
Modified: grass/trunk/gui/wxpython/nviz/main.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/main.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/nviz/main.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -25,7 +25,7 @@
import nviz.tools
import wxnviz
haveNviz = True
-except ImportError, err:
+except (ImportError, NameError), err:
haveNviz = False
errorMsg = err
Modified: grass/trunk/gui/wxpython/vdigit/main.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/main.py 2011-12-08 20:59:28 UTC (rev 49631)
+++ grass/trunk/gui/wxpython/vdigit/main.py 2011-12-09 10:16:48 UTC (rev 49632)
@@ -18,7 +18,7 @@
from vdigit.wxdigit import IVDigit, GV_LINES
haveVDigit = True
errorMsg = ''
-except ImportError, err:
+except (ImportError, NameError), err:
haveVDigit = False
errorMsg = err
GV_LINES = -1
More information about the grass-commit
mailing list