pycrossword  0.3
Pure-Python implementation of a crossword puzzle generator and editor
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
pycross.utils.utils.QThreadStump Class Reference

Customized thread class (based on QThread) that adds progress, error etc. More...

Inheritance diagram for pycross.utils.utils.QThreadStump:
pycross.gui.GenThread pycross.gui.ShareThread

Public Member Functions

def __init__ (self, default_priority=QtCore.QThread.NormalPriority, on_start=None, on_finish=None, on_run=None, on_error=None, start_signal=None, stop_signal=None, free_on_finish=False, start_now=False, can_terminate=True)
 Constructor. More...
 
def __del__ (self)
 Destructor: waits for the thread to complete. More...
 
def init (self, default_priority=QtCore.QThread.NormalPriority, on_start=None, on_finish=None, on_run=None, on_error=None, start_signal=None, stop_signal=None, free_on_finish=False, can_terminate=True)
 Initializes signals binding them to callbacks and other members. More...
 
def lock (self)
 
def unlock (self)
 
def run (self)
 

Public Attributes

 default_priority
 
 on_run
 
 mutex
 

Static Public Attributes

 sig_error = QtCore.pyqtSignal(QtCore.QThread, str)
 Error signal (args are: instance of this thread and the error message) More...
 

Detailed Description

Customized thread class (based on QThread) that adds progress, error etc.

signals and mutex locking to avoid thread racing.

Constructor & Destructor Documentation

◆ __init__()

def pycross.utils.utils.QThreadStump.__init__ (   self,
  default_priority = QtCore.QThread.NormalPriority,
  on_start = None,
  on_finish = None,
  on_run = None,
  on_error = None,
  start_signal = None,
  stop_signal = None,
  free_on_finish = False,
  start_now = False,
  can_terminate = True 
)

Constructor.

Parameters
default_priorityint thread default priority (default = normal)
on_startcallable callback function called before the main operation is executed (callback has no args or returned result)
on_finishcallable callback function called after the main operation completes (callback has no args or returned result)
on_runcallable callback function for the main operation (callback has no args or returned result)
on_errorcallable callback function to handle exceptions raised during the thread operation (see QThreadStump::sig_error)
start_signalQtCore.pyqtSignal signal that can be connected to the start slot (if not None)
stop_signalQtCore.pyqtSignal signal that can be connected to the terminate slot (if not None)
free_on_finishbool whether the thread instance will be deleted from memory after it completes its operation (default = False)
start_nowbool whether to start the thread upon creation (default = False)
can_terminatebool whether the thread can be terminated (default = True)

Reimplemented in pycross.gui.ShareThread.

◆ __del__()

def pycross.utils.utils.QThreadStump.__del__ (   self)

Destructor: waits for the thread to complete.

Member Function Documentation

◆ init()

def pycross.utils.utils.QThreadStump.init (   self,
  default_priority = QtCore.QThread.NormalPriority,
  on_start = None,
  on_finish = None,
  on_run = None,
  on_error = None,
  start_signal = None,
  stop_signal = None,
  free_on_finish = False,
  can_terminate = True 
)

Initializes signals binding them to callbacks and other members.

◆ lock()

def pycross.utils.utils.QThreadStump.lock (   self)

◆ run()

def pycross.utils.utils.QThreadStump.run (   self)

◆ unlock()

def pycross.utils.utils.QThreadStump.unlock (   self)

Member Data Documentation

◆ default_priority

pycross.utils.utils.QThreadStump.default_priority

◆ mutex

pycross.utils.utils.QThreadStump.mutex

◆ on_run

pycross.utils.utils.QThreadStump.on_run

◆ sig_error

pycross.utils.utils.QThreadStump.sig_error = QtCore.pyqtSignal(QtCore.QThread, str)
static

Error signal (args are: instance of this thread and the error message)


The documentation for this class was generated from the following file: