Myokit IDE

The Myokit IDE is an easy interface to Myokit. Models can be created or imported from CellML and then modified, exported or used in simulations.

Implementation

The gui is built using Qt, implemented in Python via either PyQt or PySide.

class myokit.gui.ide.MyokitIDE(filename=None)

New GUI for editing .mmt files.

action_about()

Displays the about dialog.

action_check_units_strict()

Perform a unit check in strict mode.

action_check_units_tolerant()

Perform a unit check in tolerant mode.

action_clear_units()

Remove all units from expressions in this model.

action_comment()

Comments or uncomments the currently selected lines.

action_component_cycles()

Checks for interdependency-cycles amongst the components and displays them if found.

action_component_dependency_graph()

Displays a component dependency graph

action_copy()

Copy text in editor (when triggered from menu).

action_cut()

Cut text in editor (when triggered from menu).

action_explore()

Opens the explorer

action_export_model(name, ext=None, glob=None)

Exports the model to a file.

Arguments:

name

The exporter name.

ext

An optional default file extension to create a suggested filename.

glob

An optional filter for the file selection method.

action_export_runnable(name)

Exports the model and optionally the protocol to a directory.

Arguments:

name

The exporter name.

action_find()

Show or reactivate the find/replace bar.

action_format_protocol()

Reformat the protocol.

action_import_abf_protocol()

Imports a protocol from an abf (v2) file.

action_import_model(name, glob=None)

Imports a model definition (asking the user for the filename).

Arguments:

name

The name of the importer to use.

glob

A filter for file selection.

action_import_model_internal(importer, filename)

Imports a model file, with a known filename.

Arguments:

importer

The name of the importer to use.

filename

The file to import.

action_jump_to_error()

Jump to the last error in the model tab.

action_license()

Displays this program’s licensing information.

action_model_stats()

Gathers and displays some basic information about the current model.

action_new()

Create a new model, closing any current one

action_open()

Select and open an existing file.

action_open_recent()

Opens a recent file.

action_paste()

Paste text in editor (when triggered from menu).

action_preview_protocol()

Displays a preview of the current protocol.

action_redo()

Redoes the previously undone text edit operation.

action_run()

Runs the embedded script.

action_save()

Save the current file.

action_save_as()

Save the current file under a different name.

action_state_derivatives()

Evaluates all the state derivatives and displays the results. Numerical erorrs raised will be displayed.

action_state_derivatives2()

Evaluates all the state derivatives and displays the results. Numerical errors are ignored.

action_state_matrix()

Displays a state dependency matrix.

action_toggle_navigator()

Show or hide the model navigator.

action_trim_whitespace()

Trims any trailing whitespace from the current editor.

action_undo()

Undoes the previous text edit operation.

action_validate()

Validates the model or the protocol, depending on the editor tab.

action_variable_definition()

Jump to the variable pointed at by the caret.

action_variable_dependencies()

Finds the variable pointed at by the cursor in the model editor and displays all expressions required for its calculation.

action_variable_dependency_graph()

Displays a variable dependency graph

action_variable_evaluation()

Finds the variable pointed at by the cursor in the model editor and displays its calculation.

action_variable_graph()

Attempts to graph the variable pointed at by the cursor in the model editor.

action_variable_info()

Finds the variable pointed at by the cursor and displays its type and the line on which it is defined.

action_variable_users()

Finds the variable pointed at by the cursor in the model editor and displays all variables that depend on it.

action_view_model()

View the model tab.

action_view_protocol()

View the protocol tab.

action_view_script()

View the script tab.

add_recent_file(filename)

Adds the given filename to the list of recent files.

change_copy_model(enabled)

Qt slot: CopyAvailable state of model editor changed.

change_copy_protocol(enabled)

Qt slot: CopyAvailable state of protocol editor changed.

change_copy_script(enabled)

Qt slot: CopyAvailable state of script editor changed.

change_editor_tab(index)

Qt slot: Called when the editor tab is changed.

change_model()

Qt slot: Called whenever the model is changed.

