Plugin Classes

The plugin base classes that the user should subclass from when creating plugins.

class rkviewer.plugin.classes.CommandPlugin[source]

Base class for simple plugins that is essentially one single command.

One may think of a CommandPlugin as (obviously) a command, or a sort of macro in the simpler cases. The user may invoke the command defined when they click on the associated menu item under the “Plugins” menu, or they may be able to use a keybaord shortcut, once that is implemented. To subclass CommandPlugin one needs to override run().

metadata

metadata information of plugin.

Type

PluginMetadata

abstract run()[source]

Called when the user invokes this command manually.

This should implement whatever action/macro that this Plugin claims to execute.

class rkviewer.plugin.classes.Plugin(ptype)[source]

The base class for a Plugin.

The user should not directly instantiate this but rather one of its subclasses, e.g. CommandPlugin.

Parameters

ptype (PluginType) –

get_settings_schema()[source]

Return the setting schema for this plugin.

TODO document

on_did_add_compartment(evt)[source]

Called after a compartment is added.

Parameters

evt (DidAddCompartmentEvent) –

on_did_add_node(evt)[source]

Called after a node is added.

Parameters

evt (DidAddNodeEvent) –

on_did_add_reaction(evt)[source]

Called after a reaction is added.

Parameters

evt (DidAddReactionEvent) –

on_did_change_compartment_of_nodes(evt)[source]

Called after the compartment that some nodes are in has changed.

Parameters

evt (DidChangeCompartmentOfNodesEvent) –

on_did_commit_drag(evt)[source]

Called after a dragging operation has been committed to the model.

Parameters

evt (DidCommitDragEvent) –

on_did_delete(evt)[source]

Called after items (nodes, reactions, and/or compartments) are deleted.

Parameters

evt (DidDeleteEvent) –

on_did_modify_compartments(evt)[source]

Called after properties of compartments (other than position/size) have been modified

Parameters

evt (DidModifyCompartmentsEvent) –

on_did_modify_nodes(evt)[source]

Called after properties of nodes (other than position/size) have been modified

Parameters

evt (DidModifyNodesEvent) –

on_did_modify_reactions(evt)[source]

Called after properties of reactions have been modified.

Parameters

evt (DidModifyReactionEvent) –

on_did_move_bezier_handle(evt)[source]

Called as the Bezier handles are being moved.

Note

See on_did_move_nodes() for cautious notes on usage.

Parameters

evt (DidMoveBezierHandleEvent) –

on_did_move_compartments(evt)[source]

Called as compartments are moved.

Note

See on_did_move_nodes() for cautious notes on usage.

Parameters

evt (DidMoveCompartmentsEvent) –

on_did_move_nodes(evt)[source]

Called as nodes are moved.

Note

This is called many times, continuously as the ndoes are being moved. Therefore, you should not call any API functions that would modify the state of the model (including api.group_action()), as otherwise you would have registered hundreds of actions in the undo/redo stack.

Parameters

evt (DidMoveNodesEvent) –

on_did_paint_canvas(evt)[source]

Called each time the canvas is painted.

Parameters

evt (DidPaintCanvasEvent) –

on_did_redo(evt)[source]

Called after an redo operation is performed.

Parameters

evt (DidRedoEvent) –

on_did_resize_compartments(evt)[source]

Called after compartments are resized.

Parameters

evt (DidResizeCompartmentsEvent) –

on_did_resize_nodes(evt)[source]

Called after nodes are resized.

Parameters

evt (DidResizeNodesEvent) –

on_did_undo(evt)[source]

Called after an undo operation is performed.

Parameters

evt (DidUndoEvent) –

on_selection_did_change(evt)[source]

Called after the set of selected items have changed.

Parameters

evt (SelectionDidUpdateEvent) –

class rkviewer.plugin.classes.PluginCategory(value)[source]

The category of a plugin. Determines in which tab the plugin is placed on the toolbar.

class rkviewer.plugin.classes.PluginMetadata(name, author, version, short_desc, long_desc, category, short_name=None, icon=None)[source]

Metadata for the plugin.

name

The full name of the plugin.

Type

str

author

The author of the plugin.

Type

str

version

The version string of the plugin.

Type

str

short_desc

A short description of the plugin. This is displayed as a tooltip, introduction, etc.

Type

str

long_desc

A long, detailed description of the plugin. This is shown in the plugin details page, as a comprehensive description of what this plugin does. This string will be rendered as HTML.

Type

str

category

The category of the plugin.

Type

rkviewer.plugin.classes.PluginCategory

short_name

If specified, the abbreviated name for situations where the width is small (e.g. the toolbar).

Type

Optional[str]

icon

The bitmap for the plugin’s icon. Leave as None for a generic default icon.

Type

Optional[wx.Bitmap]

Parameters
  • name (str) –

  • author (str) –

  • version (str) –

  • short_desc (str) –

  • long_desc (str) –

  • category (PluginCategory) –

  • short_name (Optional[str]) –

  • icon (Optional[Bitmap]) –

class rkviewer.plugin.classes.PluginType(value)[source]

Enumeration of plugin types, dictating how a plugin would appear in the application.

NULL: Null enumeration. There should not be a plugin instance with this type. COMMAND: A command plugin. See CommandPlugin for more details. WINDOWED: A windowed plugin. See WindowedPlugin for more details.

class rkviewer.plugin.classes.WindowedPlugin[source]

Base class for plugins with an associated popup window.

When the user clicks the menu item of this plugin under the “Plugins” menu, a popup dialog is created, which may display data, and which the user may interact with. This type of plugin is suitable to more complex or visually-based plugins, such as that utilizing a chart or an interactive form.

To implement a subclass of WindowedPlugin, one needs to override the method create_window.

dialog

The popup dialog window that this plugin is in.

Type

Optional[wx.Dialog]

metadata

metadata information of plugin.

Type

rkviewer.plugin.classes.PluginMetadata

abstract create_window(dialog)[source]

Called when the user requests a dialog window from the plugin.

For one overriding this method, they should either create or reuse a wx.Window instance to display in a dialog. One likely wants to bind events to the controls inside the returned wx.Window to capture user input.

Parameters

dialog (Window) –

Return type

Window

on_did_create_dialog()[source]

Called after the parent dialog has been created and initialized.

Here you may change the position, style, etc. of the dialog by accessing the self.dialog member.

on_did_focus()[source]

TODO not implemented

on_did_unfocus()[source]

TODO not implemented

on_will_close_window(evt)[source]

TODO not implemented