[GRASS-SVN] r63228 - grass/branches/releasebranch_7_0/gui/wxpython/iscatt

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 28 01:43:48 PST 2014


Author: turek
Date: 2014-11-28 01:43:48 -0800 (Fri, 28 Nov 2014)
New Revision: 63228

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py
Log:
iscatt: gThread class deleted, it was moved to core before

Modified: grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py	2014-11-28 09:43:14 UTC (rev 63227)
+++ grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py	2014-11-28 09:43:48 UTC (rev 63228)
@@ -1111,99 +1111,3 @@
             self.scatt_mgr.SetBands(bands)
 
 
-#TODO it uses also BufferedMapWindow class -> move to core?
-class gThread(threading.Thread, wx.EvtHandler):
-    """Thread for scatter plot backend"""
-    requestId = 0
-
-    def __init__(self, requestQ=None, resultQ=None, **kwds):
-        wx.EvtHandler.__init__(self)
-        self.terminate = False
-
-        threading.Thread.__init__(self, **kwds)
-
-        if requestQ is None:
-            self.requestQ = Queue.Queue()
-        else:
-            self.requestQ = requestQ
-
-        if resultQ is None:
-            self.resultQ = Queue.Queue()
-        else:
-            self.resultQ = resultQ
-
-        self.setDaemon(True)
-
-        self.Bind(EVT_CMD_DONE, self.OnDone)
-        self.start()
-
-    def Run(self, *args, **kwds):
-        """Run command in queue
-
-        :param args: unnamed command arguments
-        :param kwds: named command arguments, keyword 'callable'
-                     represents function to be run, keyword 'ondone'
-                     represents function to be called after the
-                     callable is done
-
-        :return: request id in queue
-        """
-        gThread.requestId += 1
-        self.requestQ.put((gThread.requestId, args, kwds))
-
-        return gThread.requestId
-
-    def GetId(self):
-         """Get id for next command"""
-         return gThread.requestId + 1
-
-    def SetId(self, id):
-        """Set starting id"""
-        gThread.requestId = id
-
-    def run(self):
-        while True:
-            requestId, args, kwds = self.requestQ.get()
-            for key in ('callable', 'ondone', 'userdata'):
-                if key in kwds:
-                    vars()[key] = kwds[key]
-                    del kwds[key]
-                else:
-                    vars()[key] = None
-
-            requestTime = time.time()
-
-            ret = None
-            exception = None
-            time.sleep(.01)
-
-            if self.terminate:
-                return
-
-            ret = vars()['callable'](*args, **kwds)
-
-            if self.terminate:
-                return
-            #except Exception as e:
-            #    exception  = e;
-
-            self.resultQ.put((requestId, ret))
-
-            event = wxCmdDone(ondone=vars()['ondone'],
-                              kwds=kwds,
-                              args=args, #TODO expand args to kwds
-                              ret=ret,
-                              exception=exception,
-                              userdata=vars()['userdata'],
-                              pid=requestId)
-
-            # send event
-            wx.PostEvent(self, event)
-
-    def OnDone(self, event):
-        if event.ondone:
-            event.ondone(event)
-
-    def Terminate(self):
-        """Abort command(s)"""
-        self.terminate = True



More information about the grass-commit mailing list