The work module#

The Worker class, inheriting from parce’s Worker class.

class Worker(qtextdocument, treebuilder=None, transformer=None)[source]#

Bases: Worker, SingleInstance

A Worker that uses Qt signals instead of callbacks.

This Worker is attachted to a QTextDocument, and automatically updates the tokens (and optionally the transformed result) when the document changes.

started#

Qt signal emitted with no arguments when start_build() is called.

tree_updated#

Qt signal emitted with two arguments (start, end) when the tree has been updated.

tree_finished#

Qt signal emitted with no arguments just after tree_updated has been emitted.

transform_finished#

Qt signal emitted with no arguments when the transformation has been finished.

debugging = False#

set debugging to True to print some info to the console while running

document()[source]#

Return the QTextDocument, which is our parent.

slot_contents_change(start, removed, added)[source]#

Called after modification of the text, retokenizes the modified part.

run_process()[source]#

Reimplemented to run parts of the process in a Qt Thread.

wait_build()[source]#

Wait for the build job to be completed.

Immediately returns if there is no build job active.

wait_transform()[source]#

Wait for the transform job to be completed.

Immediately returns if there is no transform job active.

start_build()[source]#

Reimplemented to emit the started signal.

finish_build()[source]#

Reimplemented to emit the tree_updated and tree_finished signals.

finish_transform()[source]#

Reimplemented to emit the transform_finished signal.