gsdview.ptc.qt

Tools for running external processes in a QT4 GUI.

Classes

BaseOutputHandler([loggername]) Base class for output handlers
BaseToolController([loggername]) Base class for controlling command line tools
Qt4Blinker([filename])
Qt4OutputHandler(loggername[, statusbar, ...]) Qt4 Output Handler
Qt4ToolController([loggername, parent]) Qt4 tool controller
class gsdview.ptc.qt.Qt4Blinker(filename=None)
flush()
pulse()
A blinker pulse
reset()
Reset the blinker
class gsdview.ptc.qt.Qt4OutputHandler(loggername, statusbar=None, progressbar=None, blinker=None)

Qt4 Output Handler

close()
Reset the instance
feed(data)

Feed some data to the parser

It is processed insofar as it consists of complete elements; incomplete data is buffered until more data is fed or close() is called.

handle_percentage(data)

Handle percentage of a precess execution

Parameters :
  • ‘data’ : percentage
handle_progress(data)

Handle progress data

Parameters :
  • data: a list containing an item for each named group in the “progress” regular expression and buffer content without whitespaces and ‘r’, ‘n’ chars: (pulse, percentage, text, basedata) for the default implementation. Each of first three items can be None.
handle_pulse(data=None)
Handle a blinker pulse
reset()

Reset the handler instance

Loses all unprocessed data. This is called implicitly at instantiation time.

class gsdview.ptc.qt.Qt4ToolController(loggername='dialog', parent=None)

Qt4 tool controller

Signals :
  • externalToolStarted()
  • failedToStart(PyQt_PyObject tooldescriptor)
  • finished(PyQt_PyObject tooldescriptor, int exitCode)
  • planeHideRequest()
finalize_run(exitCode=None, exitStatus=None)

Perform finalization actions

This method is called when the controlled process terminates to perform finalization actions like:

  • read and handle residual data in buffers,
  • flush and close output handlers,
  • close subprocess file descriptors
  • run the “finalize_run_hook” method
  • reset the controller instance

If one just needs to perfor some additional finalization action it should be better to use a custom “finalize_run_hook” instead of overriging “finalize_run”.

handle_error(error)

Handle a error in process execution

Can be handle different types of errors:

  • starting failed
  • crashing after starts successfully
  • timeout elapsed
  • write error
  • read error
  • unknow error
handle_state_changed(newstare)
handle_stderr(*args)
Handle standard error
handle_stdout(*args)
Handle standard output
reset_controller()
Reset the tool controller instance losing all unprocessed data
run_tool(tooldescriptor, *args)

Run an external tool in controlled way

The output of the child process is handled by the controller and, optionally, notifications can be achieved at sub-process termination.

stop_tool(force=True)

Stop the execution of controlled subprocess

When this method is invoked the controller instance is always reset even if the controller is unable to stop the subprocess.

When possible the controller try to kill the subprocess in a polite way. If this fails it also tryes brute killing by default (force=True). This behaviour can be controlled using the force parameter.

stopped

Previous topic

gsdview.ptc.core

Next topic

gsdview.ptc.info

This Page