6 """ Holds a list of commands that shall be executed in one Thread in a chain.
8 The chain can run in two modes: Eighter it receives a command with optional attributes on construction. The return value can be accessed by calling returnValue() without arguments.
9 In the second mode the constructor does not receive any arguments and commands are passed to the chain with addComand().
10 This function returns an id unique for the command making the return value of the command available through retrunValue(id).
11 Start the ThreadChain using start().
13 One can check if the thread is still running using isRunning().
14 When all commands are executed a signal "finishedThreadChain" will be emitted.
18 QThread.__init__(self,
None)
27 """ Adds a command to this ThreadChain
29 and returns an id which is required to obtain the return value of this command.
31 *attr is a optional tuple of arguments which will be passed to the command on execution.
38 self.emit(SIGNAL(
'finishedThreadChain'), self._returnValues.values())
42 self._returnValues.clear()
45 if command
in self._returnValues.keys():
46 self._returnValues.pop(command)
51 """ Returns return value of command with given id.
53 The id is returned by addCommand().
54 If id is None the return value of the last command will be returned.
56 if id
in self._returnValues.keys():
62 return self.
_returnValues[self._returnValues.keys()[valueLength-1]]
67 if not self.isRunning():
74 id, command, attr = self._commandTuples.pop(0)
79 self.emit(SIGNAL(
'finishedThreadChain'), self._returnValues.values())