[GRASS-SVN] r62054 - in grass/branches/releasebranch_7_0: . gui/wxpython/modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 23 07:50:49 PDT 2014


Author: martinl
Date: 2014-09-23 07:50:49 -0700 (Tue, 23 Sep 2014)
New Revision: 62054

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/gui/wxpython/modules/extensions.py
Log:
wxGUI/extension: load data in different thread
                 (merge r61993 from trunk)



Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,62005
   + /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,61993,62005

Modified: grass/branches/releasebranch_7_0/gui/wxpython/modules/extensions.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/modules/extensions.py	2014-09-23 12:36:25 UTC (rev 62053)
+++ grass/branches/releasebranch_7_0/gui/wxpython/modules/extensions.py	2014-09-23 14:50:49 UTC (rev 62054)
@@ -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