[GRASS-SVN] r49836 - in grass/trunk/gui/wxpython: iclass lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 19 08:09:30 EST 2011


Author: martinl
Date: 2011-12-19 05:09:30 -0800 (Mon, 19 Dec 2011)
New Revision: 49836

Modified:
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI/iclass: show error message when unable to launch wxIClass


Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2011-12-19 12:39:23 UTC (rev 49835)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2011-12-19 13:09:30 UTC (rev 49836)
@@ -32,11 +32,12 @@
 try:
     from grass.lib.imagery import *
     from grass.lib.vector import *
+    haveIClass = True
+    errMsg = ''
 except ImportError, e:
-    sys.stderr.write(_("Loading imagery lib failed"))
+    haveIClass = False
+    errMsg = _("Loading imagery lib failed.\n%s") % e
 
-
-#sys.path.append(os.path.join(globalvar.ETCWXDIR, "icons"))
 import grass.script as grass
 
 from mapdisp            import statusbar as sb
@@ -55,7 +56,6 @@
 from iclass.dialogs     import CategoryListCtrl, IClassCategoryManagerDialog,\
                                IClassGroupDialog, IClassMapDialog, IClassSignatureFileDialog
 from iclass.plots       import PlotPanel
-
         
 class IClassMapFrame(DoubleMapFrame):
     """! wxIClass main frame
@@ -76,7 +76,6 @@
         @param toolbars dictionary of active toolbars (defalult value represents all toolbars)
         @param size default size
         """
-        
         DoubleMapFrame.__init__(self, parent = parent, title = title,
                                 name = name,
                                 firstMap = Map(), secondMap = Map(),

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2011-12-19 12:39:23 UTC (rev 49835)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2011-12-19 13:09:30 UTC (rev 49836)
@@ -65,7 +65,6 @@
 from gui_core.forms        import GUI
 from gcp.manager           import GCPWizard
 from nviz.main             import haveNviz
-from iclass.frame          import IClassMapFrame
 
 class GMFrame(wx.Frame):
     """!Layer Manager frame with notebook widget for controlling GRASS
@@ -1100,6 +1099,12 @@
         
     def OnIClass(self, event):
         """!Start wxIClass tool"""
+        from iclass.frame import IClassMapFrame, haveIClass, errMsg
+        if not haveIClass:
+            GError(_('Unable to launch "Supervised Classification Tool".\n\n'
+                     'Reason: %s') % errMsg)
+            return
+        
         win = IClassMapFrame(parent = self)
         win.CentreOnScreen()
         



More information about the grass-commit mailing list