[GRASS-SVN] r57156 - in grass/trunk/gui/wxpython: core modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 15 09:00:33 PDT 2013


Author: martinl
Date: 2013-07-15 09:00:32 -0700 (Mon, 15 Jul 2013)
New Revision: 57156

Modified:
   grass/trunk/gui/wxpython/core/gcmd.py
   grass/trunk/gui/wxpython/modules/extensions.py
Log:
wxGUI/extension: generate message error dialog when loading fails

Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2013-07-15 15:57:34 UTC (rev 57155)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2013-07-15 16:00:32 UTC (rev 57156)
@@ -149,6 +149,9 @@
     def __str__(self):
         return self.value
 
+    def __unicode__(self):
+        return self.value
+
 class Popen(subprocess.Popen):
     """!Subclass subprocess.Popen"""
     def __init__(self, args, **kwargs):

Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py	2013-07-15 15:57:34 UTC (rev 57155)
+++ grass/trunk/gui/wxpython/modules/extensions.py	2013-07-15 16:00:32 UTC (rev 57156)
@@ -26,7 +26,7 @@
 from grass.script import task as gtask
 
 from core             import globalvar
-from core.gcmd        import GError, RunCommand
+from core.gcmd        import GError, RunCommand, GException
 from core.utils       import SetAddOnPath
 from core.menutree    import TreeModel, ModuleNode
 from gui_core.widgets import GListCtrl, SearchModuleWidget
@@ -183,7 +183,11 @@
         """!Fetch list of available extensions"""
         wx.BeginBusyCursor()
         self.SetStatusText(_("Fetching list of modules from GRASS-Addons SVN (be patient)..."), 0)
-        self.modelBuilder.Load(url = self.repo.GetValue().strip())
+        try:
+            self.modelBuilder.Load(url = self.repo.GetValue().strip())
+        except GException, e:
+            GError(unicode(e), parent = self, showTraceback = False)
+        
         self.tree.RefreshItems()
         self.SetStatusText("", 0)
         wx.EndBusyCursor()
@@ -273,7 +277,7 @@
                          svnurl = url,
                          flags = flags, quiet = True)
         if not ret:
-            return
+            raise GException(_("Unable to load extensions."))
         
         currentNode = None
         for line in ret.splitlines():
@@ -311,8 +315,7 @@
                 currentNode.data = {'command': module,
                                     'keywords': '',
                                     'description': ''}        
-
-
+        
 class UninstallExtensionWindow(wx.Frame):
     def __init__(self, parent, id = wx.ID_ANY,
                  title = _("Uninstall GRASS Addons extensions"), **kwargs):



More information about the grass-commit mailing list