Application Support

rcp.app

Objects related to the application event loop and life cycle. This uses QtCore but not QtGui so this functionality is compatible with non-graphical command-line programs.

class rcp.app.MainApp[source]

Root application class for managing common elements of our applications. This is intended to be inherited by an top-level application controller along with other root classes which define specific interface API.

Variables
  • config – configuration parser object to hold persistent user selections

  • configuration_file_path – path of current configuration file, possibly not yet existing

app_has_started()[source]

Callback to be invoked right after the main event loop begins. This may be extended in child classes to implement startup behaviors which require a running event loop.

app_is_exiting()[source]

Callback invoked right before the program ends, either from a keyboard interrupt window close. This may be extended in child classes to clean up external resources, e.g., close any serial ports to remove associated lock files.

initialize_default_configuration()[source]

Method to add default configuration values. This is intended to be extended in child classes. It is called during object initialization.

load_configuration(path=None)[source]

Method to load the current configuration file if it exists. This is not called by default, it must be invoked explicitly by child classes.

save_configuration(path=None)[source]

Method to save the current configuration file. This is not called by default, it must be invoked explicitly by child classes.

rcp.app.add_console_log_handler(level=10)[source]

Add an additional root log handler to stream messages to the console.

rcp.app.add_file_log_handler(path, level=10)[source]

Add an additional root log handler to stream messages to a file.

rcp.app.add_memory_log_handler(level=10)[source]

Add an additional root log handler to capture messages in memory. Returns the handler object. No default target handler is set. This is intended to capture the early startup log before normal output (e.g. logging window) is established.

rcp.QtConfig

PyQt5 widgets to create configuration fields and forms.

class rcp.QtConfig.QtConfigComboBox(callback=None, default='<no selection>')[source]

Composite widget enabling a user to select an item from a drop down list.

Parameters
  • callback – function called with argument (string)

  • default – name of initial selection, defaults to ‘<no selection>’

select_item(name)[source]

Called to programmatically select an item; updates the display and applies the callback.

class rcp.QtConfig.QtConfigFileButtons(delegate=None, path=None, extension='config')[source]

Composite widget with buttons to control loading and saving a configuration file.

class rcp.QtConfig.QtConfigForm[source]

Composite widget to display a form of user-configuration entries.

addField(prompt, widget)[source]

Add a row to the configuration form.

Parameters
  • prompt – string of text to display on the left

  • widget – a widget to both display status and receive and validate input

class rcp.QtConfig.QtConfigOSCPort(callback=None, address='localhost', portnum=3761)[source]

Composite widget enabling a user to configure an address:portnum field.

Parameters
  • callback – function called with arguments (address-string, port-integer)

  • address – host address string, defaults to ‘localhost’

  • portnum – UDP port integer, defaults to 3761

set_OSC_port(address, portnum)[source]

Set the network address and port display as if entered, validating the result and applying the callback.

validate_input()[source]

Called when the user finishes entering text into the line editor.

class rcp.QtConfig.QtConfigText(callback, value=None)[source]

Composite widget enabling a user to configure an field of unvalidated text.

Parameters
  • callback – function called with argument (string)

  • value – initial string, defaults to None which shows as blank

validate_input()[source]

Called when the user finishes entering text into the line editor.

rcp.QtLog

PyQt5 widgets to show and control logging output.

class rcp.QtLog.QtLog(level=None, logger=None)[source]

Composite widget including log text output and control widgets.

Parameters
  • level – initial logging level, defaults to logging.WARNING

  • logger – logger object to which to attach, defaults to root logger

set_logging_level(title)[source]

Set the current logging level and level display.

write(string)[source]

Write output to the log text area. This enables this object to be used as a stream for printing.