[GRASS-SVN] r61993 - grass/trunk/gui/wxpython/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 16 04:31:29 PDT 2014


Author: martinl
Date: 2014-09-16 04:31:29 -0700 (Tue, 16 Sep 2014)
New Revision: 61993

Modified:
   grass/trunk/gui/wxpython/modules/extensions.py
Log:
wxGUI/extension: load data in different thread


Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py	2014-09-16 11:17:22 UTC (rev 61992)
+++ grass/trunk/gui/wxpython/modules/extensions.py	2014-09-16 11:31:29 UTC (rev 61993)
@@ -28,6 +28,7 @@
 from core             import globalvar
 from core.gcmd        import GError, RunCommand, GException, GMessage
 from core.utils       import SetAddOnPath, _
+from core.gthread import gThread
 from core.menutree    import TreeModel, ModuleNode
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.treeview import CTreeView
@@ -63,6 +64,8 @@
         self.search.showSearchResult.connect(lambda result: self.tree.Select(result))
         # show text in statusbar when notification appears
         self.search.showNotification.connect(lambda message: self.SetStatusText(message))
+        # load data in different thread
+        self.thread = gThread()
 
         self.optionBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
                                       label = " %s " % _("Options"))
@@ -187,14 +190,17 @@
         wx.BeginBusyCursor()
         self.SetStatusText(_("Fetching list of modules from GRASS-Addons SVN (be patient)..."), 0)
         try:
-            self.modelBuilder.Load(url = self.repo.GetValue().strip())
+            self.thread.Run(callable=self.modelBuilder.Load, url=self.repo.GetValue().strip(),
+                            ondone=lambda event: self._fetchDone())
         except GException as e:
+            self._fetchDone()
             GError(unicode(e), parent = self, showTraceback = False)
-        
+            
+    def _fetchDone(self):
         self.tree.RefreshItems()
         self.SetStatusText("", 0)
         wx.EndBusyCursor()
-
+        
     def OnContextMenu(self, node):
         if not hasattr (self, "popupID"):
             self.popupID = dict()



More information about the grass-commit mailing list