Ignore:
Timestamp:
01/30/12 13:26:35 (2 years ago)
Author:
ales_erjavec
Branch:
default
rebase_source:
93d9a8315adfd1a4bbb151a4cc36a5ecd53e784f
Message:

Added support task canceling (before it is run).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWConcurrent.py

    r8042 r9603  
    44 
    55General helper functions and classes for Orange Canvas 
    6 concurent programming 
     6concurrent programming 
     7 
    78""" 
    89from __future__ import with_statement 
     
    3738        self._kwargs = kwargs 
    3839        self.threadPool = None 
     40         
     41        self._connected = True 
     42        self._cancelRequested = False 
     43        self._started = False 
     44        self._cancelled = False 
     45         
    3946        if thread is not None: 
    4047            self.moveToThread(thread) 
     
    4956             
    5057        self.connect(self, SIGNAL("_async_start()"), self.execute, Qt.QueuedConnection) 
    51         self._connected = True 
     58         
    5259 
    5360 
     
    5764        """ 
    5865        assert(self.thread() is QThread.currentThread()) 
     66        if self._cancelRequested: 
     67            self._cancelled = True 
     68            self._status = 2 
     69            self.emit(SIGNAL("finished(QString)"), QString("Cancelled")) 
     70            return 
     71        self._started = True 
    5972        self.emit(SIGNAL("starting()")) 
    6073        try: 
     
    118131        """ 
    119132        self.join(processEvents=processEvents) 
    120         if self.poll() != 0: 
     133        if self.poll() != 0:  
    121134            # re-raise the error 
    122135            raise self._exc_info[0], self._exc_info[1] 
     
    269282A multiprocessing like API 
    270283========================== 
     284 
     285Incomplette 
    271286""" 
    272287 
     
    329344    def start(self, ): 
    330345        pass 
    331  
     346     
Note: See TracChangeset for help on using the changeset viewer.