change_model_timeout()

Called with a slight delay after a change to the model.

change_modified_model(have_changes)

Qt slot: Called when the model modified state is changed.

change_modified_protocol(have_changes)

Qt slot: Called when the protocol modified state is changed.

change_modified_script(have_changes)

Qt slot: Callend when the script modified state is changed.

change_protocol()

Qt slot: Called whenever the protocol is changed.

change_redo_model(enabled)

Qt slot: Redo state of model editor changed.

change_redo_protocol(enabled)

Qt slot: Redo state of protocol editor changed.

change_redo_script(enabled)

Qt slot: Redo state of script editor changed.

change_tool_visibility(widget, visible)

Qt slot: A tool panel (on the right-hand side) is toggled.

change_undo_model(enabled)

Qt slot: Undo state of model editor changed.

change_undo_protocol(enabled)

Qt slot: Undo state of protocol editor changed.

change_undo_script(enabled)

Qt slot: Undo state of script editor changed.

closeEvent(event=None)

Called when window is closed. To force a close (and trigger this function, call self.close())

close_explorer()

Closes the explorer, if any.

create_menu()

Creates this widget’s menu.

create_toolbar()

Creates the shared toolbar.

load_config()

Loads the user configuration from an ini file.

load_file(filename)

Loads a file into the IDE. Does not provide error handling.

model(force=False, console=False, errors_in_console=False)

Validates and returns the model.

If no model is specified in the model field None is returned. If parse errors occur, the value False is returned.

The argument force can be used to force a reparsing, even if no changes were made to the text.

If console is set to True the results of parsing will be written to the console. Similarly, the option errors_in_console allows errors - but no positive parse results - to be shown in the console.

navigator_item_changed(line)

Called whenever the navigator item is changed.

new_file()

Replaces the editor contents with a new file. Does not do any error handling.

prompt_save_changes(cancel=False)

Asks the user to save changes and does so if required.

Returns True if the action can continue, False if the action should halt. A “Cancel” option will be provided if cancel=True.

protocol(force=False, console=False, errors_in_console=False)

Validates the entered pacing protocol and returns it.

If no protocol is specified None will be returned. If the specified protocol has errors, the return value will be False.

If force is set to True the protocol will always be reparsed, even if no changes were made.

If console is set to True the results of parsing will be written to the console. Similarly, the option errors_in_console allows errors - but no positive parse results - to be shown in the console.

save_config()

Saves the user configuration to an ini file.

save_file(save_as=False)

Saves the current document. If no file name is known or save_as=True the user is asked for a filename.

Returns True if the save was succesful

selected_variable(model=None)

Returns the variable currently pointed at by the cursor in the model editor. If a selection is made only the left side is used.

If no variable is found None is returned. If a model error occurs False is returned

show_exception()

Displays the last exception.

update_navigator()

Updates the model navigator contents.

update_recent_files_menu()

Updates the recent files menu.

update_window_title()

Sets this window’s title based on the current state.

class myokit.gui.ide.Console(parent=None)

Console window used to write plain text output to in the IDE. Shows model parsing states and output of running explorations / scripts.

Extends: QtWidgets.QPlainTextEdit

clear()

Clears the console.

flush()

Ensures output if written to the screen.

write(text=None)

Writes text to the console, prefixes a timestamp.

class myokit.gui.ide.ModelNavigator(parent=None)

Model navigator window used to jump to different model components.

current_item_changed(item, previous_item)

Called if the navigator item is changed.

set_positions(positions)

Updates the component list

class myokit.gui.ide.TabbedToolBar(parent=None)

Tab widget with tools that are initially hidden, but can be shown upon request, and hidden using the “close” button.

add(widget, name)

Add a tab to this toolbar.

keyPressEvent(event)

Qt event: A key-press reaches the widget.

toggle(widget, new_status=None)

Toggles the visibility of the given widget (which must previously have been added with add()), and returns its updated visibility status.

An explicit visibility status can be set with new_status.

myokit.gui.ide.icon()