papi.gui package

Submodules

papi.gui.gui_api module

Contributors Stefan Ruppin

class papi.gui.gui_api.Gui_api(gui_data, core_queue, gui_id, get_gui_config_function=None, set_gui_config_function=None, TabManager=None, plugin_manager=None)[source]

Bases: PyQt5.QtCore.QObject

change_uname_to_uniqe(uname)[source]

Function will search for unames and add an indentifier to it to make it unique in case of existence

Parameters:uname (basestring) – uname to make unique
Returns:uname
config_loader_subs(pl_to_start, subs_to_make, parameters_to_change, signals_to_change)[source]
Function for callback when timer finished to apply
subscriptions and parameter changed of config.
Parameters:
  • pl_to_start (list) – list of plugins to start
  • subs_to_make (list) – list of subscriptions to make
  • parameters_to_change (list) – parameter changes to apply
  • signals_to_change (list) – signal name changes to apply
Returns:

config_loader_subs_reloaded(pl_to_start, subs_to_make, parameters_to_change, signals_to_change)[source]
Function for callback when timer finished to apply
subscriptions and parameter changed of config.
Parameters:
  • pl_to_start (list) – list of plugins to start
  • subs_to_make (list) – list of subscriptions to make
  • parameters_to_change (list) – parameter changes to apply
  • signals_to_change (list) – signal name changes to apply
Returns:

do_change_string_to_be_uname(name)[source]

This method will take a string and convert him according to some rules to be an uname

Parameters:name (basestring) – name to convert to unmae
Returns:name converted to uname
do_close_program()[source]

Tell core to close papi. Core will respond and will close all open plugins. GUI will close all VIP Plugins due to calling their quit function

do_create_plugin(plugin_identifier, uname, config={}, autostart=True)[source]

Something like a callback function for gui triggered events e.a. when a user wants to create a new plugin.

Parameters:
  • plugin_identifier (basestring) – plugin to create
  • uname (basestring) – uniqe name to set for new plugin
  • config – additional configuration for creation
Returns:

do_delete_plugin(id)[source]

Delete plugin with given id.

Parameters:id (int) – Plugin id to delete
Returns:
do_delete_plugin_uname(uname)[source]

Delete plugin with given uname.

Parameters:uname (basestring) – Plugin uname to delete
Returns:
do_edit_plugin(pl_id, eObject, changeRequest)[source]

Edit plugin with given plugin id. Specify attribute of plugin by eObject which should be edited e.g. DBlock. Specify action by changeRequest e.g. {‘edit’ : DSignal}. Currently only possible to change a DSignal for a given dplugin and dblock.

Parameters:pl_id (int) – Plugin id to delete
Returns:
do_edit_plugin_uname(uname, eObject, changeRequest)[source]

Edit plugin with given plugin uname. Specify attribute of plugin by eObject which should be edited e.g. DBlock. Specify action by changeRequest e.g. {‘edit’ : DSignal}. Currently only possible to change a DSignal for a given dplugin and dblock.

Parameters:
  • uname
  • eObject
  • changeRequest
Returns:

do_get_plugin_id_from_uname(uname)[source]

Returns the plugin id of the plugin with unique name uname

Parameters:uname (basestring) – uname of plugin
Returns:None: plugin with uname does not exist, id: id of plugin
do_load_xml(path)[source]
do_load_xml_reloaded(root)[source]

Function to load a xml config to papi and apply the configuration.

Parameters:path (basestring) – path to xml file to load.
Returns:
do_load_xml_v1(root)[source]

Function to load a xml config to papi and apply the configuration.

Parameters:path (basestring) – path to xml file to load.
Returns:
do_open_new_tabs_with_names_in_order(tabNames=None)[source]
do_pause_plugin_by_id(plugin_id)[source]

Something like a callback function for gui triggered events. User wants to pause a plugin, so this method will send an event to core.

Parameters:plugin_id (int) – id of plugin to pause
do_pause_plugin_by_uname(plugin_uname)[source]

Something like a callback function for gui triggered events. User wants to pause a plugin, so this method will send an event to core.

Parameters:plugin_uname (basestring) – uname of plugin to pause
do_reset_papi()[source]

APi call to reset PaPI. Reset in this case means to delete all plugins cleanly and keep PaPI running. Will free all unames. Is using the do_delete_plugin api call and the delete plugin mechanism

Returns:ERROR CODE
do_resume_plugin_by_id(plugin_id)[source]

Something like a callback function for gui triggered events. User wants to pause a plugin, so this method will send an event to core.

Parameters:plugin_id (int) – id of plugin to pause
do_resume_plugin_by_uname(plugin_uname)[source]

Something like a callback function for gui triggered events. User wants to resume a plugin, so this method will send an event to core.

Parameters:plugin_uname (basestring) – uname of plugin to resume
do_save_json_config_reloaded(path, plToSave=, []sToSave=[])[source]
do_save_xml_config(path)[source]

