SingletonWorker

Inheritance diagram of SingletonWorker
class SingletonWorker(parent=None, name='', queue=None, method=None, cursor=None, sleep=5000, log=30, start=True)[source]

Bases: object

SingletonWorker is used to manage TaurusEmitterThread as Singleton objects

SingletonWorker is constructed using the same arguments than TaurusTreadEmitter ; but instead of creating a QThread for each instance it creates a single QThread for all instances.

The Queue is still different for each of the instances; it is connected to the TaurusEmitterThread signals (next() and somethingDone()) and each Worker queue is used as a feed for the shared QThread.

This implementation reduced the cpu of vacca application in a 50% factor.

Parameters
  • parent – a Qt/Taurus object

  • name – identifies object logs

  • queue – if None parent.getQueue() is used, if not then the queue passed as argument is used

  • method – the method to be executed using each queue item as argument

  • cursor – if True or QCursor a custom cursor is set while the Queue is not empty

clear()[source]

This method will clear queue only if next() has not been called. If you call self.thread.clear() it will clear objects for all workers!, be careful

finished()[source]
getDone()[source]
getQueue()[source]
isFinished()[source]
isRunning()[source]
next(item=None)[source]
purge(obj)[source]

Remove a given object from all queues

put(item, block=True, timeout=None)[source]
size()[source]
sleep(s)[source]
start()[source]
started()[source]
stop()[source]
terminated()[source]