Package Editra :: Package src :: Package eclib :: Module outbuff
[hide private]

Module outbuff

source code


Editra Control Library: OutputBuffer

This module contains classes that are usefull for displaying output from running
tasks and processes. The classes are divided into three main catagories, gui
classes, mixins, and thread classes. All the classes can be used together to
easily create multithreaded gui display classes without neededing to worry about
the details and thread safety of the gui.

For example usage of these classes see ed_log and the Editra's Launch plugin

Class OutputBuffer:
This is the main class exported by ths module. It provides a readonly output
display buffer that when used with the other classes in this module provides an
easy way to display continous output from other processes and threads. It
provides two methods for subclasses to override if they wish to perform custom
handling.

  - Override the ApplyStyles method to do any processing and coloring of the
    text as it is put in the buffer.
  - Override the DoHotSpotClicked method to handle any actions to take when a
    hotspot has been clicked in the buffer.
  - Override the DoUpdatesEmpty method to perform any idle processing when no
    new text is waiting to be processed.

Class ProcessBufferMixin:
Mixin class for the L{OutputBuffer} class that provides handling for when an
OutputBuffer is used with a L{ProcessThread}. It provides three methods that can
be overridden in subclasses to perform extra processing.

  - DoProcessStart: Called as the process is being started in the ProcessThread,
                    it recieves the process command string as an argument.
  - DoFilterInput: Called as each chunk of output comes from the running process
                   use it to filter the results before displaying them in the
                   buffer.
  - DoProcessExit: Called when the running process has exited. It recieves the
                   processes exit code as a parameter.

Class ProcessThread:
Thread class for running subprocesses and posting the output to an
L{OutputBuffer} via events.

Class TaskThread:
Thread class for running a callable. For optimal performance and resposiveness
the callable should be a generator object. All results are directed to an
L{OutputBuffer} through its AppendUpdate method.

Requirements:
  * wxPython 2.8
  * Macintosh/Linux/Unix Python 2.4+
  * Windows Python 2.5+ (ctypes is needed)


Author: Cody Precord <cprecord@editra.org>

Classes [hide private]
  OutputBufferEvent
Event for data transfer and signaling actions in the OutputBuffer
  OutputBuffer
OutputBuffer is a general purpose output display for showing text.
  ProcessBufferMixin
Mixin class for OutputBuffer to handle events generated by a ProcessThread.
  ProcessThread
Run a subprocess in a separate thread.
  TaskThread
Run a task in its own thread.
Variables [hide private]
  __svnid__ = '$Id: outbuff.py 57345 2008-12-14 23:47:52Z CJP $'
  __revision__ = '$Revision: 57345 $'
  OUTPUTBUFF_NAME_STR = u'EditraOutputBuffer'
  THREADEDBUFF_NAME_STR = u'EditraThreadedBuffer'
  OPB_STYLE_DEFAULT = 0
  OPB_STYLE_INFO = 1
  OPB_STYLE_WARN = 2
  OPB_STYLE_ERROR = 3
  OPB_STYLE_MAX = 3
  OPB_ALL_STYLES = (32, 36, 0, 3, 1, 2)
  edEVT_PROCESS_START = 10341
  EVT_PROCESS_START = wx.PyEventBinder(edEVT_PROCESS_START, 1)
  edEVT_TASK_START = 10342
  EVT_TASK_START = wx.PyEventBinder(edEVT_TASK_START, 1)
  edEVT_UPDATE_TEXT = 10343
  EVT_UPDATE_TEXT = wx.PyEventBinder(edEVT_UPDATE_TEXT, 1)
  edEVT_PROCESS_EXIT = 10344
  EVT_PROCESS_EXIT = wx.PyEventBinder(edEVT_PROCESS_EXIT, 1)
  edEVT_TASK_COMPLETE = 10345
  EVT_TASK_COMPLETE = wx.PyEventBinder(edEVT_TASK_COMPLETE, 1)