This function will save papis current state to a xml file provided by path.

Parameters:path (basestring) – path to save xml to.
Returns:
do_save_xml_config_reloaded(path, plToSave=, []sToSave=, []saveUserSettings=False)[source]
Parameters:
  • path
  • plToSave
  • sToSave
Returns:

do_set_parameter(plugin_id, parameter_name, value, only_db_update=False)[source]

Something like a callback function for gui triggered events. User wants to change a parameter of a plugin

Parameters:
  • plugin_id (int) – id of plugin which owns the parameter
  • parameter_name (basestring) – name of parameter to change
  • value – new parameter value to set
  • only_db_update – do_set_parameter of the target plugin will not be called. Updates only the internal database.
do_set_parameter_uname(plugin_uname, parameter_name, value)[source]

Something like a callback function for gui triggered events. User wants to change a parameter of a plugin :param plugin_uname: name of plugin which owns the parameter

Parameters:
  • parameter_name (basestring) – name of parameter to change
  • value – new parameter value to set
do_set_tab_active_by_name(tabName)[source]
do_start_plugin(id)[source]

Start plugin with given id.

Parameters:id (int) – Plugin id to start
Returns:
do_start_plugin_uname(uname)[source]

Start plugin with given uname.

Parameters:uname (basestring) – Plugin uname to start
Returns:
do_stopReset_plugin_uname(uname)[source]

Stop and reset plugin with given uname without deleting it.

Parameters:uname (basestring) – Plugin uname to stop
Returns:
do_stopReset_pluign(id)[source]

Stop and reset plugin with given id without deleting it.

Parameters:id (int) – Plugin id to stopReset
Returns:
do_subscribe(subscriber_id, source_id, block_name, signals=None, sub_alias=None)[source]

Something like a callback function for gui triggered events. In this case, user wants one plugin to subscribe another

Parameters:
  • subscriber_id (int) – Plugin id of plugin which should get the data
  • source_id (int) – plugin uname of plugin that should send the data
  • block_name (basestring) – name of block to subscribe
Returns:

do_subscribe_uname(subscriber_uname, source_uname, block_name, signals=None, sub_alias=None)[source]

Something like a callback function for gui triggered events. In this case, user wants one plugin to subscribe another

Parameters:
  • subscriber_uname (basestring) – Plugin uname of plugin which should get the data
  • source_uname (basestring) – plugin uname of plugin that should send the data
  • block_name (basestring) – name of block to subscribe
Returns:

do_test_name_to_be_unique(name)[source]

Will check if a given name would be a valid, unique name for a plugin. :param name: name to check

Returns:True or False
do_unsubscribe(subscriber_id, source_id, block_name, signal_index=None)[source]

Something like a callback function for gui triggered events. User wants one plugin to do not get any more data from another plugin

Parameters:
  • subscriber_id (int) – plugin id which wants to lose a data source
  • source_id (int) – plugin id of data source
  • block_name (basestring) – name of block to unsubscribe
Returns:

do_unsubscribe_uname(subscriber_uname, source_uname, block_name, signal_index=None)[source]

Something like a callback function for gui triggered events. User wants one plugin to do not get any more data from another plugin

Parameters:
  • subscriber_uname (basestring) – plugin uname which wants to lose a data source
  • source_uname (basestring) – plugin uname of data source
  • block_name (basestring) – name of block to unsubscribe
Returns:

error_occured
indent(elem, level=0)[source]

Function which will apply a nice looking indentiation to xml structure before save. Better readability. copied from http://effbot.org/zone/element-lib.htm#prettyprint 06.10.2014 15:53

Parameters:
  • elem
  • level
Returns:

papi.gui.gui_event_processing module

Contributors: <Stefan Ruppin

class papi.gui.gui_event_processing.GuiEventProcessing(gui_data, core_queue, gui_id, gui_queue, TabManager, plugin_manager)[source]

Bases: PyQt5.QtCore.QObject

This class will do all the event handling for a GUI process. It should be created and initialized with database and queues. To get all the functionality, one should link the callback functions (slots) for the needed signals.

added_dplugin
dgui_changed
gui_working(close_mock, workingTimer)[source]

Event processing loop of gui. Build to get called every 40ms after a run through. Will process all events of the queue at the time of call. Procedure was built this way, so that the processing of an event is not covered by the try/except structure.

plugin_died
process_check_alive_status(event)[source]

Gui received check_alive request form core, so gui will respond to it

Parameters:event (PapiEventBase) – event to process
process_close_program_event(event)[source]

Processes close programm event. Nothing important happens.

param event:event to process
type event:PapiEventBase
type dplugin:DPlugin
process_create_plugin(event)[source]

Processes the create Plugin event. This event got sent by core to GUI. Gui now needs to add a new plugin to DGUI and decide whether it is a plugin running in the GUI process or not.

