rkviewer package

Submodules

rkviewer.config module

Configuration parameters.

class rkviewer.config.AppSettings[source]

Bases: object

load_appSettings()[source]
save_appSettings()[source]
class rkviewer.config.Color(r, g, b, a=255)[source]

Bases: object

Parameters
  • r (int) –

  • g (int) –

  • b (int) –

  • a (int) –

a: int = 255
b: int
classmethod from_rgb(val)[source]

Create color from RGB hex value: #00BBGGRR

Parameters

val (int) –

Return type

Color

g: int
r: int
swapped(r=None, g=None, b=None, a=None)[source]
Parameters
  • r (Optional[int]) –

  • g (Optional[int]) –

  • b (Optional[int]) –

  • a (Optional[int]) –

Return type

Color

to_wxcolour()[source]
class rkviewer.config.ColorField(**kw)[source]

Bases: marshmallow.fields.Field

Field that represents an RGBA color.

To represent the color red, you would write: >>> { “some_color”: [255, 0, 0] }

You may also specify its opacity. To make the color red half transparent: >>> { “some”: [255, 0, 0, 127] }

In short, you may specify four integer arguments RGBA in an array, which the alpha value being optional and defaulting to 255, or fully opaque. Each value must be in range [0, 255].

list_field = <fields.List(default=<marshmallow.missing>, attribute=None, validate=<Length(min=3, max=4, equal=None, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
range_validate = <Range(min=0, max=255, min_inclusive=True, max_inclusive=True, error='RGBA values must be between 0 and 255.')>
class rkviewer.config.Dim(**kwargs)[source]

Bases: marshmallow.fields.Float

Field that represents some real dimension (length).

class rkviewer.config.Dim2(*args, **kw)[source]

Bases: marshmallow.fields.List

class rkviewer.config.Font(pointSize, color)[source]

Bases: object

Parameters
  • pointSize (int) –

  • color (Color) –

color: rkviewer.config.Color
pointSize: int
class rkviewer.config.FontField(*args, **kw)[source]

Bases: marshmallow.fields.Field

rkviewer.config.GetConfigDir()[source]
rkviewer.config.GetThemeSettingsPath()[source]
class rkviewer.config.Pixel(**kwargs)[source]

Bases: marshmallow.fields.Integer

Field that represents some length in pixels.

The only current restriction is that this must be a nonnegative integer, or >>> { “some_width”: 23 }

class rkviewer.config.RootSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

The overall root schema.

theme

The theme settings (i.e. colors and dimensions) of the application.

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
theme = <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing={'node_border_width': 2, 'mode_panel_width': 100, 'zoom_slider_bg': Color(r=180, g=180, b=180, a=255), 'toolbar_bg': Color(r=230, g=230, b=230, a=255), 'text_field_fg': Color(r=0, g=0, b=0, a=255), 'handle_color': Color(r=0, g=140, b=255, a=255), 'select_box_padding': 5, 'toolbar_height': 75, 'node_fill': Color(r=255, g=204, b=153, a=200), 'selected_reaction_fill': Color(r=0, g=140, b=255, a=255), 'node_font_size': 10, 'comp_corner_radius': 6, 'drag_border': Color(r=0, g=140, b=255, a=255), 'reaction_radius': 6, 'toolbar_fg': Color(r=0, g=0, b=0, a=255), 'node_border': Color(r=255, g=108, b=9, a=255), 'vgap': 2, 'react_node_border_width': 3, 'btn_border': True, 'comp_border_width': 2, 'text_field_border': True, 'canvas_outside_bg': Color(r=160, g=160, b=160, a=255), 'canvas_width': 1000, 'reactant_border': Color(r=255, g=100, b=100, a=255), 'canvas_bg': Color(r=255, g=255, b=255, a=255), 'edit_panel_width': 260, 'react_node_padding': 5, 'text_field_bg': Color(r=255, g=255, b=255, a=255), 'canvas_height': 620, 'btn_bg': Color(r=240, g=240, b=240, a=255), 'product_border': Color(r=0, g=214, b=125, a=255), 'btn_hover_fg': Color(r=0, g=0, b=0, a=255), 'modifier_line_color': Color(r=202, g=148, b=255, a=255), 'drag_fill': Color(r=0, g=140, b=255, a=20), 'overall_bg': Color(r=240, g=240, b=240, a=255), 'reaction_fill': Color(r=91, g=176, b=253, a=255), 'select_handle_length': 8, 'btn_fg': Color(r=0, g=0, b=0, a=255), 'reaction_line_thickness': 2, 'select_outline_width': 2, 'btn_hover_bg': Color(r=240, g=240, b=240, a=255), 'highlighted_handle_color': Color(r=128, g=198, b=255, a=255), 'node_height': 30, 'drag_border_width': 1, 'comp_fill': Color(r=158, g=169, b=255, a=200), 'modifier_line_width': 2, 'select_outline_padding': 3, 'hgap': 2, 'comp_border': Color(r=0, g=29, b=255, a=255), 'node_width': 50, 'node_font_color': Color(r=255, g=0, b=0, a=100), 'active_tab_fg': Color(r=0, g=0, b=0, a=255)}, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>
class rkviewer.config.RuntimeVariables(enable_plugins=True)[source]

Bases: object

Variables pertaining to the application runtime

Parameters

enable_plugins (bool) –

enable_plugins: bool = True
class rkviewer.config.ThemeSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Schema for the overall theme, i.e. appearance, of the application.

overall_bg

Overall background color of the application.

canvas_bg

Background color of the canvas.

toolbar_bg

Background color of the toolbar.

btn_bg

Background color of a button

btn_fg

Foreground color of a button, ie the color used by the button text

btn_hover_bg

BG color of a button when the mouse is hovering over it. By default this should be equal to the normal BG since MSW already provides a faint blue hovering effect. But in the case that btn_border is False, the native hovering effects vanish, so this is needed as a replacement visual indicator.

btn_hover_fg

FG color of a button when the mouse is hovering over it. See btn_hover_bg.

btn_border

True for border, false for no border

canvas_width

Starting (and minimum) width of the canvas.

canvas_height

Starting (and minimum) height of the canvas.

vgap

Vertical gap between toolbars and canvas.

hgap

Horizontal gap between toolbars and canvas.

canvas_outside_bg

Background color of the part outside of the bounds of canvas.

mode_panel_width

Width of the mode selection panel.

node_fill

Default node fill color.

node_border

Default node border color.

node_width

Default node width.

node_height

Default node height.

node_border_width

Default node border width.

node_font_size

Default font size of the node.

node_font_color

Default font color of the node.

select_outline_width

Width of the selection outlines (i.e. outline around each selected item).

select_outline_padding

Padding of the selection outlines.

handle_color

ColorField of the Reaction Bezier curves.

highlighted_handle_color

ColorField of the Reaction Bezier curves when the cursor hovers over it

select_box_padding

Padding of the selection rectangle (i.e. the large rectangle that encompasses all the selected items).

select_handle_length

Side length of the squares one uses to resize nodes/compartments.

zoom_slider_bg

Background color of the zoom slider.

drag_fill

The fill color of the drag selection rectangle.

drag_border

The border color of the drag selection rectangle.

drag_border_width

The border width of the drag selection rectangle.

react_node_padding

The outline padding for nodes prepped as reactants or products.

react_node_border_width

The border width for nodes prepped as reactants or products.

reactant_border

The outline color for nodes prepped as reactants.

product_border

The outline color for nodes prepped as products.

reaction_fill

The default fill color of reaction curves.

reaction_line_thickness

The default thickness of reaction curves.

selected_reaction_fill

The fill color of selected reaction curves.

comp_fill

The default fill color of compartments.

comp_border

The default border color of compartments.

comp_border_width

The default border width of compartments.

reaction_radius

The radius of the reaction centroid circles.

active_tab_fg

The foreground (font) color of the active tab in a FlatNotebook. There is no option to set the BG color since the BG color is always a brighter version of the toolbar BG.

text_field_bg

The background color of text fields.

text_field_fg

The foreground (font) color of text fields

text_field_border

Whether the border of text fields should be drawn.

TODO more documentation under attributes and link to this document in Help or settings.json

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

active_tab_fg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=0, b=0, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
btn_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=240, g=240, b=240, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
btn_border = <fields.Boolean(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=True, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid boolean.'})>
btn_fg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=0, b=0, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
btn_hover_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=240, g=240, b=240, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
btn_hover_fg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=0, b=0, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
canvas_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=255, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
canvas_height = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=620, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
canvas_outside_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=160, g=160, b=160, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
canvas_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=1000, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
comp_border = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=29, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
comp_border_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
comp_corner_radius = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=6, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
comp_fill = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=158, g=169, b=255, a=200), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
drag_border = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=140, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
drag_border_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=1, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
drag_fill = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=140, b=255, a=20), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
edit_panel_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=260, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
handle_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=140, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
hgap = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
highlighted_handle_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=128, g=198, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
mode_panel_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=100, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
modifier_line_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=202, g=148, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
modifier_line_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
node_border = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=108, b=9, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
node_border_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
node_fill = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=204, b=153, a=200), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
node_font_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=0, b=0, a=100), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
node_font_size = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=10, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
node_height = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=30, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
node_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=50, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
opts = <marshmallow.schema.SchemaOpts object>
overall_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=240, g=240, b=240, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
product_border = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=214, b=125, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
react_node_border_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=3, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
react_node_padding = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=5, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
reactant_border = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=100, b=100, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
reaction_fill = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=91, g=176, b=253, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
reaction_line_thickness = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
reaction_radius = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=6, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
select_box_padding = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=5, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
select_handle_length = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=8, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
select_outline_padding = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=3, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
select_outline_width = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
selected_reaction_fill = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=140, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
text_field_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=255, g=255, b=255, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
text_field_border = <fields.Boolean(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=True, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid boolean.'})>
text_field_fg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=0, b=0, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
toolbar_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=230, g=230, b=230, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
toolbar_fg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=0, g=0, b=0, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
toolbar_height = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=75, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
vgap = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=2, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
zoom_slider_bg = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=Color(r=180, g=180, b=180, a=255), allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
rkviewer.config.add_plugin_schema(name, schema)[source]
Parameters
  • name (str) –

  • schema (Schema) –

rkviewer.config.get_default_raw_settings()[source]
rkviewer.config.get_setting(setting_attr)[source]
Return type

Any

rkviewer.config.get_theme(theme_attr, convert_color=True)[source]

convert_color: if True, convert Color instances to wx.Colour instances automatically

Return type

Any

rkviewer.config.load_theme_settings()[source]

Reload all settings from the default settings path.

The exceptions are not immediately thrown since the first time the settings are loaded, the app has not been initialized. So we wait until it is, and then display an error dialog if there is a previously recorded error.

rkviewer.config.pop_settings_err()[source]

If there was error when loading the settings JSON, this would be not None. Used by canvas to display a warning message after the window is created.

The error is cleared when this is called.

rkviewer.config.reset_runtime_vars()[source]
rkviewer.config.runtime_vars()[source]
Return type

RuntimeVariables

rkviewer.config.validate_schema(schema)[source]

rkviewer.controller module

Implementation of a controller.

class rkviewer.controller.Controller(view)[source]

Bases: rkviewer.mvc.IController

A controller class.

This is not strictly adhering to the MVC architecture, since there is not a separate Model interface. Rather, this controller directly interacts with iodine. The model class should be implemented if necessary.

Parameters

view (IView) –

add_alias_node(*args)[source]
add_compartment_g(neti, compartment)[source]

Try to add the given Compartment to the canvas. Return index of added comp.

Parameters
Return type

int

add_node_g(neti, node)[source]

Add node represented by the given Node variable.

The ‘g’ suffix indicates that this operation creates its own group

Parameters
  • neti (int) –

  • node (Node) –

Return type

int

add_reaction_g(neti, reaction)[source]

Try create a reaction.

Parameters
  • neti (int) –

  • reaction (Reaction) –

Return type

int

alias_for_reaction(*args)[source]

See Iodine aliasForReaction for documentation

clear_network(*args)[source]
delete_compartment(*args)[source]
delete_node(*args)[source]
delete_reaction(*args)[source]
dump_network(neti)[source]
Parameters

neti (int) –

get_application_position()[source]
Return type

Point

get_center_handle(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Vec2

get_compartment_by_index(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Compartment

get_compartment_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

get_compartment_of_node(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

get_composite_shape_at(neti, shapei)[source]
Parameters
  • neti (int) –

  • shapei (int) –

Return type

CompositeShape

get_composite_shape_list(neti)[source]
Parameters

neti (int) –

Return type

List[CompositeShape]

get_dest_node_handle(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

Vec2

get_dest_node_stoich(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

get_list_of_compartments(neti)[source]
Parameters

neti (int) –

Return type

List[Compartment]

get_list_of_dest_indices(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

get_list_of_node_ids(neti)[source]

Try getting the list of node IDs

Parameters

neti (int) –

Return type

List[str]

get_list_of_nodes(neti)[source]
Parameters

neti (int) –

Return type

List[Node]

get_list_of_reactions(neti)[source]
Parameters

neti (int) –

Return type

List[Reaction]

get_list_of_src_indices(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

get_modifier_tip_style(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

ModifierTipStyle

get_node_by_index(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Node

get_node_id(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

str

get_node_index(neti, node_id)[source]
Parameters
  • neti (int) –

  • node_id (str) –

Return type

int

get_node_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

get_node_shape(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

CompositeShape

get_node_shape_index(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

get_nodes_in_compartment(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

List[int]

get_reaction_by_index(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Reaction

get_reaction_index(neti, rxn_id)[source]
Parameters
  • neti (int) –

  • rxn_id (str) –

Return type

int

get_reaction_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

get_reaction_modifiers(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Set[int]

get_reactions_as_product(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

get_reactions_as_reactant(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

get_src_node_handle(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

Vec2

get_src_node_stoich(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

group_action()[source]
in_group()[source]
Return type

bool

load_network(json_obj)[source]
Parameters

json_obj (Any) –

Return type

int

move_compartment(*args)[source]
move_node(*args)[source]

Try to move the give node. TODO only accept node ID and new location

new_network()[source]

Create a new network.

Since there is only one tab for now, this merely clears the the current network. Also, does not clear undo stack.

redo()[source]

Try to redo last undone operation

Return type

bool

rename_compartment(*args)[source]
rename_node(*args)[source]
rename_reaction(*args)[source]
set_application_position(pos)[source]
Parameters

pos (Point) –

set_center_handle(*args)[source]
set_compartment_border(*args)[source]
set_compartment_border_width(*args)[source]
set_compartment_fill(*args)[source]
set_compartment_of_node(*args)[source]
set_compartment_size(*args)[source]
set_compartment_volume(*args)[source]
set_dest_node_handle(*args)[source]
set_dest_node_stoich(*args)[source]
set_modifier_tip_style(*args)[source]
set_node_border_alpha(*args)[source]
set_node_border_rgb(*args)[source]
set_node_border_width(*args)[source]
set_node_fill_alpha(*args)[source]
set_node_fill_rgb(*args)[source]
set_node_floating_status(*args)[source]
set_node_locked_status(*args)[source]
set_node_primitive_property(*args)[source]
set_node_shape_index(*args)[source]
set_node_size(*args)[source]

Try to move the give node. TODO only accept node ID and new location

set_reaction_bezier_curves(*args)[source]
set_reaction_center(*args)[source]
set_reaction_fill_alpha(*args)[source]
set_reaction_fill_rgb(*args)[source]
set_reaction_line_thickness(*args)[source]
set_reaction_modifiers(*args)[source]
set_reaction_ratelaw(*args)[source]
set_src_node_handle(*args)[source]
set_src_node_stoich(*args)[source]
tcolor_to_wx(color)[source]
Parameters

color (Color) –

Return type

Colour

undo()[source]

Try to undo last operation

Return type

bool

update_view()[source]

Immediately update the view with using latest model.

view: rkviewer.mvc.IView
wx_to_tcolor(color)[source]
Parameters

color (Colour) –

Return type

Color

rkviewer.controller.iod_setter(controller_iod_setter)[source]

Decorator for controller iod_setter methods that catches Errors and auto updates views.

rkviewer.events module

Custom events dispatched by the canvas.

These events may later be used within a plugin system, where plugins are allowed to bind their own handlers to these events.

class rkviewer.events.CanvasDidUpdateEvent[source]

Bases: rkviewer.events.CanvasEvent

Called after the canvas has been updated by the controller.

class rkviewer.events.CanvasEvent[source]

Bases: object

to_tuple()[source]
class rkviewer.events.DidAddCompartmentEvent(index)[source]

Bases: rkviewer.events.CanvasEvent

Called after a compartment has been added.

compartment

The Compartment that was added.

Parameters

index (int) –

index: int
class rkviewer.events.DidAddNodeEvent(node)[source]

Bases: rkviewer.events.CanvasEvent

Called after a node has been added.

node

The index of the node that was added.

Type

int

Note

This event triggers only if the user has performed a drag operation, and not, for example, if the user moved a node in the edit panel.

TODO in the documentation that this event and related ones (and DidDelete-) are emitted before controller.end_group() is called. As an alternative, maybe create a call_after() function similar to wxPython? it should be called in OnIdle() or Refresh()

Parameters

node (int) –

node: int
class rkviewer.events.DidAddReactionEvent(index)[source]

Bases: rkviewer.events.CanvasEvent

Called after a reaction has been added.

reaction

The Reaction that was added.

Parameters

index (int) –

index: int
class rkviewer.events.DidChangeCompartmentOfNodesEvent(node_indices, old_compi, new_compi, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after one or more nodes have been moved to a new compartment.

node_indices

The list of node indices that changed compartment.

Type

List[int]

old_compi

The old compartment index, -1 for base compartment.

Type

int

new_compi

The new compartment index, -1 for base compartment.

Type

int

by_user

Whether this event was triggered directly by a user action, as opposed to by a plugin.

Type

bool

Parameters
  • node_indices (List[int]) –

  • old_compi (int) –

  • new_compi (int) –

  • by_user (bool) –

by_user: bool = True
new_compi: int
node_indices: List[int]
old_compi: int
class rkviewer.events.DidCommitDragEvent(source)[source]

Bases: rkviewer.events.CanvasEvent

Dispatched after any continuously emitted dragging event has concluded.

This is dispatched for any event that is posted in quick intervals while the mouse left button is held while moving, i.e. “dragging” events. This includes: DidMoveNodesEvent, DidMoveCompartmentsEvent, DidResizeNodesEvent, DidResizeCompartmentsEvent, and DidResizeMoveBezierHandlesEvent. This event is emitted after the left mouse button is released, the model is notified of the change, and the action is complete.

Parameters

source (Any) –

source: Any
class rkviewer.events.DidDeleteEvent(node_indices, reaction_indices, compartment_indices)[source]

Bases: rkviewer.events.CanvasEvent

Called after a node has been deleted.

node_indices

The set of nodes (indices )that were deleted.

Type

Set[int]

reaction_indices

The set of reactions (indices) that were deleted.

Type

Set[int]

compartment_indices

The set of compartment (indices) that were deleted.

Type

Set[int]

Parameters
  • node_indices (Set[int]) –

  • reaction_indices (Set[int]) –

  • compartment_indices (Set[int]) –

compartment_indices: Set[int]
node_indices: Set[int]
reaction_indices: Set[int]
class rkviewer.events.DidModifyCompartmentsEvent(indices)[source]

Bases: rkviewer.events.CanvasEvent

Called after a property of one or more compartments has been modified, excluding position or size.

For position and size events, see DidMove…Event() and DidResize…Event()

indices

The indices of list of compartments that were modified.

Type

List[int]

Parameters

indices (List[int]) –

indices: List[int]
class rkviewer.events.DidModifyNodesEvent(indices, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after a property of one or more nodes has been modified, excluding position or size.

For position and size events, see DidMove…Event() and DidResize…Event()

nodes

The indices of the list of nodes that were modified.

by_user

Whether this event was triggered directly by a user action and not, for example, by a plugin.

Type

bool

Parameters
  • indices (List[int]) –

  • by_user (bool) –

by_user: bool = True
indices: List[int]
class rkviewer.events.DidModifyReactionEvent(indices, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after a property of one or more nodes has been modified, excluding position.

indices

The indices of the list of reactions that were modified.

Type

List[int]

by_user

Whether this event was triggered directly by a user action and not, for example, by a plugin.

Type

bool

Parameters
  • indices (List[int]) –

  • by_user (bool) –

by_user: bool = True
indices: List[int]
class rkviewer.events.DidMoveBezierHandleEvent(net_index, reaction_index, node_index, by_user, direct)[source]

Bases: rkviewer.events.CanvasEvent

Dispatched after a Bezier handle is moved.

net_index

The network index.

Type

int

reaction_index

The reaction index.

Type

int

node_index

The index of the node whose Bezier handle moved. -1 if the source centroid handle was moved, or -2 if the dest centroid handle was moved.

Type

int

direct

Automatically true when by_user is False. Otherwise, True if the handle is moved by the user dragging the handle directly, and False if the handle was moved by the user dragging the node associated with that handle.

Type

bool

by_user

Whether the event was performed by the user or through a plugin.

Type

bool

Parameters
  • net_index (int) –

  • reaction_index (int) –

  • node_index (int) –

  • by_user (bool) –

  • direct (bool) –

by_user: bool
direct: bool
net_index: int
node_index: int
reaction_index: int
class rkviewer.events.DidMoveCompartmentsEvent(compartment_indices, offset, dragged, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Same as DidMoveNodesEvent but for compartments.

compartment_indices

The indices of the compartments that were moved.

Type

List[int]

offset

The position offset. If all compartments were moved by the same offset, then a single Vec2 is given; otherwise, a list of offsets are given, with each offset matching a node.

Type

Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]

dragged

Whether the resize operation was done by the user dragging, and not, for example, through the form.

Type

bool

by_user

Whether the event was performed by the user or through a plugin.

Type

bool

Parameters
  • compartment_indices (List[int]) –

  • offset (Union[Vec2, List[Vec2]]) –

  • dragged (bool) –

  • by_user (bool) –

by_user: bool = True
compartment_indices: List[int]
dragged: bool
offset: Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]
class rkviewer.events.DidMoveNodesEvent(node_indices, offset, dragged, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after the position of a node changes but has not been committed to the model.

This event may be called many times, continuously as the user drags a group of nodes. Note that only after the drag operation has ended, is model notified of the move for undo purposes. See DidCommitDragEvent.

node_indices

The indices of the nodes that were moved.

Type

List[int]

offset

The position offset. If all nodes were moved by the same offset, then a single Vec2 is given; otherwise, a list of offsets are given, with each offset matching a node.

Type

Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]

dragged

Whether the resize operation was done by the user dragging, and not, for exmaple, through the form.

Type

bool

by_user

Whether the event was performed by the user or through a plugin.

Type

bool

Parameters
  • node_indices (List[int]) –

  • offset (Union[Vec2, List[Vec2]]) –

  • dragged (bool) –

  • by_user (bool) –

by_user: bool = True
dragged: bool
node_indices: List[int]
offset: Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]
class rkviewer.events.DidMoveReactionCenterEvent(net_index, reaction_index, offset, dragged)[source]

Bases: rkviewer.events.CanvasEvent

Dispatched after the reaction center is moved by the user.

Note that this is not triggered if the center moved automatically due to nodes moving.

net_index

The network index.

Type

int

reaction_index

The reaction index.

Type

int

offset

The amount moved.

Type

rkviewer.canvas.geometry.Vec2

dragged

Whether the center is moved by the user dragging (it could have been through the form).

Type

bool

Parameters
  • net_index (int) –

  • reaction_index (int) –

  • offset (Vec2) –

  • dragged (bool) –

dragged: bool
net_index: int
offset: rkviewer.canvas.geometry.Vec2
reaction_index: int
class rkviewer.events.DidPaintCanvasEvent(gc)[source]

Bases: rkviewer.events.CanvasEvent

Called after the canvas has been painted.

gc

The graphics context of the canvas.

Type

wx.GraphicsContext

Parameters

gc (GraphicsContext) –

gc: wx.GraphicsContext
class rkviewer.events.DidRedoEvent(by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after a redo action is done.

Parameters

by_user (bool) –

by_user: bool = True
class rkviewer.events.DidResizeCompartmentsEvent(compartment_indices, ratio, dragged, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after the list of selected compartments has been resized.

compartment_indices

The indices of the list of resized compartments.

Type

List[int]

ratio

The resize ratio.

Type

Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]

dragged

Whether the resize operation was done by the user dragging, and not, for exmaple, through the form.

Type

bool

by_user

Whether the event was performed by the user or through a plugin.

Type

bool

Parameters
  • compartment_indices (List[int]) –

  • ratio (Union[Vec2, List[Vec2]]) –

  • dragged (bool) –

  • by_user (bool) –

by_user: bool = True
compartment_indices: List[int]
dragged: bool
ratio: Union[rkviewer.canvas.geometry.Vec2, List[rkviewer.canvas.geometry.Vec2]]
class rkviewer.events.DidResizeNodesEvent(node_indices, ratio, dragged, by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after the list of selected nodes has been resized.

node_indices

The indices of the list of resized nodes.

Type

List[int]

ratio

The resize ratio.

Type

rkviewer.canvas.geometry.Vec2

dragged

Whether the resize operation was done by the user dragging, and not, for exmaple, through the form.

Type

bool

by_user

Whether the event was performed by the user or through a plugin.

Type

bool

Parameters
  • node_indices (List[int]) –

  • ratio (Vec2) –

  • dragged (bool) –

  • by_user (bool) –

by_user: bool = True
dragged: bool
node_indices: List[int]
ratio: rkviewer.canvas.geometry.Vec2
class rkviewer.events.DidUndoEvent(by_user=True)[source]

Bases: rkviewer.events.CanvasEvent

Called after an undo action is done.

Parameters

by_user (bool) –

by_user: bool = True
class rkviewer.events.HandlerChain[source]

Bases: object

append(handler)[source]
Parameters

handler (Callable[[CanvasEvent], None]) –

Return type

HandlerNode

head: Optional[rkviewer.events.HandlerNode]
remove(node)[source]
Parameters

node (HandlerNode) –

tail: Optional[rkviewer.events.HandlerNode]
class rkviewer.events.HandlerNode(handler)[source]

Bases: object

Parameters

handler (Callable[[CanvasEvent], None]) –

handler: Callable[[rkviewer.events.CanvasEvent], None]
next_: Optional[rkviewer.events.HandlerNode]
prev: Optional[rkviewer.events.HandlerNode]
class rkviewer.events.SelectionDidUpdateEvent(node_indices, reaction_indices, compartment_indices)[source]

Bases: rkviewer.events.CanvasEvent

Called after the list of selected nodes and/or reactions has changed.

node_indices

The indices of the list of selected nodes.

Type

Set[int]

reaction_indices

The indices of the list of selected reactions.

Type

Set[int]

compartment_indices

The indices of the list of selected compartments.

Type

Set[int]

Parameters
  • node_indices (Set[int]) –

  • reaction_indices (Set[int]) –

  • compartment_indices (Set[int]) –

compartment_indices: Set[int]
node_indices: Set[int]
reaction_indices: Set[int]
rkviewer.events.bind_handler(evt_cls, callback)[source]
Parameters
Return type

int

rkviewer.events.post_event(evt)[source]
Parameters

evt (CanvasEvent) –

rkviewer.events.unbind_handler(handler_id)[source]
Parameters

handler_id (int) –

rkviewer.forms module

All sorts of form widgets, mainly those used in EditPanel.

rkviewer.forms.AlphaToText(alpha, prec)[source]

Simple helper for converting an alpha value ~[0, 255] to the range [0, 1].

Parameters
  • alpha (Optional[int]) – The alpha value in range 0-255. If None, “?” will be returned.

  • precision – The precision of the float string returned.

  • prec (int) –

Return type

str

rkviewer.forms.ChangePairValue(ctrl, new_val, prec)[source]

Helper for updating the value of a paired number TextCtrl.

The TextCtrl accepts text in the format “X, Y” where X and Y are floats. The control is not updated if the new and old values are identical (considering precision).

Parameters
  • ctrl (TextCtrl) – The TextCtrl widget.

  • new_val (Vec2) – The new pair of floats to update the control with.

  • prec (int) – The precision of the numbers. The new value is rounded to this precision.

class rkviewer.forms.CompartmentForm(parent, canvas, controller)[source]

Bases: wx.lib.scrolledpanel.

Parameters
CompsMovedOrResized(evt)[source]

Called when nodes are moved or resized by dragging

CreateControls()[source]
UpdateAllFields()[source]
UpdateCompartments(comps)[source]
Parameters

comps (List[Compartment]) –

UpdateSelection(selected_idx, nodes_selected)[source]
Parameters
  • selected_idx (List[int]) –

  • nodes_selected (bool) –

class rkviewer.forms.EditPanelForm(parent, canvas, controller)[source]

Bases: wx.lib.scrolledpanel.

Base class for a form to be displayed on the edit panel.

ColorCallback

Callback type for when a color input is changed.

FloatCallback

Callback type for when a float input is changed.

canvas

The associated canvas.

controller

The associated controller.

net_index

The current network index. For now it is 0 since there is only one tab.

Parameters
CreateChildren()[source]
abstract CreateControls()[source]
ExternalUpdate()[source]
OnChildFocus(evt)[source]
abstract UpdateAllFields()[source]
property selected_idx
self_changes

flag for if edits were made but the controller hasn’t updated the view yet

class rkviewer.forms.FieldGrid(parent, form)[source]

Bases: wx.

Parameters

form (EditPanelForm) –

AppendControl(label_str, ctrl)[source]

Append a control, its label, and its info badge to the last row of the sizer.

Returns the automaticaly created label and info badge (wx.StaticText for now).

Parameters
  • label_str (str) –

  • ctrl (Control) –

AppendLine()[source]

Append a horizontal spacer with the given height.

Note

The VGAP value still applies, i.e. there is an additional gap between the spacer and the next row.

AppendSpacer(height, sizer=None)[source]

Append a horizontal spacer with the given height.

Note

The VGAP value still applies, i.e. there is an additional gap between the spacer and the next row.

Parameters

height (int) –

AppendSubtitle(text, add_spacers=True)[source]
Parameters
  • text (str) –

  • add_spacers (bool) –

Return type

StaticText

CreateColorControl(label, alpha_label, color_callback, alpha_callback, alpha_range=(0, 1), placeholder=wx.Colour, placeholder_alpha=None)[source]

Helper method for creating a color control and adding it to the form.

Parameters
  • label (str) – The label text for the color control.

  • alpha_label (str) – The label text for the alpha control. Relevant only on Windows.

  • color_callback (Callable[[Colour], None]) – Callback called when the color changes.

  • alpha_callback (Callable[[float], None]) – Callback called when the alpha changes. Relevant only on Windows.

  • sizer – The sizer to which widgets should be added.

  • alpha_range (Tuple[float, float]) – The inclusive range for the alpha value.

  • placeholder (Colour) –

Return type

Tuple[ColourPickerCtrl, Optional[TextCtrl]]

Returns

A tuple of the color control and the alpha control.

CreateSpinCtrl(**kwargs)[source]

Create a text control that confirms to the theme.

CreateTextCtrl(**kwargs)[source]

Create a text control that confirms to the theme.

InitAndGetSizer()[source]
Return type

GridSizer

MakeFloatCtrlFunction(ctrl_id, callback, range_, left_incl=True, right_incl=True)[source]

Helper method that creates a validation function for a TextCtrl that only allows floats.

Parameters
  • ctrl_id (str) – ID of the TextCtrl, for which this validation function is created.

  • callback (Callable[[float], None]) – Callback for when the float is changed and passes the validation tests.

  • range – Inclusive range for the allowed floats.

  • range_ (Tuple[Optional[float], Optional[float]]) –

  • left_incl (bool) –

  • right_incl (bool) –

Returns

The validation function.

SetValidationState(good, ctrl_id, message='')[source]

Set the validation state for a control.

Parameters
  • good (bool) – Whether the control is currently valid.

  • ctrl_id (str) – The ID of the control.

  • message (str) – The message displayed, if the control is not valid.

rkviewer.forms.GetMultiColor(colors)[source]

Helper method for producing one single color from a list of colors.

Editing programs that allows selection of multiple entities usually support editing all of the selected entities at once. When a property of all the selected entities are the same, the displayed value of that property is that single value precisely. However, if they are not the same, usually a “null” or default value is shown on the form. Following this scheme, this helper returns the common color/alpha if all values are the same, or a default value if not.

Note

On Windows the RGB and the alpha are treated as different fields due to the lack of alpha field in the color picker screen. Therefore, the RGB and the alpha fields are considered different fields as far as uniqueness is considered.

Parameters

colors (List[Colour]) –

Return type

Tuple[Colour, Optional[int]]

rkviewer.forms.GetMultiEnum(entries, fallback)[source]

Similar to _GetMultiColor, but for enums.

Need to specify a fallback value in case the entries are different.

Parameters

entries (List[Any]) –

rkviewer.forms.GetMultiFloatText(values, precision)[source]

Returns the common float value if the set has only one element, otherwise return “?”.

See _GetMultiColor for more detail.

Parameters
  • values (Set[float]) –

  • precision (int) –

Return type

str

rkviewer.forms.GetMultiInt(values)[source]

Returns the common float value if the set has only one element, otherwise return “?”.

See _GetMultiColor for more detail.

Parameters

values (Set[int]) –

Return type

Optional[int]

class rkviewer.forms.NodeForm(parent, canvas, controller)[source]

Bases: wx.lib.scrolledpanel.

Form for editing one or multiple nodes.

Attributes:

Parameters
CreateControls()[source]
NodesMovedOrResized(evt)[source]

Called when nodes are moved or resized by dragging

OnCompositeShapes(evt)[source]
OnNodeLockCheckBox(evt)[source]

Callback for the change node status, floating or boundary.

OnNodeStatusChoice(evt)[source]

Callback for the change node status, floating or boundary.

UpdateAllFields()[source]

Update the form field values based on current data.

UpdateNodes(nodes)[source]

Function called after the list of nodes have been updated.

Parameters

nodes (List[Node]) –

UpdateSelection(selected_idx, comps_selected)[source]

Function called after the list of selected nodes have been updated.

Parameters
  • selected_idx (Set[int]) –

  • comps_selected (bool) –

property selected_nodes
class rkviewer.forms.PrimitiveGrid(parent, form)[source]

Bases: wx.

Parameters

form (NodeForm) –

ChoicePrimitiveControl(label, prop_name, prim_index, choice_items)[source]
Parameters
  • label (str) –

  • prop_name (str) –

  • prim_index (int) –

  • choice_items (List[ChoiceItem]) –

ColorPrimitiveControl(label, alpha_label, prop_name, prim_index)[source]

Create a control for a color property.

If prim_index is -1, then update the text primitive instead.

Parameters
  • label (str) –

  • alpha_label (str) –

  • prop_name (str) –

  • prim_index (int) –

FloatPrimitiveControl(label, prop_name, prim_index)[source]

Create a control for a floating point property.

If prim_index is -1, then update the text primitive instead.

Parameters
  • label (str) –

  • prop_name (str) –

  • prim_index (int) –

IntPrimitiveControl(label, prop_name, prim_index, min_=0, max_=100)[source]

Create a control for a floating point property.

If prim_index is -1, then update the text primitive instead.

Parameters
  • label (str) –

  • prop_name (str) –

  • prim_index (int) –

UpdateValues(nodes)[source]

Update the values in the primitive fields.

Requires:

The FieldGrid contains the up-to-date field widgets for the given composite shape.

class rkviewer.forms.PrimitiveSection(node_form, com_shape)[source]

Bases: wx.

Parameters
UpdatePrimitiveValues()[source]
class rkviewer.forms.ReactionForm(parent, canvas, controller)[source]

Bases: wx.lib.scrolledpanel.

Parameters
CanvasUpdated(reactions, nodes)[source]

Function called after the canvas has been updated.

Parameters
CreateControls()[source]
ModifierTipCallback(evt)[source]

Callback for the change reaction status, bezier curve or straight line.

OnModifierCheck(evt)[source]
Parameters

evt (CommandEvent) –

OnRxnStatusChoice(evt)[source]

Callback for the change reaction status, bezier curve or straight line.

UpdateAllFields()[source]

Update all reaction fields from current data.

UpdateSelection(selected_idx)[source]

Function called after the list of selected reactions have been updated.

Parameters

selected_idx (List[int]) –

self_changes

flag for if edits were made but the controller hasn’t updated the view yet

class rkviewer.forms.StoichInfo(nodei, stoich)[source]

Bases: object

Helper class that stores node stoichiometry info for reaction form

Parameters
  • nodei (int) –

  • stoich (float) –

nodei: int
stoich: float
class rkviewer.forms.StoichSection(parent, form, stoichs, reai, is_reactants)[source]

Bases: wx.

Parameters
MakeSetDestStoichFunction(reai, nodei)[source]
Parameters
  • reai (int) –

  • nodei (int) –

MakeSetSrcStoichFunction(reai, nodei)[source]
Parameters
  • reai (int) –

  • nodei (int) –

rkviewer.forms.parse_num_pair(text)[source]

Parse a pair of floats from a string with form “X,Y” and return a tuple.

Returns None if failed to parse.

Parameters

text (str) –

Return type

Optional[Tuple[float, float]]

rkviewer.forms.parse_precisions(text)[source]

Given a string in format ‘X, Y’ of floats, return the decimal precisions of X and Y.

Parameters

text (str) –

Return type

Tuple[int, int]

rkviewer.iodine module

Iodine Network Object Model.

Original author: RJ Zhou “Forked” from: https://github.com/zrj26/go-NOM Adapted by: Gary Geng

TODOs
  • Phase out errCode, or at least provide more detalis in error messages.

class rkviewer.iodine.AbstractNodeSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

id = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
index = <fields.Integer(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
nodeLocked = <fields.Boolean(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid boolean.'})>
opts = <marshmallow.schema.SchemaOpts object>
position = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
post_dump(data, **kwargs)[source]
Parameters

data (Any) –

rectSize = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
class rkviewer.iodine.AliasSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.AbstractNodeSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
originalIdx = <fields.Integer(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

class rkviewer.iodine.ChoiceField(choice_list)[source]

Bases: marshmallow.fields.Field

class rkviewer.iodine.CircleSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PrimitiveSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

CirclePrim

class rkviewer.iodine.CompartmentSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

fillColor = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
id = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
nodes = <fields.List(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
opts = <marshmallow.schema.SchemaOpts object>
outlineColor = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
outlineThickness = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
position = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TCompartment

rectSize = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
volume = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
class rkviewer.iodine.CompositeShapeSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

items = <fields.List(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
name = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

CompositeShape

text_item = <fields.Tuple(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid tuple.'})>
rkviewer.iodine.CreateBiBi(neti, reaID, rateLaw, src1i, src2i, dest1i, dest2i, src1Stoich, src2Stoich, dest1Stoich, dest2Stoich)[source]
Parameters
  • neti (int) –

  • reaID (str) –

  • rateLaw (str) –

  • src1i (int) –

  • src2i (int) –

  • dest1i (int) –

  • dest2i (int) –

  • src1Stoich (float) –

  • src2Stoich (float) –

  • dest1Stoich (float) –

  • dest2Stoich (float) –

rkviewer.iodine.CreateBiUni(neti, reaID, rateLaw, src1i, src2i, desti, src1Stoich, src2Stoich, destStoich)[source]
Parameters
  • neti (int) –

  • reaID (str) –

  • rateLaw (str) –

  • src1i (int) –

  • src2i (int) –

  • desti (int) –

  • src1Stoich (float) –

  • src2Stoich (float) –

  • destStoich (float) –

rkviewer.iodine.CreateUniBi(neti, reaID, rateLaw, srci, dest1i, dest2i, srcStoich, dest1Stoich, dest2Stoich)[source]
Parameters
  • neti (int) –

  • reaID (str) –

  • rateLaw (str) –

  • srci (int) –

  • dest1i (int) –

  • dest2i (int) –

  • srcStoich (float) –

  • dest1Stoich (float) –

  • dest2Stoich (float) –

class rkviewer.iodine.EnumField(enum_class)[source]

Bases: marshmallow.fields.Field

class rkviewer.iodine.ErrorCode(value)[source]

Bases: enum.Enum

An enumeration.

BAD_STOICH = -8
COMPI_NOT_FOUND = -13
FILE_ERROR = -11
ID_NOT_FOUND = -2
ID_REPEAT = -3
JSON_ERROR = -10
NETI_NOT_FOUND = -5
NODEI_NOT_FOUND = -7
NODE_NOT_FREE = -4
OK = 0
OTHER = -1
OUT_OF_RANGE = -12
REAI_NOT_FOUND = -6
STACK_EMPTY = -9
class rkviewer.iodine.FontSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

color: rkviewer.config.Color
family

alias of str

name: str
opts = <marshmallow.schema.SchemaOpts object>
pointSize = <fields.Pixel(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
style: str
weight: str
class rkviewer.iodine.HexagonSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PolygonSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
points = <fields.Tuple(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid tuple.'})>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

HexagonPrim

rkviewer.iodine.IsBoundaryNode(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.IsFloatingNode(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.IsNodeLocked(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

class rkviewer.iodine.LineSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PrimitiveSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
points = <fields.Tuple(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid tuple.'})>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

LinePrim

class rkviewer.iodine.NetworkSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

compartments = <fields.Mapping(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid mapping type.'})>
id = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
nodes = <fields.Mapping(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid mapping type.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_dump(data, **kwargs)[source]
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TNetwork

pre_load(data, **kwargs)[source]
Parameters

data (Any) –

reactions = <fields.Mapping(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid mapping type.'})>
class rkviewer.iodine.NodeSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.AbstractNodeSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

compi = <fields.Integer(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=-1, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
floating = <fields.Boolean(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid boolean.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TNode

shape = <fields.Nested(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'type': 'Invalid type.'})>
class rkviewer.iodine.PolygonSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PrimitiveSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

border_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
border_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
corner_radius = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
fill_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
opts = <marshmallow.schema.SchemaOpts object>
radius = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
class rkviewer.iodine.PrimitiveSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

border_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
border_width = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
fill_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
name = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
opts = <marshmallow.schema.SchemaOpts object>
class rkviewer.iodine.ReactionSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

bezierCurves = <fields.Boolean(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid boolean.'})>
centerHandlePos = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
centerPos = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=None, allow_none=True, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
fillColor = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
id = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
modifiers = <fields.List(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TReaction

products = <fields.Dict(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid mapping type.'})>
rateLaw = <fields.String(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>
reactants = <fields.Dict(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid mapping type.'})>
thickness = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
tipStyle = <fields.EnumField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
class rkviewer.iodine.RectangleSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PrimitiveSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

corner_radius = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

RectanglePrim

class rkviewer.iodine.SpeciesNode(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Represents a species in a reaction.

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

handlePos = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TSpeciesNode

stoich = <fields.Float(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
class rkviewer.iodine.TAbstractNode[source]

Bases: abc.ABC

compi: int
index: int
nodeLocked: bool
position: rkviewer.canvas.geometry.Vec2
rectSize: rkviewer.canvas.geometry.Vec2
class rkviewer.iodine.TAliasNode(index, position, rectSize, originalIdx, nodeLocked, compi=- 1)[source]

Bases: rkviewer.iodine.TAbstractNode

Parameters
  • index (int) –

  • position (Vec2) –

  • rectSize (Vec2) –

  • originalIdx (int) –

  • nodeLocked (bool) –

  • compi (int) –

compi: int = -1
index: int
nodeLocked: bool
originalIdx: int
position: rkviewer.canvas.geometry.Vec2
rectSize: rkviewer.canvas.geometry.Vec2
class rkviewer.iodine.TCompartment(id, position, rectSize, node_indices=<factory>, volume=1, fillColor=Color(r=0, g=247, b=255, a=255), outlineColor=Color(r=0, g=106, b=255, a=255), outlineThickness=2)[source]

Bases: object

Parameters
  • id (str) –

  • position (Vec2) –

  • rectSize (Vec2) –

  • node_indices (Set[int]) –

  • volume (float) –

  • fillColor (Color) –

  • outlineColor (Color) –

  • outlineThickness (float) –

fillColor: rkviewer.config.Color = Color(r=0, g=247, b=255, a=255)
id: str
node_indices: Set[int]
outlineColor: rkviewer.config.Color = Color(r=0, g=106, b=255, a=255)
outlineThickness: float = 2
position: rkviewer.canvas.geometry.Vec2
rectSize: rkviewer.canvas.geometry.Vec2
volume: float = 1
class rkviewer.iodine.TNetwork(id, nodes=None, reactions=None, compartments=None)[source]

Bases: object

Represents an entire reaction network.

NOTE IMPORTANT whenever any change is made to the code that changes how the network is serialized/deserialized, one must bump the global variable SERIAL_VERSION to reflect that. See NetworkSchema::serialVersion for more information.

Parameters
addCompartment(comp)[source]
Parameters

comp (TCompartment) –

Return type

int

addNode(node)[source]
Parameters

node (TAbstractNode) –

Return type

int

addReaction(rea)[source]
Parameters

rea (TReaction) –

baseNodes: Set[int]

Set of node indices not in any compartment

compartments: Dict[int, rkviewer.iodine.TCompartment]
destMap: DefaultDict[int, MutableSet[int]]

Map nodes to reactions of which it is a target

id: str
lastCompartmentIdx: int
lastNodeIdx: int
lastReactionIdx: int
nodes: Dict[int, rkviewer.iodine.TAbstractNode]
reactions: Dict[int, rkviewer.iodine.TReaction]
srcMap: DefaultDict[int, MutableSet[int]]

Map nodes to reactions of which it is a source

class rkviewer.iodine.TNetworkDict[source]

Bases: Dict[int, rkviewer.iodine.TNetwork]

class rkviewer.iodine.TNode(index, id, position, rectSize, floating, nodeLocked, compi=-1, shapei=0, shape=<factory>)[source]

Bases: rkviewer.iodine.TAbstractNode

Parameters
  • index (int) –

  • id (str) –

  • position (Vec2) –

  • rectSize (Vec2) –

  • floating (bool) –

  • nodeLocked (bool) –

  • compi (int) –

  • shapei (int) –

  • shape (CompositeShape) –

compi: int = -1
floating: bool
id: str
index: int
nodeLocked: bool
position: rkviewer.canvas.geometry.Vec2
rectSize: rkviewer.canvas.geometry.Vec2
shape: rkviewer.canvas.data.CompositeShape
shapei: int = 0
class rkviewer.iodine.TReaction(id, centerPos=None, rateLaw='', reactants=<factory>, products=<factory>, fillColor=Color(r=255, g=150, b=80, a=255), thickness=3.0, centerHandlePos=(0, 0), bezierCurves=True, modifiers=<factory>, tipStyle=<ModifierTipStyle.CIRCLE: 'circle'>)[source]

Bases: object

Parameters
  • id (str) –

  • centerPos (Optional[Vec2]) –

  • rateLaw (str) –

  • reactants (Dict[int, TSpeciesNode]) –

  • products (Dict[int, TSpeciesNode]) –

  • fillColor (Color) –

  • thickness (float) –

  • centerHandlePos (Vec2) –

  • bezierCurves (bool) –

  • modifiers (Set[int]) –

  • tipStyle (ModifierTipStyle) –

bezierCurves: bool = True
centerHandlePos: rkviewer.canvas.geometry.Vec2 = (0, 0)
centerPos: Optional[rkviewer.canvas.geometry.Vec2] = None
fillColor: rkviewer.config.Color = Color(r=255, g=150, b=80, a=255)
id: str
modifiers: Set[int]
products: Dict[int, rkviewer.iodine.TSpeciesNode]
rateLaw: str = ''
reactants: Dict[int, rkviewer.iodine.TSpeciesNode]
thickness: float = 3.0
tipStyle: rkviewer.canvas.data.ModifierTipStyle = 'circle'
class rkviewer.iodine.TSpeciesNode(stoich, handlePos=(0, 0))[source]

Bases: object

Parameters
  • stoich (float) –

  • handlePos (Vec2) –

handlePos: rkviewer.canvas.geometry.Vec2 = (0, 0)
stoich: float
class rkviewer.iodine.TStack[source]

Bases: object

isEmpty()[source]
items: List[rkviewer.iodine.TNetworkDict]
pop()[source]
push(netDict)[source]
Parameters

netDict (TNetworkDict) –

class rkviewer.iodine.TextSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

alignment = <fields.ChoiceField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
bg_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
font_color = <fields.ColorField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
font_family = <fields.ChoiceField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
font_size = <fields.Integer(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid integer.', 'too_large': 'Number too large.'})>
font_style = <fields.ChoiceField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
font_weight = <fields.ChoiceField(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>
opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TextPrim

class rkviewer.iodine.TransformSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: marshmallow.schema.Schema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

Transform

rotation = <fields.Dim(default=<marshmallow.missing>, attribute=None, validate=<Range(min=0, max=None, min_inclusive=True, max_inclusive=True, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid number.', 'too_large': 'Number too large.', 'special': 'Special numeric values (nan or infinity) are not permitted.'})>
scale = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
translation = <fields.Dim2(default=<marshmallow.missing>, attribute=None, validate=<Length(min=None, max=None, equal=2, error=None)>, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid list.'})>
class rkviewer.iodine.TriangleSchema(*, only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)[source]

Bases: rkviewer.iodine.PolygonSchema

Parameters
  • only (Union[Sequence[str], Set[str], None]) –

  • exclude (Union[Sequence[str], Set[str]]) –

  • many (bool) –

  • context (Optional[Dict]) –

  • load_only (Union[Sequence[str], Set[str]]) –

  • dump_only (Union[Sequence[str], Set[str]]) –

  • partial (Union[bool, Sequence[str], Set[str]]) –

  • unknown (Optional[str]) –

opts = <marshmallow.schema.SchemaOpts object>
points = <fields.Tuple(default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, missing=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid tuple.'})>
post_load(data, **kwargs)[source]
Parameters

data (Any) –

Return type

TrianglePrim

rkviewer.iodine.addAliasNode(neti, originalIdx, x, y, w, h)[source]
Parameters
  • neti (int) –

  • originalIdx (int) –

  • x (float) –

  • y (float) –

  • w (float) –

  • h (float) –

Return type

int

rkviewer.iodine.addCompartment(neti, compID, x, y, w, h)[source]

Create a compartment and add to canvas. Return the index of the compartment added.

Parameters
  • neti (int) – network index.

  • compID (str) – ID of the compartment.

  • x (float) – x coordinate of top-left corner

  • y (float) – y coordinate of top-left corner

  • w (float) – width

  • h (float) – height

Return type

int

rkviewer.iodine.addNode(neti, nodeID, x, y, w, h, floatingNode=True, nodeLocked=False)[source]

AddNode adds a node to the network errCode - 3: id repeat, 0: ok -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodeID (str) –

  • x (float) –

  • y (float) –

  • w (float) –

  • h (float) –

  • floatingNode (bool) –

  • nodeLocked (bool) –

Return type

int

rkviewer.iodine.aliasForReaction(neti, reai, nodei, x, y, w, h)[source]

Create an alias for nodei, and replace each instance of nodei in reai with the alias

Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • x (float) –

  • y (float) –

  • w (float) –

  • h (float) –

rkviewer.iodine.bezier_curves(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.clearNetwork(neti)[source]

ClearNetwork clear all nodes and reactions in this network errCode: -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.clearNetworks()[source]
rkviewer.iodine.clearReactions(neti)[source]

clearReactions clear all reactions in this network errCode: -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.colorToRGB(color)[source]
Parameters

color (Color) –

rkviewer.iodine.createReaction(neti, reaID, sources, targets)[source]

createReaction create an empty reacton errCode: -3: id repeat -5: net index out of range

Parameters
  • neti (int) –

  • reaID (str) –

  • sources (List[int]) –

  • targets (List[int]) –

rkviewer.iodine.createUniUni(neti, reaID, rateLaw, srci, desti, srcStoich, destStoich)[source]
Parameters
  • neti (int) –

  • reaID (str) –

  • rateLaw (str) –

  • srci (int) –

  • desti (int) –

  • srcStoich (float) –

  • destStoich (float) –

rkviewer.iodine.deleteCompartment(neti, compi)[source]

Delete the compartment of the given index in the given network.

Parameters
  • neti (int) –

  • compi (int) –

rkviewer.iodine.deleteNetwork(neti)[source]

DeleteNetwork DeleteNetwork errCode: -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.deleteNode(neti, nodei)[source]

DeleteNode deletes the node with index. Returns whether there was a node with the given index, i.e. whether a node was deleted.

This does not throw an error due to the possibility of someone deleting nodes in a loop, in which case an original copy may be deleted before its alias, and so when the alias is reached, it no longer exists.

Parameters
  • neti (int) –

  • nodei (int) –

Return type

bool

rkviewer.iodine.deleteReaction(neti, reai)[source]

deleteReaction delete the reaction with index errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.dumpNetwork(neti)[source]

Dump the network into an object and return it.

Parameters

neti (int) –

rkviewer.iodine.endGroup()[source]

EndGroup used at the end of a group operaction or secondary function.

rkviewer.iodine.getCompartmentFillColor(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Color

rkviewer.iodine.getCompartmentID(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

str

rkviewer.iodine.getCompartmentOfNode(neti, nodei)[source]

Return the compartment index that the given node is in, or -1 if it is not in any.

Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

rkviewer.iodine.getCompartmentOutlineColor(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Color

rkviewer.iodine.getCompartmentOutlineThickness(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

float

rkviewer.iodine.getCompartmentPosition(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Tuple[float, float]

rkviewer.iodine.getCompartmentSize(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Tuple[float, float]

rkviewer.iodine.getCompartmentVolume(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

float

rkviewer.iodine.getCompositeShapeAt(neti, shapei)[source]
Parameters
  • neti (int) –

  • shapei (int) –

rkviewer.iodine.getDestReactions(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

rkviewer.iodine.getErrorCode()[source]

get the error code of last function

rkviewer.iodine.getListOfCompartmentIndices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

rkviewer.iodine.getListOfCompartments(neti)[source]
Parameters

neti (int) –

Return type

List[int]

rkviewer.iodine.getListOfCompositeShapes(neti)[source]
Parameters

neti (int) –

rkviewer.iodine.getListOfNetworks()[source]
Return type

List[int]

rkviewer.iodine.getListOfNodeIDs(neti)[source]
Parameters

neti (int) –

Return type

List[str]

rkviewer.iodine.getListOfNodeIndices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

rkviewer.iodine.getListOfReactionDestNodes(neti, reai)[source]

getListOfReactionDestNodes getListOfReactionDestNodes in alphabetical order return: non-empty slice : ok, -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

Return type

List[int]

rkviewer.iodine.getListOfReactionDestStoich(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

List[float]

rkviewer.iodine.getListOfReactionIDs(neti)[source]
Parameters

neti (int) –

Return type

List[str]

rkviewer.iodine.getListOfReactionIndices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

rkviewer.iodine.getListOfReactionSrcNodes(neti, reai)[source]

getListOfReactionSrcNodes getListOfReactionSrcNodes in alphabetical order return: non-empty slice : ok, -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

Return type

List[int]

rkviewer.iodine.getListOfReactionSrcStoich(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

List[float]

rkviewer.iodine.getModifierTipStyle(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

ModifierTipStyle

rkviewer.iodine.getNetworkID(neti)[source]

GetNetworkID GetID of network errCode: -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.getNetworkIndex(netID)[source]

return: -2: net id can’t find

Parameters

netID (str) –

Return type

int

rkviewer.iodine.getNodeBorderColor(neti, nodei)[source]

getNodeBorderColor rgba tulple format, rgb range int[0,255] alpha range float[0,1] errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeBorderColorAlpha(neti, nodei)[source]

getNodeBorderColorAlpha getNodeBorderColor alpha value(float) errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeBorderColorRGB(neti, nodei)[source]

getNodeBorderColorRGB getNodeBorderColor rgb int format errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeBorderWidth(neti, nodei)[source]

errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeCenter(neti, nodei)[source]

GetNodeCenter Get the X and Y coordinate of the Center of node errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeCoordinateAndSize(neti, nodei)[source]

getNodeCoordinateAndSize get the x,y,w,h of the node errCode:-7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeFillColor(neti, nodei)[source]

Return the ‘fill_color’ property of the first primitive in the given node’s composite shape, if there is such a primitive. Otherwise, return None.

This function exists for backwards-compatibility and convenience reasons.

errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeFillColorAlpha(neti, nodei)[source]

getNodeFillColorAlpha getNodeFillColor alpha value(float) errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeFillColorRGB(neti, nodei)[source]

See getNodeFillColor(), except only returns the RGB values

errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeID(neti, nodei)[source]

GetNodeID Get the id of the node errCode: -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • nodei (int) –

rkviewer.iodine.getNodeIndex(neti, nodeID)[source]

GetNodeIndex get node index by id errCode: -2: node id not found, -5: net index out of range return: >=0

Parameters
  • neti (int) –

  • nodeID (str) –

rkviewer.iodine.getNodeShape(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

CompositeShape

rkviewer.iodine.getNodeShapeIndex(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

rkviewer.iodine.getNodesInCompartment(neti, compi)[source]

Return the list of node indices in the given compartment.

Parameters
  • neti (int) –

  • compi (int) –

Return type

List[int]

rkviewer.iodine.getNumberOfDestNodes(neti, reai)[source]

getNumberOfDestNodes get the DestNode length of Reaction return: non-negative int: ok, -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getNumberOfNetworks()[source]
rkviewer.iodine.getNumberOfNodes(neti)[source]

GetNumberOfNodes get the number of nodes in the current network num: >= -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.getNumberOfReactions(neti)[source]

getNumberOfReactions get the number of reactions in the current Reactionset return: >=0: ok, -5: net index out of range

Parameters

neti (int) –

rkviewer.iodine.getNumberOfSrcNodes(neti, reai)[source]

getNumberOfSrcNodes get the SrcNode length of Reaction return: non-negative int: ok, -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getOriginalIndex(neti, nodei)[source]

Return -1 if the node is an original, or if this is an alias, return the original index.

Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

rkviewer.iodine.getReactionCenterHandlePosition(neti, reai)[source]

getReactionCenterHandlePosition getReactionCenterHandlePosition errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionCenterPos(neti, reai)[source]

getReactionCenterPos get the center position of the Reaction

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionDestNodeHandlePosition(neti, reai, destNodeIdx)[source]

getReactionDestNodeStoich get the DestNode HandlePosition of Reaction return: positive float : ok, -6: reaction index out of range, -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

  • destNodeIdx (int) –

rkviewer.iodine.getReactionDestNodeStoich(neti, reai, destNodeIdx)[source]

getReactionDestNodeStoich get the DestNode stoichiometry of Reaction return: positive float : ok, -6: reaction index out of range, -7: node index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

  • destNodeIdx (int) –

rkviewer.iodine.getReactionFillColor(neti, reai)[source]

getReactionFillColor rgba tulple format, rgb range int[0,255] alpha range float[0,1] errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionFillColorAlpha(neti, reai)[source]

getReactionFillColorAlpha getReactionFillColorAlpha errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionFillColorRGB(neti, reai)[source]

getReactionFillColorRGB getReactionFillColorRGB errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionID(neti, reai)[source]

getReactionID get the id of Reaction errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionIndex(neti, reaID)[source]

getReactionIndex get reaction index by id return: -2: id can’t find, >=0: ok -5: net index out of range

Parameters
  • neti (int) –

  • reaID (str) –

rkviewer.iodine.getReactionLineThickness(neti, reai)[source]

getReactionLineThickness getReactionLineThickness errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionModifiers(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Set[int]

rkviewer.iodine.getReactionRateLaw(neti, reai)[source]

getReactionRateLaw get the ratelaw of Reaction errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.getReactionSrcNodeHandlePosition(neti, reai, srcNodeIdx)[source]

getReactionSrcNodeHandlePosition get the SrcNode HandlePosition of Reaction errCode: -6: reaction index out of range, -5: net index out of range, -7: node index out of range

Parameters
  • neti (int) –

  • reai (int) –

  • srcNodeIdx (int) –

rkviewer.iodine.getReactionSrcNodeStoich(neti, reai, srcNodeIdx)[source]

getReactionSrcNodeStoich get the SrcNode stoichiometry of Reaction errCode: -6: reaction index out of range, -5: net index out of range, -7: node index not found

Parameters
  • neti (int) –

  • reai (int) –

  • srcNodeIdx (int) –

rkviewer.iodine.getSrcReactions(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

rkviewer.iodine.get_theme_fn(name)[source]
rkviewer.iodine.loadNetwork(net_object)[source]

Load the network object (laoded directly from JSON) and add it, returning the network index.

Note

For now this overwrites the network at index 0.

Return type

int

rkviewer.iodine.newNetwork(netID)[source]

newNetwork Create a new network errCode -3: id repeat, 0 :ok

Parameters

netID (str) –

rkviewer.iodine.node_or_alias_dump(base_obj, parent_obj)[source]
rkviewer.iodine.node_or_alias_load(base_dict, parent_dict)[source]
rkviewer.iodine.primitive_dump(base_obj, parent_obj)[source]
rkviewer.iodine.primitive_load(base_dict, parent_dict)[source]
rkviewer.iodine.printReactionInfo(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

rkviewer.iodine.redo()[source]

Redo redo errCode: -9: stack is empty

rkviewer.iodine.reset()[source]
rkviewer.iodine.setCompartmentFillColor(neti, compi, color)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • color (Color) –

rkviewer.iodine.setCompartmentID(neti, compi, id)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • id (str) –

rkviewer.iodine.setCompartmentOfNode(neti, nodei, compi)[source]

Set the compartment of the node, or remove it from any compartment if -1 is given.

Parameters
  • neti (int) –

  • nodei (int) –

  • compi (int) –

rkviewer.iodine.setCompartmentOutlineColor(neti, compi, color)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • color (Color) –

rkviewer.iodine.setCompartmentOutlineThickness(neti, compi, thickness)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • thickness (float) –

rkviewer.iodine.setCompartmentPosition(neti, compi, x, y)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • x (float) –

  • y (float) –

rkviewer.iodine.setCompartmentSize(neti, compi, w, h)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • w (float) –

  • h (float) –

rkviewer.iodine.setCompartmentVolume(neti, compi, volume)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • volume (float) –

rkviewer.iodine.setModifierTipStyle(neti, reai, tipStyle)[source]
Parameters
rkviewer.iodine.setNodeBorderColorAlpha(neti, nodei, a)[source]

setNodeBorderColorAlpha setNodeBorderColorAlpha, alpha is a float between 0 and 1 errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • a (float) –

rkviewer.iodine.setNodeBorderColorRGB(neti, nodei, r, g, b)[source]

setNodeBorderColorRGB setNodeBorderColorRGB errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • r (int) –

  • g (int) –

  • b (int) –

rkviewer.iodine.setNodeBorderWidth(neti, nodei, width)[source]

setNodeBorderWidth setNodeBorderWidth errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • width (float) –

rkviewer.iodine.setNodeCoordinate(neti, nodei, x, y, allowNegativeCoordinates=False)[source]

setNodeCoordinate setNodeCoordinate errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • x (float) –

  • y (float) –

  • allowNegativeCoordinates (bool) –

rkviewer.iodine.setNodeFillColorAlpha(neti, nodei, a)[source]

setNodeFillColorAlpha setNodeFillColorAlpha errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • a (float) –

rkviewer.iodine.setNodeFillColorRGB(neti, nodei, r, g, b)[source]

setNodeFillColorRGB setNodeFillColorRGB errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • r (int) –

  • g (int) –

  • b (int) –

rkviewer.iodine.setNodeFloatingStatus(neti, nodei, floatingStatus)[source]

setNodeFloatingStatus setNodeFloatingStatus errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • floatingStatus (bool) –

rkviewer.iodine.setNodeID(neti, nodei, newID)[source]

setNodeID set the id of a node errCode -3: id repeat -5: net index out of range -7: node index out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • newID (str) –

rkviewer.iodine.setNodeLockedStatus(neti, nodei, lockedNode)[source]

setNodeLockedStatus setNodeLockedStatus errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • lockedNode (bool) –

rkviewer.iodine.setNodePrimitiveProperty(neti, nodei, prim_index, prop_name, prop_value)[source]

Set an individual property of a node’s primitive.

Parameters
  • neti (int) – The network index

  • nodei (int) – The node index

  • prim_index (int) – The index of the primitive, in the node’s shape. If -1, then update the text primitive instead.

  • prop_name (str) – The name of the primitive’s property.

  • prop_value (Any) – The value of the primitives’s property

rkviewer.iodine.setNodeShapeIndex(neti, nodei, shapei, preserve_common_fields=True)[source]

If preserve_common_fields is True, then preserve common field values such as fill_color, if applicable. (Not implemented)

Parameters
  • neti (int) –

  • nodei (int) –

  • shapei (int) –

rkviewer.iodine.setNodeSize(neti, nodei, w, h)[source]

setNodeSize setNodeSize errCode: -7: node index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • nodei (int) –

  • w (float) –

  • h (float) –

rkviewer.iodine.setRateLaw(neti, reai, rateLaw)[source]

setRateLaw edit rate law of reaction errCode: -6: reaction index out of range -5: net index out of range

Parameters
  • neti (int) –

  • reai (int) –

  • rateLaw (str) –

rkviewer.iodine.setReactionBezierCurves(neti, reai, bezierCurves)[source]

setReactionBezierCurves setReactionBezierCurves errCode: -6: reaction index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • bezierCurves (bool) –

rkviewer.iodine.setReactionCenterHandlePosition(neti, reai, centerHandlePosX, centerHandlePosY)[source]

setReactionCenterHandlePosition setReactionCenterHandlePosition errCode: -6: reaction index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • centerHandlePosX (float) –

  • centerHandlePosY (float) –

rkviewer.iodine.setReactionCenterPos(neti, reai, centerPos)[source]

setReactionCenterPos set the center position of the Reaction

Parameters
  • neti (int) –

  • reai (int) –

  • centerPos (Optional[Vec2]) –

rkviewer.iodine.setReactionDestNodeHandlePosition(neti, reai, destNodeIdx, handlePosX, handlePosY)[source]

setReactionDestNodeHandlePosition edit HandlePosition by Reaction destNodeID errCode: -6: reaction index out of range, -5: net index out of range, -2: id not found -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • destNodeIdx (int) –

  • handlePosX (float) –

  • handlePosY (float) –

rkviewer.iodine.setReactionDestNodeStoich(neti, reai, destNodeIdx, newStoich)[source]

setReactionDestNodeStoich edit Stoich by Reaction destNodeID errCode: -6: reaction index out of range, -5: net index out of range, -7: node index not found, -8: wrong stoich raises ValueError if given node index not a dest node

Parameters
  • neti (int) –

  • reai (int) –

  • destNodeIdx (int) –

  • newStoich (float) –

rkviewer.iodine.setReactionFillColorAlpha(neti, reai, a)[source]

setReactionFillColorAlpha setReactionFillColorAlpha errCode: -6: reaction index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • a (float) –

rkviewer.iodine.setReactionFillColorRGB(neti, reai, R, G, B)[source]

setReactionFillColorRGB setReactionFillColorRGB errCode: -6: reaction index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • R (int) –

  • G (int) –

  • B (int) –

rkviewer.iodine.setReactionID(neti, reai, newID)[source]

setReactionID edit id of reaction errCode: 0:ok, -6: reaction index out of range -5: net index out of range -3: id repeat

Parameters
  • neti (int) –

  • reai (int) –

  • newID (str) –

rkviewer.iodine.setReactionLineThickness(neti, reai, thickness)[source]

setReactionLineThickness setReactionLineThickness errCode: -6: reaction index out of range -5: net index out of range -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • thickness (float) –

rkviewer.iodine.setReactionModifiers(neti, reai, modifiers)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • modifiers (Set[int]) –

rkviewer.iodine.setReactionSrcNodeHandlePosition(neti, reai, srcNodeIdx, handlePosX, handlePosY)[source]

setReactionSrcNodeHandlePosition edit HandlePosition by Reaction srcNodeID errCode: -6: reaction index out of range, -5: net index out of range, -7: node index not found -12: Variable out of range

Parameters
  • neti (int) –

  • reai (int) –

  • srcNodeIdx (int) –

  • handlePosX (float) –

  • handlePosY (float) –

rkviewer.iodine.setReactionSrcNodeStoich(neti, reai, srcNodeIdx, newStoich)[source]

setReactionSrcNodeStoich edit Stoich by Reaction srcNodeID errCode: -6: reaction index not found, -5: net index not found -7: node index not found, -8: wrong stoich raises ValueError if given node index not a dest node

Parameters
  • neti (int) –

  • reai (int) –

  • srcNodeIdx (int) –

  • newStoich (float) –

rkviewer.iodine.startGroup()[source]

StartGroup used at the start of a group operaction or secondary function.

rkviewer.iodine.undo()[source]

Undo ge back to last state errCode: -9: stack is empty

rkviewer.iodine.validateNodes(nodes)[source]
Parameters

nodes (Dict[int, TAbstractNode]) –

rkviewer.iodine.validateState()[source]

rkviewer.main module

class rkviewer.main.ExceptionDialog(*args: Any, **kwargs: Any)[source]

Bases: wx.

rkviewer.main.create_excepthook(old_excepthook)[source]
rkviewer.main.main()[source]
rkviewer.main.setup_logging()[source]

rkviewer.mvc module

exception rkviewer.mvc.CompartmentIndexError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.FileError[source]

Bases: rkviewer.mvc.ModelError

class rkviewer.mvc.IController[source]

Bases: abc.ABC

The inteface class for a controller

The abc.ABC (Abstract Base Class) is used to enforce the MVC interface more strictly.

The methods with name beginning with Try- are usually called by the RKView after some user input. If the action tried in such a method succeeds, the Controller should request the view to be redrawn; otherwise, an error message might be shown.

abstract add_alias_node(neti, original_index, pos, size)[source]
Parameters
  • neti (int) –

  • original_index (int) –

  • pos (Vec2) –

  • size (Vec2) –

Return type

int

abstract add_compartment_g(neti, compartment)[source]

Try to add the given Compartment to the canvas. Return index of added comp.

Parameters
Return type

int

abstract add_node_g(neti, node)[source]

Try to add the given Node to the canvas. Return index of the node added.

Parameters
  • neti (int) –

  • node (Node) –

Return type

int

abstract add_reaction_g(neti, reaction)[source]
Parameters
  • neti (int) –

  • reaction (Reaction) –

Return type

int

abstract alias_for_reaction(neti, reai, nodei, pos, size)[source]

See Iodine aliasForReaction for documentation

Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • pos (Vec2) –

  • size (Vec2) –

abstract clear_network(neti)[source]
Parameters

neti (int) –

abstract delete_compartment(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

bool

abstract delete_node(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

bool

abstract delete_reaction(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

bool

abstract dump_network(neti)[source]
Parameters

neti (int) –

abstract get_application_position()[source]
Return type

Point

abstract get_center_handle(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Vec2

abstract get_compartment_by_index(neti, compi)[source]
Parameters
  • neti (int) –

  • compi (int) –

Return type

Compartment

abstract get_compartment_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

abstract get_compartment_of_node(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

abstract get_composite_shape_at(neti, shapei)[source]
Parameters
  • neti (int) –

  • shapei (int) –

Return type

List[CompositeShape]

abstract get_composite_shape_list(neti)[source]
Parameters

neti (int) –

Return type

List[CompositeShape]

abstract get_dest_node_handle(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

Vec2

abstract get_dest_node_stoich(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

float

abstract get_list_of_compartments(neti)[source]
Parameters

neti (int) –

Return type

List[Compartment]

abstract get_list_of_dest_indices(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

List[int]

abstract get_list_of_node_ids(neti)[source]

Try getting the list of node IDs

Parameters

neti (int) –

Return type

List[str]

abstract get_list_of_nodes(neti)[source]
Parameters

neti (int) –

Return type

List[Node]

abstract get_list_of_reactions(neti)[source]
Parameters

neti (int) –

Return type

List[Reaction]

abstract get_list_of_src_indices(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

List[int]

abstract get_modifier_tip_style(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

ModifierTipStyle

abstract get_node_by_index(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Node

abstract get_node_id(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

str

abstract get_node_index(neti, node_id)[source]
Parameters
  • neti (int) –

  • node_id (str) –

Return type

int

abstract get_node_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

abstract get_node_shape(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

CompositeShape

abstract get_node_shape_index(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

int

abstract get_nodes_in_compartment(neti, cmpi)[source]
Parameters
  • neti (int) –

  • cmpi (int) –

Return type

List[int]

abstract get_reaction_by_index(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

Reaction

abstract get_reaction_index(neti, rxn_id)[source]
Parameters
  • neti (int) –

  • rxn_id (str) –

Return type

int

abstract get_reaction_indices(neti)[source]
Parameters

neti (int) –

Return type

Set[int]

abstract get_reaction_modifiers(neti, reai)[source]
Parameters
  • neti (int) –

  • reai (int) –

Return type

List[int]

abstract get_reactions_as_product(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

abstract get_reactions_as_reactant(neti, nodei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

Return type

Set[int]

abstract get_src_node_handle(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

Vec2

abstract get_src_node_stoich(neti, reai, nodei)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

Return type

float

abstract group_action()[source]
Return type

Any

abstract load_network(json_obj)[source]
Parameters

json_obj (Any) –

Return type

int

abstract move_compartment(neti, compi, pos)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • pos (Vec2) –

abstract move_node(neti, nodei, pos, allowNegativeCoords=False)[source]

Try to move the give node. TODO only accept node ID and new location

Parameters
  • neti (int) –

  • nodei (int) –

  • pos (Vec2) –

  • allowNegativeCoords (bool) –

Return type

bool

abstract new_network()[source]

Create a new network.

Since there is only one tab for now, this merely clears the the current network. Also, does not clear undo stack.

abstract redo()[source]

Try to redo last undone operation

Return type

bool

abstract rename_compartment(neti, compi, new_id)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • new_id (str) –

abstract rename_node(neti, nodei, new_id)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • new_id (str) –

Return type

bool

abstract rename_reaction(neti, reai, new_id)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • new_id (str) –

Return type

bool

abstract set_application_position(pos)[source]
Parameters

pos (Point) –

abstract set_center_handle(neti, reai, pos)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • pos (Vec2) –

abstract set_compartment_border(neti, compi, fill)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • fill (Colour) –

abstract set_compartment_border_width(neti, compi, width)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • width (float) –

abstract set_compartment_fill(neti, compi, fill)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • fill (Colour) –

abstract set_compartment_of_node(neti, nodei, compi)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • compi (int) –

abstract set_compartment_size(neti, compi, size)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • size (Vec2) –

abstract set_compartment_volume(neti, compi, volume)[source]
Parameters
  • neti (int) –

  • compi (int) –

  • volume (float) –

abstract set_dest_node_handle(neti, reai, nodei, pos)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • pos (Vec2) –

abstract set_dest_node_stoich(neti, reai, nodei, stoich)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • stoich (float) –

Return type

bool

abstract set_modifier_tip_style(neti, reai, style)[source]
Parameters
abstract set_node_border_alpha(neti, nodei, alpha)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • alpha (int) –

Return type

bool

abstract set_node_border_rgb(neti, nodei, color)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • color (Colour) –

Return type

bool

abstract set_node_border_width(neti, nodei, width)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • width (float) –

Return type

bool

abstract set_node_fill_alpha(neti, nodei, alpha)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • alpha (int) –

Return type

bool

abstract set_node_fill_rgb(neti, nodei, color)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • color (Colour) –

Return type

bool

abstract set_node_floating_status(neti, nodei, floatingStatus)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • floatingStatus (bool) –

abstract set_node_locked_status(neti, nodei, lockedNode)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • lockedNode (bool) –

abstract set_node_primitive_property(neti, nodei, primitive_index, prop_name, prop_value)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • primitive_index (int) –

  • prop_name (str) –

abstract set_node_shape_index(neti, nodei, shapei)[source]
Parameters
  • neti (int) –

  • nodei (int) –

  • shapei (int) –

abstract set_node_size(neti, nodei, size)[source]

Try to move the give node. TODO only accept node ID and new location

Parameters
  • neti (int) –

  • nodei (int) –

  • size (Vec2) –

Return type

bool

abstract set_reaction_bezier_curves(neti, reai, bezierCurves)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • bezierCurves (bool) –

Return type

Reaction

abstract set_reaction_center(neti, reai, center_pos)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • center_pos (Optional[Vec2]) –

abstract set_reaction_fill_alpha(neti, reai, alpha)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • alpha (int) –

Return type

bool

abstract set_reaction_fill_rgb(neti, reai, color)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • color (Colour) –

Return type

bool

abstract set_reaction_line_thickness(neti, reai, thickness)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • thickness (float) –

Return type

bool

abstract set_reaction_modifiers(neti, reai, modifiers)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • modifiers (List[int]) –

abstract set_reaction_ratelaw(neti, reai, ratelaw)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • ratelaw (str) –

Return type

bool

abstract set_src_node_handle(neti, reai, nodei, pos)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • pos (Vec2) –

abstract set_src_node_stoich(neti, reai, nodei, stoich)[source]
Parameters
  • neti (int) –

  • reai (int) –

  • nodei (int) –

  • stoich (float) –

Return type

bool

abstract undo()[source]

Try to undo last operation

Return type

bool

abstract update_view()[source]

Immediately update the view with using latest model.

exception rkviewer.mvc.IDNotFoundError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.IDRepeatError[source]

Bases: rkviewer.mvc.ModelError

class rkviewer.mvc.IView[source]

Bases: abc.ABC

The inteface class for a controller

The abc.ABC (Abstract Base Class) is used to enforce the MVC interface more strictly.

abstract bind_controller(controller)[source]

Bind the controller. This needs to be called after a controller is created and before any other method is called.

Parameters

controller (IController) –

abstract main_loop()[source]

Run the main loop. This is blocking right now. This may be modified to become non-blocking in the future if required.

abstract update_all(nodes, reactions, compartments)[source]

Update all the graph objects, and redraw everything at the end

exception rkviewer.mvc.JSONError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.ModelError[source]

Bases: Exception

Base class for other exceptions

exception rkviewer.mvc.NetIndexError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.NodeIndexError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.NodeNotFreeError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.ReactionIndexError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.StackEmptyError[source]

Bases: rkviewer.mvc.ModelError

exception rkviewer.mvc.StoichError[source]

Bases: rkviewer.mvc.ModelError

rkviewer.plugin_manage module

Classes for managing plugins for Canvas.

Note: This file imports stuff from rkviewer.plugin.classes, but usually rkviewer.plugin imports from rkviewer. Beware of circular dependency.

class rkviewer.plugin_manage.PluginDialog(parent, plugins)[source]

Bases: wx.

Parameters

plugins (List[Plugin]) –

class rkviewer.plugin_manage.PluginManager(parent_window, controller)[source]

Bases: object

Parameters
  • parent_window (Window) –

  • controller (IController) –

bind_error_callback(callback)[source]

Bind a dialog callback for when there is an error.

If an error occurs before such a callback is bound, it is only logged.

callbacks: Dict[rkviewer.plugin.classes.Plugin, Callable[], None]]
create_dialog(parent)[source]
get_plugins_by_category()[source]

Returns a dictionary that maps each category to the list of plugins.

Each plugin in the lists is a tuple (short_name, bitmap, callback). The

Return type

Dict[PluginCategory, List[Tuple[str, Callable[[], None], Optional[Bitmap]]]]

load_from(dir_path)[source]

Load plugins from the given directory. Returns False if the dir does not exist.

Parameters

dir_path (str) –

Return type

bool

make_command_callback(command)[source]
Parameters

command (CommandPlugin) –

Return type

Callable[[], None]

make_notify(handler_name)[source]

Make event notification function for plugin.

handler_name should be the name of a method defined by Plugin. This would then create a callback function that goes over each plugin and call that function. This callback should be bound to its associated event.

The handler function is called with the event itself as argument.

Parameters

handler_name (str) –

make_windowed_callback(windowed, parent)[source]
Parameters
  • windowed (WindowedPlugin) –

  • parent (Window) –

Return type

Callable[[], None]

plugins: List[rkviewer.plugin.classes.Plugin]
register_menu(menu)[source]
Parameters

menu (Menu) –

class rkviewer.plugin_manage.PluginPage(parent, plugin)[source]

Bases: wx.html.

Parameters
  • parent (Window) –

  • plugin (Plugin) –

rkviewer.utils module

Utility functions

class rkviewer.utils.ButtonGroup(callback)[source]

Bases: object

Class for keeping track of a group of buttons, where exactly one of them can be selected.

Callback

The callback function type called with ID of the selected button as argument.

Parameters

callback (Callable[[str], None]) –

AddButton(button, identifier)[source]

Add a button with the given identifier.

When this button is clicked, callback is called with the identifier.

Parameters
  • button (ToggleButton) –

  • identifier (Any) –

Callback

alias of Callable[[str], None]

rkviewer.utils.change_opacity(color, new_op)[source]
Parameters
  • color (Colour) –

  • new_op (int) –

rkviewer.utils.convert_position(fn)[source]

Decorator that converts the event position to one that is relative to the receiver.

rkviewer.utils.even_round(n)[source]

Round to the nearest even integer

Parameters

n (float) –

Return type

int

rkviewer.utils.gchain(*iterables)[source]
Parameters

iterables (Iterable[~T]) –

Return type

Iterable[Tuple[int, ~T]]

rkviewer.utils.get_local_path(relative_path)[source]

Get path relative to the executable, or the working dir if not bundled.

rkviewer.utils.int_round(n)[source]
Parameters

n (float) –

Return type

int

rkviewer.utils.no_rzeros(num, precision)[source]

Returns string of the num with the given precision, but with trailing zeros removed.

Parameters
  • num (float) –

  • precision (int) –

Return type

str

rkviewer.utils.on_msw()[source]

Returns whether we are running on Windows.

Return type

bool

rkviewer.utils.opacity_mul(color, fraction)[source]
Parameters
  • color (Colour) –

  • fraction (float) –

Return type

Colour

rkviewer.utils.pairwise(iterable)[source]

s -> (s0,s1), (s1,s2), (s2, s3), …

Parameters

iterable (Iterable) –

Return type

Iterable

rkviewer.utils.require_kwargs_on_init(cls)[source]

Force a dataclass’s init function to only work if called with keyword arguments. If parameters are not positional-only, a TypeError is thrown with a helpful message. This function may only be used on dataclasses. This works by wrapping the __init__ function and dynamically replacing it. Therefore, stacktraces for calls to the new __init__ might look a bit strange. Fear not though, all is well. Note: although this may be used as a decorator, this is not advised as IDEs will no longer suggest parameters in the constructor. Instead, this is the recommended usage:

from dataclasses import dataclass
@dataclass
class Foo:
    bar: str
require_kwargs_on_init(Foo)
Parameters

cls (Type[~_T]) –

Return type

Type[~_T]

rkviewer.utils.resource_path(relative_path)[source]

Get absolute path to resource, works for dev and PyInstaller.

rkviewer.utils.rgba_to_wx_colour(rgb, alpha)[source]

Given RGBA color, return wx.Colour.

Parameters
  • rgb (int) – RGB color in hex format.

  • alpha (float) – The opacity of the color, ranging from 0.0 to 1.0.

Return type

Colour

rkviewer.utils.start_file(abs_path)[source]
Parameters

abs_path (str) –

rkviewer.view module

The main RKView class and associated widgets.

class rkviewer.view.BottomBar(*args: Any, **kwargs: Any)[source]

Bases: wx.

CreateSlider()[source]
class rkviewer.view.EditPanel(parent, canvas, controller, **kw)[source]

Bases: wx.lib.agw.flatnotebook.

Panel that displays and allows editing of the details of a node.

Attributes

node_form: The actual form widget. This is at the same level as null_message. TODO null_message: The widget displayed in place of the form, when nothing is selected.

Parameters
OnCanvasDidUpdate(evt)[source]
OnCompartmentsDidMove(evt)[source]
OnDidResizeCompartments(evt)[source]
OnDidResizeNodes(evt)[source]
OnNodesDidMove(evt)[source]
OnSelectionDidUpdate(evt)[source]
class rkviewer.view.MainFrame(controller, **kw)[source]

Bases: wx.

The main frame.

Parameters

controller (IController) –

AddMenuItem(menu, text, help_text, callback, entries, key=None, id_=None)[source]
Parameters
  • menu (Menu) –

  • text (str) –

  • help_text (str) –

  • callback (Callable) –

  • entries (List) –

  • key (Optional[Tuple[Any, int]]) –

  • id_ (Optional[int]) –

Return type

MenuItem

CreateConfigDir(config_dir)[source]

Create the configuration directory if it does not already exist.

Parameters

config_dir (str) –

EditSettings()[source]

Open the preferences file for editing.

ExportAs(btype, type_name, wildcard)[source]

Export as the type given by btype (wx.BitmapType). btype is passed to SaveFile()

Parameters
  • type_name (str) –

  • wildcard (str) –

ExportNetwork()[source]
LoadFromJson()[source]
ManagePlugins(evt)[source]
NewNetwork()[source]
OnCloseExit(evt)[source]
OnShow(evt)[source]
OverrideAccelTable(widget)[source]

Set up functions to disable accelerator shortcuts for certain descendants of widgets.

This is to prevent accelerator shortcuts to be applied in unexpected situations, when something other than the canvas is in foucs. For example, if the user is editing the name of a node, they may use ctrl+Z to undo some text operation. However, since ctrl+Z is bound to the “undo last operation” action on canvas, it will be caught by the canvas instead. This prevents that by attaching a temporary, “null” accelerator table when a TextCtrl widget goes into focus.

PrintNetwork()[source]
ReloadSettings()[source]
SaveAsJson()[source]
SaveJson()[source]
ShowDefaultSettings()[source]
onAboutDlg(event)[source]
class rkviewer.view.MainPanel(parent, controller, manager)[source]

Bases: wx.

The main panel, which is the only child of the root Frame.

Parameters
ToggleEditPanel()[source]
class rkviewer.view.ModePanel(*args, toggle_callback, canvas, **kw)[source]

Bases: wx.

ModePanel at the left of the app.

Parameters

canvas (Canvas) –

AppendModeButton(label, mode, sizer)[source]
Parameters
  • label (str) –

  • mode (InputMode) –

  • sizer (Sizer) –

AppendNormalButton(label, callback, sizer, tooltip=None)[source]
Parameters
  • label (str) –

  • sizer (Sizer) –

  • tooltip (Optional[str]) –

AppendSeparator(sizer)[source]
Parameters

sizer (Sizer) –

class rkviewer.view.NetworkPrintout(img)[source]

Bases: wx.

Parameters

img (Image) –

OnPrintPage(pageNum)[source]
Parameters

pageNum (int) –

class rkviewer.view.RKView[source]

Bases: rkviewer.mvc.IView

Implementation of the view class.

bind_controller(controller)[source]

Bind the controller. This needs to be called after a controller is created and before any other method is called.

Parameters

controller (IController) –

init()[source]
main_loop()[source]

Run the main loop. This is blocking right now. This may be modified to become non-blocking in the future if required.

update_all(nodes, reactions, compartments)[source]

Update the list of nodes.

Note that RKView takes ownership of the list of nodes and may modify it.

Parameters
class rkviewer.view.TabbedToolbar(parent, controller, canvas, edit_panel_callback, manager, **kw)[source]

Bases: wx.lib.agw.flatnotebook.

Toolbar with multiple tabs, at the top of the app.

Parameters
AddPluginPages()[source]
class rkviewer.view.Toolbar(*args: Any, **kwargs: Any)[source]

Bases: wx.

AppendCenterSpacer()[source]

Append a center spacer. Tools added after this will be aligned to the right side.

AppendTool(label, callback, bitmap=None)[source]
Parameters
  • label (str) –

  • callback (Callable[[], Any]) –

class rkviewer.view.ToolbarItem(parent, label, bitmap, size)[source]

Bases: wx.

Parameters
  • label (str) –

  • bitmap (Bitmap) –

Module contents