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 PyQt4 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_explore()

Opens the explorer

action_export_model(name, glob=None)

Exports the model to a file.

Arguments:

name
The exporter name
filter
A 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()

Display a find/replace dialog for the current editor

action_import_abf_protocol()

Imports a protocol from an abf (v2) file.

action_import_cellml()

Imports a CellML model

action_jump_to_error()

Jump tot 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_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_show_or_hide_navigator()

Show or hide the model navigator.

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_trim_whitespace()

Trims any trailing whitespace from the current editor.

action_undo()

Undoes the previous text edit operation.

action_validate()

Validates the model and, if the model is valid, the protocol.

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_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_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(item, previous_item)

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.

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)

Extends: QtWidgets.QPlainTextEdit

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

clear()

Clears the console.

flush()

Ensures output if written to the screen.

write(text=None)

Writes text to the console, prefixes a timestamp.

myokit.gui.ide.icon()