Parameters:event (PapiEventBase) – event to process
process_new_data_event(event)[source]

Core sent a new data event to gui. Gui now needs to find the destination plugin and call its execute function with the new data.

Parameters:event (PapiEventBase) – event to process
process_parameter_info(event)[source]
Parameters:event
Returns:
process_pause_plugin(event)[source]

Core sent event to pause a plugin in GUI, so call the pause function of this plugin

Parameters:event (PapiEventBase) – event to process
process_plugin_closed(event)[source]

Processes plugin_closed event. Gui now knows, that a plugin was closed by core and needs to update its DGui data base

Parameters:event (PapiEventBase) –
Returns:
process_restart_plugin(event)[source]

Processes plugin_start event. Used to (re-)start a plugin after the plugin was stopped. Emit DPlugin was added -> necessary signal for the GUI.

Parameters:event
Returns:
process_resume_plugin(event)[source]

Core sent event to resume a plugin in GUI, so call the resume function of this plugin

Parameters:event (PapiEventBase) – event to process
process_set_parameter(event)[source]

Processes set_parameter event. Used to handle parameter sets by the gui or other plugins.

Parameters:event
Returns:
process_stop_plugin(event)[source]

Processes plugin_stop events. Quit plugin, emit DPlugin was removed -> necessary signal for the GUI.

Parameters:event
Returns:
process_update_meta(event)[source]

Core sent new meta information of an existing plugin. This function will update DGui with these information

Parameters:event (PapiEventBase) – event to process
process_update_parameter(event)[source]
removed_dplugin

papi.gui.gui_management module

Contributors: <Stefan Ruppin

class papi.gui.gui_management.GuiManagement(core_queue, gui_queue, gui_id, TabManager, get_gui_config, set_gui_config)[source]

Bases: builtins.object

papi.gui.plugin_api module

Contributors Stefan Ruppin

class papi.gui.plugin_api.Plugin_api(gui_data, core_queue, gui_id, PLUGIN_API_IDENTIFIER, tabManager=None)[source]

Bases: PyQt5.QtCore.QObject

change_uname_to_uniqe(name)[source]
do_change_string_to_be_uname(name)[source]
do_create_plugin(plugin_identifier, uname, config={}, autostart=True)[source]

Something like a callback function for gui triggered events e.a. when a user wants to create a new plugin.

Parameters:
  • plugin_identifier (basestring) – plugin to create
  • uname (basestring) – uniqe name to set for new plugin
  • config – additional configuration for creation
Returns:

do_delete_plugin_uname(uname)[source]

Delete plugin with given uname.

Parameters:uname (basestring) – Plugin uname to delete
Returns:
do_load_xml(path)[source]
do_pause_plugin_by_uname(plugin_uname)[source]

Something like a callback function for gui triggered events. User wants to pause a plugin, so this method will send an event to core.

Parameters:plugin_uname (basestring) – uname of plugin to pause
do_resume_plugin_by_uname(plugin_uname)[source]

Something like a callback function for gui triggered events. User wants to resume a plugin, so this method will send an event to core.

Parameters:plugin_uname (basestring) – uname of plugin to resume
do_set_parameter(plugin_id, parameter_name, value)[source]

Something like a callback function for gui triggered events. User wants to change a parameter of a plugin

Parameters:
  • plugin_id (int) – id of plugin which owns the parameter
  • parameter_name (basestring) – name of parameter to change
  • value – new parameter value to set
do_set_parameter_uname(plugin_uname, parameter_name, value)[source]

Something like a callback function for gui triggered events. User wants to change a parameter of a plugin

Parameters:
  • plugin_uname (basestring) – name of plugin which owns the parameter
  • parameter_name (basestring) – name of parameter to change
  • value – new parameter value to set
do_set_tab_active_by_name(tabName)[source]
do_subscribe_uname(subscriber_uname, source_uname, block_name, signals=None, sub_alias=None)[source]

Something like a callback function for gui triggered events. In this case, user wants one plugin to subscribe another

Parameters:
  • subscriber_uname (basestring) – Plugin uname of plugin which should get the data
  • source_uname (basestring) – plugin uname of plugin that should send the data
  • block_name (basestring) – name of block to subscribe
Returns:

do_test_name_to_be_unique(name)[source]
do_update_parameter(plugin_id, parameter_name, value)[source]

Something like a callback function for gui triggered events. User wants to update a parameter in the gui. Used by a owner of a plugin to inform the gui that a parameter was internally changed.

Parameters:
  • plugin_id (int) – id of plugin which owns the parameter
  • parameter_name (basestring) – name of parameter to change
  • value – new parameter value to set
get_all_plugins()[source]
get_dparameter_of_plugin_from_data(plugin_uname)[source]
get_dplugin_by_uname(name)[source]

Module contents

Contributors Sven Knuth