myokit 1.34.0__py3-none-any.whl → 1.35.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- myokit/__init__.py +5 -23
- myokit/__main__.py +70 -117
- myokit/_aux.py +5 -8
- myokit/_config.py +22 -31
- myokit/_datablock.py +26 -70
- myokit/_datalog.py +23 -53
- myokit/_err.py +13 -15
- myokit/_expressions.py +35 -55
- myokit/_io.py +5 -22
- myokit/_model_api.py +34 -47
- myokit/_myokit_version.py +1 -5
- myokit/_parsing.py +17 -25
- myokit/_progress.py +4 -7
- myokit/_protocol.py +6 -9
- myokit/_sim/__init__.py +7 -24
- myokit/_sim/cable.c +1 -3
- myokit/_sim/cable.py +3 -5
- myokit/_sim/cmodel.h +1 -3
- myokit/_sim/cmodel.py +1 -4
- myokit/_sim/compiler.py +1 -4
- myokit/_sim/cvodessim.c +1 -4
- myokit/_sim/cvodessim.py +1 -4
- myokit/_sim/fiber_tissue.c +2 -6
- myokit/_sim/fiber_tissue.py +3 -5
- myokit/_sim/jacobian.py +6 -7
- myokit/_sim/mcl.h +51 -53
- myokit/_sim/opencl.py +9 -22
- myokit/_sim/openclsim.c +2 -6
- myokit/_sim/openclsim.py +6 -6
- myokit/_sim/pacing.h +2 -6
- myokit/_sim/rhs.c +3 -10
- myokit/_sim/rhs.py +4 -13
- myokit/_sim/sundials.py +1 -4
- myokit/_system.py +10 -16
- myokit/_unit.py +3 -12
- myokit/float.py +0 -3
- myokit/formats/__init__.py +8 -10
- myokit/formats/ansic/__init__.py +0 -3
- myokit/formats/ansic/_ewriter.py +2 -4
- myokit/formats/ansic/_exporter.py +0 -3
- myokit/formats/axon/__init__.py +1 -3
- myokit/formats/axon/_abf.py +12 -15
- myokit/formats/axon/_atf.py +5 -6
- myokit/formats/axon/_importer.py +0 -3
- myokit/formats/cellml/__init__.py +0 -3
- myokit/formats/cellml/_ewriter.py +3 -6
- myokit/formats/cellml/_exporter.py +3 -6
- myokit/formats/cellml/_importer.py +1 -4
- myokit/formats/cellml/v1/__init__.py +0 -4
- myokit/formats/cellml/v1/_api.py +7 -10
- myokit/formats/cellml/v1/_parser.py +2 -5
- myokit/formats/cellml/v1/_writer.py +2 -11
- myokit/formats/cellml/v2/__init__.py +0 -3
- myokit/formats/cellml/v2/_api.py +7 -16
- myokit/formats/cellml/v2/_parser.py +2 -5
- myokit/formats/cellml/v2/_writer.py +1 -4
- myokit/formats/channelml/__init__.py +0 -3
- myokit/formats/channelml/_importer.py +4 -14
- myokit/formats/cpp/__init__.py +1 -3
- myokit/formats/cpp/_ewriter.py +0 -3
- myokit/formats/cuda/__init__.py +0 -3
- myokit/formats/cuda/_ewriter.py +2 -4
- myokit/formats/cuda/_exporter.py +0 -3
- myokit/formats/easyml/__init__.py +0 -3
- myokit/formats/easyml/_ewriter.py +9 -11
- myokit/formats/easyml/_exporter.py +0 -3
- myokit/formats/html/__init__.py +0 -3
- myokit/formats/html/_exporter.py +0 -3
- myokit/formats/html/_flatten.py +5 -21
- myokit/formats/latex/__init__.py +0 -3
- myokit/formats/latex/_ewriter.py +1 -4
- myokit/formats/latex/_exporter.py +3 -5
- myokit/formats/mathml/__init__.py +0 -3
- myokit/formats/mathml/_ewriter.py +2 -11
- myokit/formats/mathml/_parser.py +3 -5
- myokit/formats/matlab/__init__.py +0 -3
- myokit/formats/matlab/_ewriter.py +1 -4
- myokit/formats/matlab/_exporter.py +0 -3
- myokit/formats/opencl/__init__.py +0 -3
- myokit/formats/opencl/_ewriter.py +2 -4
- myokit/formats/opencl/_exporter.py +0 -3
- myokit/formats/python/__init__.py +0 -3
- myokit/formats/python/_ewriter.py +2 -5
- myokit/formats/python/_exporter.py +0 -3
- myokit/formats/python/template/sim.py +10 -10
- myokit/formats/sbml/__init__.py +0 -3
- myokit/formats/sbml/_api.py +17 -11
- myokit/formats/sbml/_importer.py +1 -4
- myokit/formats/sbml/_parser.py +2 -5
- myokit/formats/stan/__init__.py +0 -3
- myokit/formats/stan/_ewriter.py +2 -4
- myokit/formats/stan/_exporter.py +1 -4
- myokit/formats/sympy/__init__.py +0 -3
- myokit/formats/sympy/_ereader.py +1 -4
- myokit/formats/sympy/_ewriter.py +2 -5
- myokit/formats/wcp/__init__.py +0 -3
- myokit/formats/wcp/_wcp.py +1 -7
- myokit/formats/xml/__init__.py +0 -3
- myokit/formats/xml/_exporter.py +0 -3
- myokit/formats/xml/_split.py +0 -3
- myokit/gui/__init__.py +75 -247
- myokit/gui/datablock_viewer.py +100 -83
- myokit/gui/datalog_viewer.py +32 -44
- myokit/gui/explorer.py +15 -21
- myokit/gui/ide.py +105 -125
- myokit/gui/progress.py +9 -9
- myokit/gui/source.py +405 -374
- myokit/gui/vargrapher.py +2 -12
- myokit/lib/deps.py +7 -8
- myokit/lib/guess.py +1 -2
- myokit/lib/hh.py +5 -7
- myokit/lib/markov.py +9 -11
- myokit/lib/multi.py +1 -3
- myokit/lib/plots.py +1 -3
- myokit/pacing.py +0 -3
- myokit/pype.py +7 -18
- myokit/tests/__init__.py +3 -6
- myokit/tests/ansic_event_based_pacing.py +1 -4
- myokit/tests/ansic_fixed_form_pacing.py +1 -4
- myokit/tests/test_aux.py +9 -23
- myokit/tests/test_cellml_v1_api.py +1 -16
- myokit/tests/test_cellml_v1_parser.py +0 -15
- myokit/tests/test_cellml_v1_writer.py +0 -9
- myokit/tests/test_cellml_v2_api.py +1 -16
- myokit/tests/test_cellml_v2_parser.py +0 -15
- myokit/tests/test_cellml_v2_writer.py +0 -9
- myokit/tests/test_cmodel.py +0 -9
- myokit/tests/test_compiler_detection.py +1 -11
- myokit/tests/test_component.py +0 -10
- myokit/tests/test_config.py +33 -66
- myokit/tests/test_datablock.py +1 -9
- myokit/tests/test_datalog.py +4 -21
- myokit/tests/test_dependency_checking.py +8 -23
- myokit/tests/test_expressions.py +0 -9
- myokit/tests/test_float.py +1 -5
- myokit/tests/test_formats.py +0 -9
- myokit/tests/test_formats_axon.py +1 -9
- myokit/tests/test_formats_cellml.py +0 -15
- myokit/tests/test_formats_channelml.py +0 -15
- myokit/tests/test_formats_easyml.py +0 -14
- myokit/tests/test_formats_exporters.py +1 -16
- myokit/tests/test_formats_expression_writers.py +1 -17
- myokit/tests/test_formats_html.py +0 -3
- myokit/tests/test_formats_importers.py +1 -16
- myokit/tests/test_formats_mathml_content.py +0 -9
- myokit/tests/test_formats_mathml_presentation.py +0 -9
- myokit/tests/test_formats_opencl.py +0 -10
- myokit/tests/test_formats_sbml.py +0 -15
- myokit/tests/test_formats_sympy.py +0 -9
- myokit/tests/test_formats_wcp.py +1 -3
- myokit/tests/test_io.py +6 -14
- myokit/tests/test_jacobian_calculator.py +1 -9
- myokit/tests/test_jacobian_tracer.py +0 -9
- myokit/tests/test_lib_deps.py +0 -9
- myokit/tests/test_lib_guess.py +0 -9
- myokit/tests/test_lib_hh.py +1 -9
- myokit/tests/test_lib_markov.py +1 -9
- myokit/tests/test_lib_multi.py +0 -9
- myokit/tests/test_lib_plots.py +0 -3
- myokit/tests/test_meta.py +0 -3
- myokit/tests/test_model.py +0 -10
- myokit/tests/test_model_building.py +2 -17
- myokit/tests/test_opencl_info.py +5 -14
- myokit/tests/test_pacing_factory.py +0 -3
- myokit/tests/test_pacing_system_c.py +0 -9
- myokit/tests/test_pacing_system_py.py +0 -9
- myokit/tests/test_parsing.py +5 -20
- myokit/tests/test_progress_reporters.py +0 -3
- myokit/tests/test_protocol.py +0 -9
- myokit/tests/test_protocol_floating_point.py +0 -9
- myokit/tests/test_protocol_time_series.py +0 -10
- myokit/tests/test_pype.py +0 -9
- myokit/tests/test_quantity.py +0 -9
- myokit/tests/test_rhs_benchmarker.py +1 -9
- myokit/tests/test_sbml_api.py +0 -15
- myokit/tests/test_sbml_parser.py +0 -15
- myokit/tests/test_simulation_1d.py +1 -10
- myokit/tests/test_simulation_cvodes.py +8 -16
- myokit/tests/test_simulation_cvodes_from_disk.py +0 -3
- myokit/tests/test_simulation_fiber_tissue.py +1 -10
- myokit/tests/test_simulation_log_interval.py +0 -9
- myokit/tests/test_simulation_opencl.py +1 -10
- myokit/tests/test_simulation_opencl_log_interval.py +1 -3
- myokit/tests/test_simulation_opencl_vs_cvode.py +1 -10
- myokit/tests/test_simulation_opencl_vs_sim1d.py +1 -10
- myokit/tests/test_system_info.py +1 -11
- myokit/tests/test_tools.py +0 -9
- myokit/tests/test_unit.py +0 -9
- myokit/tests/test_user_functions.py +0 -10
- myokit/tests/test_variable.py +0 -10
- myokit/tools.py +5 -21
- myokit/units.py +0 -3
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/METADATA +7 -7
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/RECORD +198 -200
- myokit/_exec_new.py +0 -15
- myokit/_exec_old.py +0 -15
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/LICENSE.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/WHEEL +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/entry_points.txt +0 -0
- {myokit-1.34.0.dist-info → myokit-1.35.0.dist-info}/top_level.txt +0 -0
myokit/gui/ide.py
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
# This file is part of Myokit.
|
|
6
6
|
# See http://myokit.org for copyright, sharing, and licensing details.
|
|
7
7
|
#
|
|
8
|
-
|
|
9
|
-
from __future__ import print_function, unicode_literals
|
|
10
|
-
|
|
11
|
-
# Standard library imports
|
|
8
|
+
import configparser
|
|
12
9
|
import gc
|
|
13
10
|
import os
|
|
14
11
|
import sys
|
|
@@ -16,17 +13,14 @@ import textwrap
|
|
|
16
13
|
import traceback
|
|
17
14
|
import warnings
|
|
18
15
|
|
|
19
|
-
# Myokit
|
|
20
16
|
import myokit
|
|
21
17
|
import myokit.formats
|
|
18
|
+
import myokit.gui
|
|
22
19
|
import myokit.lib.deps
|
|
23
20
|
import myokit.lib.guess
|
|
24
21
|
|
|
25
|
-
# Qt imports
|
|
26
22
|
from myokit.gui import QtWidgets, QtGui, QtCore, Qt
|
|
27
23
|
|
|
28
|
-
# GUI components
|
|
29
|
-
import myokit.gui
|
|
30
24
|
from . import source
|
|
31
25
|
from . import explorer
|
|
32
26
|
from . import progress
|
|
@@ -37,12 +31,6 @@ from . import vargrapher
|
|
|
37
31
|
import matplotlib
|
|
38
32
|
matplotlib.interactive(True) # Allows plt.show()
|
|
39
33
|
|
|
40
|
-
# ConfigParser in Python 2 and 3
|
|
41
|
-
try:
|
|
42
|
-
import ConfigParser as configparser
|
|
43
|
-
except ImportError:
|
|
44
|
-
import configparser
|
|
45
|
-
|
|
46
34
|
|
|
47
35
|
# Application title
|
|
48
36
|
TITLE = 'Myokit IDE'
|
|
@@ -110,7 +98,11 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
110
98
|
New GUI for editing ``.mmt`` files.
|
|
111
99
|
"""
|
|
112
100
|
def __init__(self, filename=None):
|
|
113
|
-
super(
|
|
101
|
+
super().__init__()
|
|
102
|
+
|
|
103
|
+
# Regular expression for navigator
|
|
104
|
+
self._nav_query = QtCore.QRegularExpression(
|
|
105
|
+
r'^\[[a-zA-Z]{1}[a-zA-Z0-9_]*\]')
|
|
114
106
|
|
|
115
107
|
# Set application icon
|
|
116
108
|
self.setWindowIcon(icon())
|
|
@@ -119,7 +111,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
119
111
|
self.resize(950, 720)
|
|
120
112
|
self.setMinimumSize(600, 440)
|
|
121
113
|
qr = self.frameGeometry()
|
|
122
|
-
cp =
|
|
114
|
+
cp = QtGui.QGuiApplication.primaryScreen().availableGeometry().center()
|
|
123
115
|
qr.moveCenter(cp)
|
|
124
116
|
self.move(qr.topLeft())
|
|
125
117
|
|
|
@@ -184,7 +176,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
184
176
|
self._script_tools.add(self._script_search, 'Find/Replace')
|
|
185
177
|
|
|
186
178
|
# Create editor tabs
|
|
187
|
-
self._model_tab = QtWidgets.QSplitter(Qt.Horizontal)
|
|
179
|
+
self._model_tab = QtWidgets.QSplitter(Qt.Orientation.Horizontal)
|
|
188
180
|
self._model_tab.editor = self._model_editor
|
|
189
181
|
self._model_tab.search = self._model_search
|
|
190
182
|
self._model_tab.addWidget(self._model_editor)
|
|
@@ -193,7 +185,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
193
185
|
self._model_tab.setCollapsible(0, False)
|
|
194
186
|
self._model_tab.setCollapsible(1, False)
|
|
195
187
|
|
|
196
|
-
self._protocol_tab = QtWidgets.QSplitter(Qt.Horizontal)
|
|
188
|
+
self._protocol_tab = QtWidgets.QSplitter(Qt.Orientation.Horizontal)
|
|
197
189
|
self._protocol_tab.editor = self._protocol_editor
|
|
198
190
|
self._protocol_tab.search = self._protocol_search
|
|
199
191
|
self._protocol_tab.addWidget(self._protocol_editor)
|
|
@@ -202,7 +194,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
202
194
|
self._protocol_tab.setCollapsible(0, False)
|
|
203
195
|
self._protocol_tab.setCollapsible(1, False)
|
|
204
196
|
|
|
205
|
-
self._script_tab = QtWidgets.QSplitter(Qt.Horizontal)
|
|
197
|
+
self._script_tab = QtWidgets.QSplitter(Qt.Orientation.Horizontal)
|
|
206
198
|
self._script_tab.editor = self._script_editor
|
|
207
199
|
self._script_tab.search = self._script_search
|
|
208
200
|
self._script_tab.addWidget(self._script_editor)
|
|
@@ -245,7 +237,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
245
237
|
self._console.write('Loading Myokit IDE')
|
|
246
238
|
|
|
247
239
|
# Create central layout: vertical splitter
|
|
248
|
-
self._central_splitter = QtWidgets.QSplitter(Qt.Vertical)
|
|
240
|
+
self._central_splitter = QtWidgets.QSplitter(Qt.Orientation.Vertical)
|
|
249
241
|
self._central_splitter.addWidget(self._editor_tabs)
|
|
250
242
|
self._central_splitter.addWidget(self._console)
|
|
251
243
|
self._central_splitter.setSizes([580, 120])
|
|
@@ -381,10 +373,10 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
381
373
|
try:
|
|
382
374
|
# Ask are you sure?
|
|
383
375
|
msg = 'Remove all units from expressions in model?'
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if reply ==
|
|
376
|
+
sb = QtWidgets.QMessageBox.StandardButton
|
|
377
|
+
reply = QtWidgets.QMessageBox.question(
|
|
378
|
+
self, TITLE, msg, sb.Yes | sb.No)
|
|
379
|
+
if reply == sb.No:
|
|
388
380
|
return
|
|
389
381
|
# Strip units
|
|
390
382
|
# Note: lines are used in error handling!
|
|
@@ -466,7 +458,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
466
458
|
# Simulation creation method
|
|
467
459
|
def sim():
|
|
468
460
|
QtWidgets.QApplication.processEvents(
|
|
469
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
461
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
470
462
|
try:
|
|
471
463
|
# Get model and protocol
|
|
472
464
|
m = self.model(errors_in_console=True)
|
|
@@ -475,12 +467,12 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
475
467
|
elif m is None:
|
|
476
468
|
return 'Empty model definition'
|
|
477
469
|
QtWidgets.QApplication.processEvents(
|
|
478
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
470
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
479
471
|
p = self.protocol(errors_in_console=True)
|
|
480
472
|
if p is False:
|
|
481
473
|
return 'Errors in protocol'
|
|
482
474
|
QtWidgets.QApplication.processEvents(
|
|
483
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
475
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
484
476
|
# Create and return simulation
|
|
485
477
|
self.statusBar().showMessage('Creating simulation...')
|
|
486
478
|
return m, p, myokit.Simulation(m, p)
|
|
@@ -1006,12 +998,12 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1006
998
|
#self.setEnabled(False)
|
|
1007
999
|
self._console.write('Running embedded script.')
|
|
1008
1000
|
QtWidgets.QApplication.setOverrideCursor(
|
|
1009
|
-
QtGui.QCursor(Qt.WaitCursor))
|
|
1001
|
+
QtGui.QCursor(Qt.CursorShape.WaitCursor))
|
|
1010
1002
|
# Create progress bar
|
|
1011
1003
|
pbar = progress.ProgressBar(self, 'Running embedded script')
|
|
1012
1004
|
pbar.show()
|
|
1013
1005
|
QtWidgets.QApplication.processEvents(
|
|
1014
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
1006
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
1015
1007
|
# Get model and protocol
|
|
1016
1008
|
m = self.model(errors_in_console=True)
|
|
1017
1009
|
if m is False:
|
|
@@ -1020,16 +1012,16 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1020
1012
|
if p is False:
|
|
1021
1013
|
return
|
|
1022
1014
|
QtWidgets.QApplication.processEvents(
|
|
1023
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
1015
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
1024
1016
|
# Clone model & protocol: the script may modify them!
|
|
1025
1017
|
if m:
|
|
1026
1018
|
m = m.clone()
|
|
1027
1019
|
QtWidgets.QApplication.processEvents(
|
|
1028
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
1020
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
1029
1021
|
if p:
|
|
1030
1022
|
p = p.clone()
|
|
1031
1023
|
QtWidgets.QApplication.processEvents(
|
|
1032
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
1024
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
1033
1025
|
# Get embedded script
|
|
1034
1026
|
x = self._script_editor.get_text()
|
|
1035
1027
|
# Run
|
|
@@ -1051,7 +1043,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1051
1043
|
self._console.write(traceback.format_exc())
|
|
1052
1044
|
finally:
|
|
1053
1045
|
QtWidgets.QApplication.processEvents(
|
|
1054
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
1046
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|
|
1055
1047
|
# Hide progress bar
|
|
1056
1048
|
if pbar is not None:
|
|
1057
1049
|
pbar.close()
|
|
@@ -1546,8 +1538,10 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1546
1538
|
if event:
|
|
1547
1539
|
event.ignore()
|
|
1548
1540
|
return
|
|
1541
|
+
|
|
1549
1542
|
# Close all windows, including matplotlib plots
|
|
1550
|
-
QtWidgets.
|
|
1543
|
+
QtWidgets.QApplication.instance().closeAllWindows()
|
|
1544
|
+
|
|
1551
1545
|
# Accept event, closing this window
|
|
1552
1546
|
if event:
|
|
1553
1547
|
event.accept()
|
|
@@ -1570,14 +1564,14 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1570
1564
|
# File menu
|
|
1571
1565
|
self._menu_file = self._menu.addMenu('&File')
|
|
1572
1566
|
# File > New
|
|
1573
|
-
self._tool_new =
|
|
1567
|
+
self._tool_new = QtGui.QAction('&New', self)
|
|
1574
1568
|
self._tool_new.setShortcut('Ctrl+N')
|
|
1575
1569
|
self._tool_new.setStatusTip('Create a new mmt file.')
|
|
1576
1570
|
self._tool_new.setIcon(myokit.gui.icon('document-new'))
|
|
1577
1571
|
self._tool_new.triggered.connect(self.action_new)
|
|
1578
1572
|
self._menu_file.addAction(self._tool_new)
|
|
1579
1573
|
# File > Open
|
|
1580
|
-
self._tool_open =
|
|
1574
|
+
self._tool_open = QtGui.QAction('&Open', self)
|
|
1581
1575
|
self._tool_open.setShortcut('Ctrl+O')
|
|
1582
1576
|
self._tool_open.setStatusTip('Open an existing mmt file.')
|
|
1583
1577
|
self._tool_open.setIcon(myokit.gui.icon('document-open'))
|
|
@@ -1586,7 +1580,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1586
1580
|
# File > ----
|
|
1587
1581
|
self._menu_file.addSeparator()
|
|
1588
1582
|
# File > Save
|
|
1589
|
-
self._tool_save =
|
|
1583
|
+
self._tool_save = QtGui.QAction('&Save', self)
|
|
1590
1584
|
self._tool_save.setShortcut('Ctrl+S')
|
|
1591
1585
|
self._tool_save.setStatusTip('Save the current file')
|
|
1592
1586
|
self._tool_save.setIcon(myokit.gui.icon('document-save'))
|
|
@@ -1594,7 +1588,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1594
1588
|
self._tool_save.setEnabled(False)
|
|
1595
1589
|
self._menu_file.addAction(self._tool_save)
|
|
1596
1590
|
# File > Save as
|
|
1597
|
-
self._tool_save_as =
|
|
1591
|
+
self._tool_save_as = QtGui.QAction('Save &as', self)
|
|
1598
1592
|
self._tool_save_as.setShortcut('Ctrl+Shift+S')
|
|
1599
1593
|
self._tool_save_as.setStatusTip(
|
|
1600
1594
|
'Save the current file under a different name.')
|
|
@@ -1605,14 +1599,14 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1605
1599
|
# File > Recent files
|
|
1606
1600
|
self._recent_file_tools = []
|
|
1607
1601
|
for i in range(N_RECENT_FILES):
|
|
1608
|
-
tool =
|
|
1602
|
+
tool = QtGui.QAction(self, visible=False)
|
|
1609
1603
|
tool.triggered.connect(self.action_open_recent)
|
|
1610
1604
|
self._recent_file_tools.append(tool)
|
|
1611
1605
|
self._menu_file.addAction(tool)
|
|
1612
1606
|
# File > ----
|
|
1613
1607
|
self._menu_file.addSeparator()
|
|
1614
1608
|
# File > Quit
|
|
1615
|
-
self._tool_exit =
|
|
1609
|
+
self._tool_exit = QtGui.QAction('&Quit', self)
|
|
1616
1610
|
self._tool_exit.setShortcut('Ctrl+Q')
|
|
1617
1611
|
self._tool_exit.setStatusTip('Exit application.')
|
|
1618
1612
|
self._tool_exit.triggered.connect(self.close)
|
|
@@ -1622,7 +1616,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1622
1616
|
#
|
|
1623
1617
|
self._menu_edit = self._menu.addMenu('&Edit')
|
|
1624
1618
|
# Edit > Undo
|
|
1625
|
-
self._tool_undo =
|
|
1619
|
+
self._tool_undo = QtGui.QAction('&Undo', self)
|
|
1626
1620
|
self._tool_undo.setShortcut('Ctrl+Z')
|
|
1627
1621
|
self._tool_undo.setStatusTip('Undo the last edit.')
|
|
1628
1622
|
self._tool_undo.setIcon(myokit.gui.icon('edit-undo'))
|
|
@@ -1630,7 +1624,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1630
1624
|
self._tool_undo.setEnabled(False)
|
|
1631
1625
|
self._menu_edit.addAction(self._tool_undo)
|
|
1632
1626
|
# Edit > Redo
|
|
1633
|
-
self._tool_redo =
|
|
1627
|
+
self._tool_redo = QtGui.QAction('&Redo', self)
|
|
1634
1628
|
self._tool_redo.setShortcut('Ctrl+Shift+Z')
|
|
1635
1629
|
self._tool_redo.setStatusTip('Redo the last undone edit.')
|
|
1636
1630
|
self._tool_redo.setIcon(myokit.gui.icon('edit-redo'))
|
|
@@ -1640,7 +1634,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1640
1634
|
# Edit > ----
|
|
1641
1635
|
self._menu_edit.addSeparator()
|
|
1642
1636
|
# Edit > Cut
|
|
1643
|
-
self._tool_cut =
|
|
1637
|
+
self._tool_cut = QtGui.QAction('&Cut', self)
|
|
1644
1638
|
self._tool_cut.setShortcut('Ctrl+X')
|
|
1645
1639
|
self._tool_cut.setStatusTip(
|
|
1646
1640
|
'Cut the selected text and copy it to the clipboard.')
|
|
@@ -1649,7 +1643,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1649
1643
|
self._tool_cut.setEnabled(False)
|
|
1650
1644
|
self._menu_edit.addAction(self._tool_cut)
|
|
1651
1645
|
# Edit > Copy
|
|
1652
|
-
self._tool_copy =
|
|
1646
|
+
self._tool_copy = QtGui.QAction('&Copy', self)
|
|
1653
1647
|
self._tool_copy.setShortcut('Ctrl+C')
|
|
1654
1648
|
self._tool_copy.setStatusTip(
|
|
1655
1649
|
'Copy the selected text to the clipboard.')
|
|
@@ -1658,7 +1652,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1658
1652
|
self._tool_copy.setEnabled(False)
|
|
1659
1653
|
self._menu_edit.addAction(self._tool_copy)
|
|
1660
1654
|
# Edit > Paste
|
|
1661
|
-
self._tool_paste =
|
|
1655
|
+
self._tool_paste = QtGui.QAction('&Paste', self)
|
|
1662
1656
|
self._tool_paste.setShortcut('Ctrl+V')
|
|
1663
1657
|
self._tool_paste.setStatusTip(
|
|
1664
1658
|
'Paste text from the clipboard into the editor.')
|
|
@@ -1668,7 +1662,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1668
1662
|
# Edit > ----
|
|
1669
1663
|
self._menu_edit.addSeparator()
|
|
1670
1664
|
# Edit > Find and replace
|
|
1671
|
-
self._tool_find =
|
|
1665
|
+
self._tool_find = QtGui.QAction('&Find and replace', self)
|
|
1672
1666
|
self._tool_find.setShortcut('Ctrl+F')
|
|
1673
1667
|
self._tool_find.setStatusTip('Find and/or replace some text.')
|
|
1674
1668
|
self._tool_find.setIcon(myokit.gui.icon('edit-find'))
|
|
@@ -1677,8 +1671,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1677
1671
|
# Edit > ----
|
|
1678
1672
|
self._menu_edit.addSeparator()
|
|
1679
1673
|
# Edit > Format protocol
|
|
1680
|
-
self._tool_format_protocol =
|
|
1681
|
-
'Format protocol', self)
|
|
1674
|
+
self._tool_format_protocol = QtGui.QAction('Format protocol', self)
|
|
1682
1675
|
self._tool_format_protocol.setStatusTip(
|
|
1683
1676
|
'Standardise the formatting of the protocol section.')
|
|
1684
1677
|
self._tool_format_protocol.triggered.connect(
|
|
@@ -1688,7 +1681,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1688
1681
|
# Edit > ----
|
|
1689
1682
|
self._menu_edit.addSeparator()
|
|
1690
1683
|
# Edit > Comment or uncomment
|
|
1691
|
-
self._tool_comment =
|
|
1684
|
+
self._tool_comment = QtGui.QAction(
|
|
1692
1685
|
'&Comment/uncomment selected lines', self)
|
|
1693
1686
|
self._tool_comment.setShortcut('Ctrl+;')
|
|
1694
1687
|
self._tool_comment.setStatusTip(
|
|
@@ -1696,7 +1689,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1696
1689
|
self._tool_comment.triggered.connect(self.action_comment)
|
|
1697
1690
|
self._menu_edit.addAction(self._tool_comment)
|
|
1698
1691
|
# Edit > Remove units from expressions
|
|
1699
|
-
self._tool_remove_units =
|
|
1692
|
+
self._tool_remove_units = QtGui.QAction(
|
|
1700
1693
|
'Remove units from &expressions', self)
|
|
1701
1694
|
self._tool_remove_units.setStatusTip(
|
|
1702
1695
|
'Remove all units inside expressions.')
|
|
@@ -1704,7 +1697,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1704
1697
|
self._menu_edit.addAction(self._tool_remove_units)
|
|
1705
1698
|
self._model_widgets.append(self._tool_remove_units)
|
|
1706
1699
|
# Edit > Trim whitespace
|
|
1707
|
-
self._tool_trim_whitespace =
|
|
1700
|
+
self._tool_trim_whitespace = QtGui.QAction(
|
|
1708
1701
|
'Trim trailing &whitespace', self)
|
|
1709
1702
|
self._tool_trim_whitespace.setStatusTip(
|
|
1710
1703
|
'Remove trailing whitespace from each line.')
|
|
@@ -1716,14 +1709,13 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1716
1709
|
#
|
|
1717
1710
|
self._menu_view = self._menu.addMenu('&View')
|
|
1718
1711
|
# View > View model definition
|
|
1719
|
-
self._tool_view_model =
|
|
1720
|
-
'View &model definition', self)
|
|
1712
|
+
self._tool_view_model = QtGui.QAction('View &model definition', self)
|
|
1721
1713
|
self._tool_view_model.setShortcut('Alt+1')
|
|
1722
1714
|
self._tool_view_model.setStatusTip('View the model definition tab')
|
|
1723
1715
|
self._tool_view_model.triggered.connect(self.action_view_model)
|
|
1724
1716
|
self._menu_view.addAction(self._tool_view_model)
|
|
1725
1717
|
# View > View protocol definition
|
|
1726
|
-
self._tool_view_protocol =
|
|
1718
|
+
self._tool_view_protocol = QtGui.QAction(
|
|
1727
1719
|
'View &protocol definition', self)
|
|
1728
1720
|
self._tool_view_protocol.setShortcut('Alt+2')
|
|
1729
1721
|
self._tool_view_protocol.setStatusTip(
|
|
@@ -1731,8 +1723,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1731
1723
|
self._tool_view_protocol.triggered.connect(self.action_view_protocol)
|
|
1732
1724
|
self._menu_view.addAction(self._tool_view_protocol)
|
|
1733
1725
|
# View > View embedded script
|
|
1734
|
-
self._tool_view_script =
|
|
1735
|
-
'View embedded &script', self)
|
|
1726
|
+
self._tool_view_script = QtGui.QAction('View embedded &script', self)
|
|
1736
1727
|
self._tool_view_script.setShortcut('Alt+3')
|
|
1737
1728
|
self._tool_view_script.setStatusTip('View the embedded script tab')
|
|
1738
1729
|
self._tool_view_script.triggered.connect(self.action_view_script)
|
|
@@ -1740,7 +1731,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1740
1731
|
# View > ----
|
|
1741
1732
|
self._menu_view.addSeparator()
|
|
1742
1733
|
# View > Show model components (navigator)
|
|
1743
|
-
self._tool_view_navigator =
|
|
1734
|
+
self._tool_view_navigator = QtGui.QAction(
|
|
1744
1735
|
'Show model &components', self)
|
|
1745
1736
|
self._tool_view_navigator.setCheckable(True)
|
|
1746
1737
|
self._tool_view_navigator.setStatusTip(
|
|
@@ -1752,8 +1743,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1752
1743
|
# View > ----
|
|
1753
1744
|
self._menu_view.addSeparator()
|
|
1754
1745
|
# View > Preview protocol
|
|
1755
|
-
self._tool_preview_protocol =
|
|
1756
|
-
'&Preview protocol', self)
|
|
1746
|
+
self._tool_preview_protocol = QtGui.QAction('&Preview protocol', self)
|
|
1757
1747
|
self._tool_preview_protocol.setShortcut('Ctrl+P')
|
|
1758
1748
|
self._tool_preview_protocol.setStatusTip(
|
|
1759
1749
|
'Show a preview of the current protocol.')
|
|
@@ -1767,7 +1757,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1767
1757
|
self._menu_convert = self._menu.addMenu('&Convert')
|
|
1768
1758
|
|
|
1769
1759
|
# Convert > Import CellML
|
|
1770
|
-
self._tool_import_cellml =
|
|
1760
|
+
self._tool_import_cellml = QtGui.QAction(
|
|
1771
1761
|
'Import model from CellML', self)
|
|
1772
1762
|
self._tool_import_cellml.setStatusTip(
|
|
1773
1763
|
'Import a model definition from a CellML file.')
|
|
@@ -1775,7 +1765,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1775
1765
|
lambda: self.action_import_model('cellml', FILTER_CELLML))
|
|
1776
1766
|
self._menu_convert.addAction(self._tool_import_cellml)
|
|
1777
1767
|
# Convert > Export CellML 1
|
|
1778
|
-
self._tool_export_cellml1 =
|
|
1768
|
+
self._tool_export_cellml1 = QtGui.QAction(
|
|
1779
1769
|
'Export model to CellML 1.0', self)
|
|
1780
1770
|
self._tool_export_cellml1.setStatusTip(
|
|
1781
1771
|
'Export a model definition to a CellML 1.0 document.')
|
|
@@ -1784,7 +1774,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1784
1774
|
'cellml1', '.cellml', FILTER_CELLML))
|
|
1785
1775
|
self._menu_convert.addAction(self._tool_export_cellml1)
|
|
1786
1776
|
# Convert > Export CellML 2
|
|
1787
|
-
self._tool_export_cellml2 =
|
|
1777
|
+
self._tool_export_cellml2 = QtGui.QAction(
|
|
1788
1778
|
'Export model to CellML 2.0', self)
|
|
1789
1779
|
self._tool_export_cellml2.setStatusTip(
|
|
1790
1780
|
'Export a model definition to a CellML 2.0 document.')
|
|
@@ -1796,15 +1786,14 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1796
1786
|
# Convert > ----
|
|
1797
1787
|
self._menu_convert.addSeparator()
|
|
1798
1788
|
# Convert > Import ABF
|
|
1799
|
-
self._tool_import_abf =
|
|
1800
|
-
'Import protocol from ABF', self)
|
|
1789
|
+
self._tool_import_abf = QtGui.QAction('Import protocol from ABF', self)
|
|
1801
1790
|
self._tool_import_abf.setStatusTip(
|
|
1802
1791
|
'Import a protocol definition from an ABF file.')
|
|
1803
1792
|
self._tool_import_abf.triggered.connect(
|
|
1804
1793
|
self.action_import_abf_protocol)
|
|
1805
1794
|
self._menu_convert.addAction(self._tool_import_abf)
|
|
1806
1795
|
# Convert > Import ChannelML
|
|
1807
|
-
self._tool_import_channelml =
|
|
1796
|
+
self._tool_import_channelml = QtGui.QAction(
|
|
1808
1797
|
'Import model from ChannelML', self)
|
|
1809
1798
|
self._tool_import_channelml.setStatusTip(
|
|
1810
1799
|
'Import a channel model from ChannelML.')
|
|
@@ -1812,8 +1801,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1812
1801
|
lambda: self.action_import_model('channelml', FILTER_CHANNELML))
|
|
1813
1802
|
self._menu_convert.addAction(self._tool_import_channelml)
|
|
1814
1803
|
# Convert > Import SBML
|
|
1815
|
-
self._tool_import_sbml =
|
|
1816
|
-
'Import model from SBML', self)
|
|
1804
|
+
self._tool_import_sbml = QtGui.QAction('Import model from SBML', self)
|
|
1817
1805
|
self._tool_import_sbml.setStatusTip(
|
|
1818
1806
|
'Import a model from SBML.')
|
|
1819
1807
|
self._tool_import_sbml.triggered.connect(
|
|
@@ -1823,8 +1811,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1823
1811
|
# Convert > ----
|
|
1824
1812
|
self._menu_convert.addSeparator()
|
|
1825
1813
|
# Convert > Export HTML
|
|
1826
|
-
self._tool_export_html =
|
|
1827
|
-
'Export model to HTML', self)
|
|
1814
|
+
self._tool_export_html = QtGui.QAction('Export model to HTML', self)
|
|
1828
1815
|
self._tool_export_html.setStatusTip(
|
|
1829
1816
|
'Export a model definition to an HTML document using presentation'
|
|
1830
1817
|
' MathML.')
|
|
@@ -1832,8 +1819,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1832
1819
|
lambda: self.action_export_model('html', '.html', FILTER_HTML))
|
|
1833
1820
|
self._menu_convert.addAction(self._tool_export_html)
|
|
1834
1821
|
# Convert > Export Latex
|
|
1835
|
-
self._tool_export_latex =
|
|
1836
|
-
'Export model to Latex', self)
|
|
1822
|
+
self._tool_export_latex = QtGui.QAction('Export model to Latex', self)
|
|
1837
1823
|
self._tool_export_latex.setStatusTip(
|
|
1838
1824
|
'Export a model definition to a Latex document.')
|
|
1839
1825
|
self._tool_export_latex.triggered.connect(
|
|
@@ -1845,7 +1831,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1845
1831
|
self._menu_convert.addSeparator()
|
|
1846
1832
|
|
|
1847
1833
|
# Convert > Ansic
|
|
1848
|
-
self._tool_export_ansic =
|
|
1834
|
+
self._tool_export_ansic = QtGui.QAction('Export to Ansi C', self)
|
|
1849
1835
|
self._tool_export_ansic.setStatusTip(
|
|
1850
1836
|
'Export to a runnable Ansi C program.')
|
|
1851
1837
|
self._tool_export_ansic.triggered.connect(
|
|
@@ -1853,8 +1839,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1853
1839
|
self._menu_convert.addAction(self._tool_export_ansic)
|
|
1854
1840
|
|
|
1855
1841
|
# Convert > CUDA
|
|
1856
|
-
self._tool_export_cuda =
|
|
1857
|
-
'Export to CUDA kernel', self)
|
|
1842
|
+
self._tool_export_cuda = QtGui.QAction('Export to CUDA kernel', self)
|
|
1858
1843
|
self._tool_export_cuda.setStatusTip(
|
|
1859
1844
|
'Export a model definition to a CUDA kernel program.')
|
|
1860
1845
|
self._tool_export_cuda.triggered.connect(
|
|
@@ -1862,7 +1847,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1862
1847
|
self._menu_convert.addAction(self._tool_export_cuda)
|
|
1863
1848
|
|
|
1864
1849
|
# Convert > CUDA RL
|
|
1865
|
-
self._tool_export_cuda_rl =
|
|
1850
|
+
self._tool_export_cuda_rl = QtGui.QAction(
|
|
1866
1851
|
'Export to CUDA kernel with RL updates', self)
|
|
1867
1852
|
self._tool_export_cuda_rl.setStatusTip(
|
|
1868
1853
|
'Export a model definition to a CUDA kernel program using'
|
|
@@ -1872,7 +1857,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1872
1857
|
self._menu_convert.addAction(self._tool_export_cuda_rl)
|
|
1873
1858
|
|
|
1874
1859
|
# Convert > EasyML
|
|
1875
|
-
self._tool_export_easyml =
|
|
1860
|
+
self._tool_export_easyml = QtGui.QAction(
|
|
1876
1861
|
'Export to EasyML (Carp)', self)
|
|
1877
1862
|
self._tool_export_easyml.setStatusTip(
|
|
1878
1863
|
'Export to an EasyML script for use with Carp/Carpentry.')
|
|
@@ -1881,7 +1866,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1881
1866
|
self._menu_convert.addAction(self._tool_export_easyml)
|
|
1882
1867
|
|
|
1883
1868
|
# Convert > Matlab
|
|
1884
|
-
self._tool_export_matlab =
|
|
1869
|
+
self._tool_export_matlab = QtGui.QAction(
|
|
1885
1870
|
'Export to Matlab/Octave', self)
|
|
1886
1871
|
self._tool_export_matlab.setStatusTip(
|
|
1887
1872
|
'Export to a runnable Matlab/Octave script.')
|
|
@@ -1890,7 +1875,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1890
1875
|
self._menu_convert.addAction(self._tool_export_matlab)
|
|
1891
1876
|
|
|
1892
1877
|
# Convert > OpenCL
|
|
1893
|
-
self._tool_export_opencl =
|
|
1878
|
+
self._tool_export_opencl = QtGui.QAction(
|
|
1894
1879
|
'Export to OpenCL kernel', self)
|
|
1895
1880
|
self._tool_export_opencl.setStatusTip(
|
|
1896
1881
|
'Export a model definition to an OpenCL kernel program using')
|
|
@@ -1899,7 +1884,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1899
1884
|
self._menu_convert.addAction(self._tool_export_opencl)
|
|
1900
1885
|
|
|
1901
1886
|
# Convert > OpenCL RL
|
|
1902
|
-
self._tool_export_opencl_rl =
|
|
1887
|
+
self._tool_export_opencl_rl = QtGui.QAction(
|
|
1903
1888
|
'Export to OpenCL kernel with RL updates', self)
|
|
1904
1889
|
self._tool_export_opencl_rl.setStatusTip(
|
|
1905
1890
|
'Export a model definition to an OpenCL kernel program using'
|
|
@@ -1909,7 +1894,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1909
1894
|
self._menu_convert.addAction(self._tool_export_opencl_rl)
|
|
1910
1895
|
|
|
1911
1896
|
# Convert > Python
|
|
1912
|
-
self._tool_export_python =
|
|
1897
|
+
self._tool_export_python = QtGui.QAction('Export to Python', self)
|
|
1913
1898
|
self._tool_export_python.setStatusTip(
|
|
1914
1899
|
'Export a model definition to a runnable Python script.')
|
|
1915
1900
|
self._tool_export_python.triggered.connect(
|
|
@@ -1921,7 +1906,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1921
1906
|
#
|
|
1922
1907
|
self._menu_analysis = self._menu.addMenu('&Analysis')
|
|
1923
1908
|
# Analysis > Model statistics
|
|
1924
|
-
self._tool_stats =
|
|
1909
|
+
self._tool_stats = QtGui.QAction('Show model statistics', self)
|
|
1925
1910
|
self._tool_stats.setStatusTip(
|
|
1926
1911
|
'Displays some basic statistics about the current model.')
|
|
1927
1912
|
self._tool_stats.triggered.connect(self.action_model_stats)
|
|
@@ -1929,8 +1914,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1929
1914
|
# Analysis > ----
|
|
1930
1915
|
self._menu_analysis.addSeparator()
|
|
1931
1916
|
# Analysis > Check units strict
|
|
1932
|
-
self._tool_units_strict =
|
|
1933
|
-
'Check units (&strict)', self)
|
|
1917
|
+
self._tool_units_strict = QtGui.QAction('Check units (&strict)', self)
|
|
1934
1918
|
self._tool_units_strict.setShortcut('F9')
|
|
1935
1919
|
self._tool_units_strict.setStatusTip(
|
|
1936
1920
|
'Check this model\'s units in strict mode.')
|
|
@@ -1938,7 +1922,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1938
1922
|
self.action_check_units_strict)
|
|
1939
1923
|
self._menu_analysis.addAction(self._tool_units_strict)
|
|
1940
1924
|
# Analysis > Check units tolerant
|
|
1941
|
-
self._tool_units_tolerant =
|
|
1925
|
+
self._tool_units_tolerant = QtGui.QAction(
|
|
1942
1926
|
'Check units (&tolerant)', self)
|
|
1943
1927
|
self._tool_units_tolerant.setShortcut('F10')
|
|
1944
1928
|
self._tool_units_tolerant.setStatusTip(
|
|
@@ -1949,7 +1933,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1949
1933
|
# Analysis > ----
|
|
1950
1934
|
self._menu_analysis.addSeparator()
|
|
1951
1935
|
# Analysis > Show variable info
|
|
1952
|
-
self._tool_variable_info =
|
|
1936
|
+
self._tool_variable_info = QtGui.QAction(
|
|
1953
1937
|
'Show quick variable info', self)
|
|
1954
1938
|
self._tool_variable_info.setShortcut('Ctrl+R')
|
|
1955
1939
|
self._tool_variable_info.setStatusTip(
|
|
@@ -1958,7 +1942,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1958
1942
|
self._menu_analysis.addAction(self._tool_variable_info)
|
|
1959
1943
|
self._model_widgets.append(self._tool_variable_info)
|
|
1960
1944
|
# Analysis > Show variable evaluation
|
|
1961
|
-
self._tool_variable_evaluation =
|
|
1945
|
+
self._tool_variable_evaluation = QtGui.QAction(
|
|
1962
1946
|
'Show variable evaluation', self)
|
|
1963
1947
|
self._tool_variable_evaluation.setShortcut('Ctrl+E')
|
|
1964
1948
|
self._tool_variable_evaluation.setStatusTip(
|
|
@@ -1968,7 +1952,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1968
1952
|
self._menu_analysis.addAction(self._tool_variable_evaluation)
|
|
1969
1953
|
self._model_widgets.append(self._tool_variable_evaluation)
|
|
1970
1954
|
# Analysis > Show variable dependencies
|
|
1971
|
-
self._tool_variable_dependencies =
|
|
1955
|
+
self._tool_variable_dependencies = QtGui.QAction(
|
|
1972
1956
|
'Show variable dependencies', self)
|
|
1973
1957
|
self._tool_variable_dependencies.setShortcut('Ctrl+D')
|
|
1974
1958
|
self._tool_variable_dependencies.setStatusTip(
|
|
@@ -1978,7 +1962,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1978
1962
|
self._menu_analysis.addAction(self._tool_variable_dependencies)
|
|
1979
1963
|
self._model_widgets.append(self._tool_variable_dependencies)
|
|
1980
1964
|
# Analysis > Show variable users
|
|
1981
|
-
self._tool_variable_users =
|
|
1965
|
+
self._tool_variable_users = QtGui.QAction(
|
|
1982
1966
|
'Show variable users', self)
|
|
1983
1967
|
self._tool_variable_users.setShortcut('Ctrl+U')
|
|
1984
1968
|
self._tool_variable_users.setStatusTip(
|
|
@@ -1988,7 +1972,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1988
1972
|
self._menu_analysis.addAction(self._tool_variable_users)
|
|
1989
1973
|
self._model_widgets.append(self._tool_variable_users)
|
|
1990
1974
|
# Analysis > Graph variable
|
|
1991
|
-
self._tool_variable_graph =
|
|
1975
|
+
self._tool_variable_graph = QtGui.QAction(
|
|
1992
1976
|
'Graph selected variable', self)
|
|
1993
1977
|
self._tool_variable_graph.setShortcut('Ctrl+G')
|
|
1994
1978
|
self._tool_variable_graph.setStatusTip(
|
|
@@ -1997,7 +1981,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
1997
1981
|
self._menu_analysis.addAction(self._tool_variable_graph)
|
|
1998
1982
|
self._model_widgets.append(self._tool_variable_graph)
|
|
1999
1983
|
# Analysis > Jump to variable definition
|
|
2000
|
-
self._tool_variable_jump =
|
|
1984
|
+
self._tool_variable_jump = QtGui.QAction(
|
|
2001
1985
|
'Jump to variable definition', self)
|
|
2002
1986
|
self._tool_variable_jump.setShortcut('Ctrl+J')
|
|
2003
1987
|
self._tool_variable_jump.setStatusTip(
|
|
@@ -2010,7 +1994,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2010
1994
|
# Analysis > ----
|
|
2011
1995
|
self._menu_analysis.addSeparator()
|
|
2012
1996
|
# Analysis > Evaluate state derivatives
|
|
2013
|
-
self._tool_state_derivatives =
|
|
1997
|
+
self._tool_state_derivatives = QtGui.QAction(
|
|
2014
1998
|
'Evaluate state derivatives', self)
|
|
2015
1999
|
self._tool_state_derivatives.setShortcut('F7')
|
|
2016
2000
|
self._tool_state_derivatives.setStatusTip(
|
|
@@ -2019,7 +2003,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2019
2003
|
self.action_state_derivatives)
|
|
2020
2004
|
self._menu_analysis.addAction(self._tool_state_derivatives)
|
|
2021
2005
|
# Analysis > Evaluate state derivatives without error checking
|
|
2022
|
-
self._tool_state_derivatives2 =
|
|
2006
|
+
self._tool_state_derivatives2 = QtGui.QAction(
|
|
2023
2007
|
'Evaluate state derivatives (no error checking)', self)
|
|
2024
2008
|
self._tool_state_derivatives2.setShortcut('F8')
|
|
2025
2009
|
self._tool_state_derivatives2.setStatusTip(
|
|
@@ -2031,7 +2015,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2031
2015
|
# Analysis > ----
|
|
2032
2016
|
self._menu_analysis.addSeparator()
|
|
2033
2017
|
# Analysis > Show component dependency graph
|
|
2034
|
-
self._tool_component_dependency_graph =
|
|
2018
|
+
self._tool_component_dependency_graph = QtGui.QAction(
|
|
2035
2019
|
'Show component dependency graph', self)
|
|
2036
2020
|
self._tool_component_dependency_graph.setStatusTip(
|
|
2037
2021
|
'Display a graph of the dependencies between components.')
|
|
@@ -2039,7 +2023,7 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2039
2023
|
self.action_component_dependency_graph)
|
|
2040
2024
|
self._menu_analysis.addAction(self._tool_component_dependency_graph)
|
|
2041
2025
|
# Analysis > Show variable dependency graph
|
|
2042
|
-
self._tool_variable_dependency_graph =
|
|
2026
|
+
self._tool_variable_dependency_graph = QtGui.QAction(
|
|
2043
2027
|
'Show variable dependency graph', self)
|
|
2044
2028
|
self._tool_variable_dependency_graph.setStatusTip(
|
|
2045
2029
|
'Display a graph of the dependencies between variables.')
|
|
@@ -2047,14 +2031,14 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2047
2031
|
self.action_variable_dependency_graph)
|
|
2048
2032
|
self._menu_analysis.addAction(self._tool_variable_dependency_graph)
|
|
2049
2033
|
# Analysis > Show state dependency matrix
|
|
2050
|
-
self._tool_state_matrix =
|
|
2034
|
+
self._tool_state_matrix = QtGui.QAction(
|
|
2051
2035
|
'Show state dependency matrix', self)
|
|
2052
2036
|
self._tool_state_matrix.setStatusTip(
|
|
2053
2037
|
'Display a matrix graph of the dependencies between states.')
|
|
2054
2038
|
self._tool_state_matrix.triggered.connect(self.action_state_matrix)
|
|
2055
2039
|
self._menu_analysis.addAction(self._tool_state_matrix)
|
|
2056
2040
|
# Analysis > Show component dependency cycles
|
|
2057
|
-
self._tool_component_cycles =
|
|
2041
|
+
self._tool_component_cycles = QtGui.QAction(
|
|
2058
2042
|
'Show cyclical component dependencies', self)
|
|
2059
2043
|
self._tool_component_cycles.setStatusTip(
|
|
2060
2044
|
'Display a list of cyclical dependencies between components.')
|
|
@@ -2066,29 +2050,27 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2066
2050
|
#
|
|
2067
2051
|
self._menu_run = self._menu.addMenu('&Run')
|
|
2068
2052
|
# Run > Validate
|
|
2069
|
-
self._tool_validate =
|
|
2070
|
-
'&Validate model', self)
|
|
2053
|
+
self._tool_validate = QtGui.QAction('&Validate model', self)
|
|
2071
2054
|
self._tool_validate.setShortcut('Ctrl+B')
|
|
2072
2055
|
self._tool_validate.setStatusTip('Validate the model.')
|
|
2073
2056
|
self._tool_validate.triggered.connect(self.action_validate)
|
|
2074
2057
|
self._menu_run.addAction(self._tool_validate)
|
|
2075
2058
|
# Run > Jump to error
|
|
2076
|
-
self._tool_jump_to_error =
|
|
2077
|
-
'&Jump to last error', self)
|
|
2059
|
+
self._tool_jump_to_error = QtGui.QAction('&Jump to last error', self)
|
|
2078
2060
|
self._tool_jump_to_error.setShortcut('Ctrl+Space')
|
|
2079
2061
|
self._tool_jump_to_error.setStatusTip(
|
|
2080
2062
|
'Jump to the last model error found.')
|
|
2081
2063
|
self._tool_jump_to_error.triggered.connect(self.action_jump_to_error)
|
|
2082
2064
|
self._menu_run.addAction(self._tool_jump_to_error)
|
|
2083
2065
|
# Run > Run embedded script
|
|
2084
|
-
self._tool_run =
|
|
2066
|
+
self._tool_run = QtGui.QAction('&Run embedded script', self)
|
|
2085
2067
|
self._tool_run.setShortcut('F5')
|
|
2086
2068
|
self._tool_run.setStatusTip('Run the embedded script.')
|
|
2087
2069
|
self._tool_run.setIcon(myokit.gui.icon('media-playback-start'))
|
|
2088
2070
|
self._tool_run.triggered.connect(self.action_run)
|
|
2089
2071
|
self._menu_run.addAction(self._tool_run)
|
|
2090
2072
|
# Run > Run explorer
|
|
2091
|
-
self._tool_explore =
|
|
2073
|
+
self._tool_explore = QtGui.QAction('&Run explorer', self)
|
|
2092
2074
|
self._tool_explore.setShortcut('F6')
|
|
2093
2075
|
self._tool_explore.setStatusTip(
|
|
2094
2076
|
'Run a simulation and display the results in the explorer.')
|
|
@@ -2100,12 +2082,12 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2100
2082
|
#
|
|
2101
2083
|
self._menu_help = self._menu.addMenu('&Help')
|
|
2102
2084
|
# Help > About
|
|
2103
|
-
self._tool_about =
|
|
2085
|
+
self._tool_about = QtGui.QAction('&About', self)
|
|
2104
2086
|
self._tool_about.setStatusTip('View information about this program.')
|
|
2105
2087
|
self._tool_about.triggered.connect(self.action_about)
|
|
2106
2088
|
self._menu_help.addAction(self._tool_about)
|
|
2107
2089
|
# Help > License
|
|
2108
|
-
self._tool_license =
|
|
2090
|
+
self._tool_license = QtGui.QAction('&License', self)
|
|
2109
2091
|
self._tool_license.setStatusTip('View this program\'s license info.')
|
|
2110
2092
|
self._tool_license.triggered.connect(self.action_license)
|
|
2111
2093
|
self._menu_help.addAction(self._tool_license)
|
|
@@ -2360,15 +2342,15 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2360
2342
|
msg = 'Save changes to ' + str(self._file) + '?'
|
|
2361
2343
|
else:
|
|
2362
2344
|
msg = 'Save changes to new file?'
|
|
2363
|
-
|
|
2364
|
-
options =
|
|
2345
|
+
sb = QtWidgets.QMessageBox.StandardButton
|
|
2346
|
+
options = sb.Yes | sb.No
|
|
2365
2347
|
if cancel:
|
|
2366
|
-
options |=
|
|
2367
|
-
reply =
|
|
2368
|
-
if reply ==
|
|
2348
|
+
options |= sb.Cancel
|
|
2349
|
+
reply = QtWidgets.QMessageBox.question(self, TITLE, msg, options)
|
|
2350
|
+
if reply == sb.Yes:
|
|
2369
2351
|
# Only allow quitting if save succesful
|
|
2370
2352
|
return self.save_file(save_as=False)
|
|
2371
|
-
elif reply ==
|
|
2353
|
+
elif reply == sb.No:
|
|
2372
2354
|
return True
|
|
2373
2355
|
else:
|
|
2374
2356
|
return False
|
|
@@ -2590,16 +2572,13 @@ class MyokitIDE(myokit.gui.MyokitApplication):
|
|
|
2590
2572
|
def update_navigator(self):
|
|
2591
2573
|
""" Updates the model navigator contents. """
|
|
2592
2574
|
# Find all components and store their positions in a list (name, line)
|
|
2593
|
-
#Sloppy version: query = QtCore.QRegExp(r'^\[') could be faster?
|
|
2594
|
-
query = QtCore.QRegExp(r'^\[[a-zA-Z]{1}[a-zA-Z0-9_]*\]')
|
|
2595
2575
|
pos = 0
|
|
2596
|
-
found = self._model_editor.document().find(
|
|
2576
|
+
found = self._model_editor.document().find(self._nav_query, pos)
|
|
2597
2577
|
positions = []
|
|
2598
2578
|
while not found.isNull():
|
|
2599
2579
|
pos = found.position()
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
found = self._model_editor.document().find(query, pos)
|
|
2580
|
+
positions.append((found.selectedText(), pos))
|
|
2581
|
+
found = self._model_editor.document().find(self._nav_query, pos)
|
|
2603
2582
|
self._model_navigator.set_positions(positions)
|
|
2604
2583
|
|
|
2605
2584
|
def update_recent_files_menu(self):
|
|
@@ -2637,7 +2616,7 @@ class TabbedToolBar(QtWidgets.QTabWidget):
|
|
|
2637
2616
|
tab_toggled = QtCore.Signal(QtWidgets.QWidget, bool)
|
|
2638
2617
|
|
|
2639
2618
|
def __init__(self, parent=None):
|
|
2640
|
-
super(
|
|
2619
|
+
super().__init__(parent)
|
|
2641
2620
|
|
|
2642
2621
|
self.setTabsClosable(True)
|
|
2643
2622
|
self.tabCloseRequested.connect(self._close_button_hit)
|
|
@@ -2662,11 +2641,11 @@ class TabbedToolBar(QtWidgets.QTabWidget):
|
|
|
2662
2641
|
def keyPressEvent(self, event):
|
|
2663
2642
|
""" Qt event: A key-press reaches the widget. """
|
|
2664
2643
|
key = event.key()
|
|
2665
|
-
if key == Qt.Key_Escape:
|
|
2644
|
+
if key == Qt.Key.Key_Escape:
|
|
2666
2645
|
self.setFocus()
|
|
2667
2646
|
self.focusPreviousChild()
|
|
2668
2647
|
else:
|
|
2669
|
-
super(
|
|
2648
|
+
super().keyPressEvent(event)
|
|
2670
2649
|
|
|
2671
2650
|
def toggle(self, widget, new_status=None):
|
|
2672
2651
|
"""
|
|
@@ -2720,7 +2699,7 @@ class ModelNavigator(QtWidgets.QWidget):
|
|
|
2720
2699
|
item_changed = QtCore.Signal(int)
|
|
2721
2700
|
|
|
2722
2701
|
def __init__(self, parent=None):
|
|
2723
|
-
super(
|
|
2702
|
+
super().__init__(parent)
|
|
2724
2703
|
|
|
2725
2704
|
# List widget
|
|
2726
2705
|
self._list_widget = QtWidgets.QListWidget()
|
|
@@ -2736,7 +2715,7 @@ class ModelNavigator(QtWidgets.QWidget):
|
|
|
2736
2715
|
def current_item_changed(self, item, previous_item):
|
|
2737
2716
|
""" Called if the navigator item is changed. """
|
|
2738
2717
|
if item is not None:
|
|
2739
|
-
line = item.data(Qt.UserRole)
|
|
2718
|
+
line = item.data(Qt.ItemDataRole.UserRole)
|
|
2740
2719
|
self.item_changed.emit(line)
|
|
2741
2720
|
|
|
2742
2721
|
def set_positions(self, positions):
|
|
@@ -2752,7 +2731,7 @@ class ModelNavigator(QtWidgets.QWidget):
|
|
|
2752
2731
|
self._list_widget.setSortingEnabled(True)
|
|
2753
2732
|
for text, pos in self._positions:
|
|
2754
2733
|
item = QtWidgets.QListWidgetItem(text[1:-1])
|
|
2755
|
-
item.setData(Qt.UserRole, pos)
|
|
2734
|
+
item.setData(Qt.ItemDataRole.UserRole, pos)
|
|
2756
2735
|
self._list_widget.addItem(item)
|
|
2757
2736
|
|
|
2758
2737
|
|
|
@@ -2764,12 +2743,13 @@ class Console(QtWidgets.QPlainTextEdit):
|
|
|
2764
2743
|
*Extends*: ``QtWidgets.QPlainTextEdit``
|
|
2765
2744
|
"""
|
|
2766
2745
|
def __init__(self, parent=None):
|
|
2767
|
-
super(
|
|
2746
|
+
super().__init__(parent)
|
|
2768
2747
|
self.setReadOnly(True)
|
|
2769
2748
|
font = myokit.gui.qtMonospaceFont()
|
|
2770
2749
|
font.setPointSize(10)
|
|
2771
2750
|
self.setFont(font)
|
|
2772
|
-
self.setFrameStyle(
|
|
2751
|
+
self.setFrameStyle(
|
|
2752
|
+
QtWidgets.QFrame.Shape.WinPanel | QtWidgets.QFrame.Shadow.Sunken)
|
|
2773
2753
|
|
|
2774
2754
|
def clear(self):
|
|
2775
2755
|
"""
|
|
@@ -2811,4 +2791,4 @@ class Console(QtWidgets.QPlainTextEdit):
|
|
|
2811
2791
|
self.verticalScrollBar().setValue(self.verticalScrollBar().maximum())
|
|
2812
2792
|
# Autoflush
|
|
2813
2793
|
QtWidgets.QApplication.processEvents(
|
|
2814
|
-
QtCore.QEventLoop.ExcludeUserInputEvents)
|
|
2794
|
+
QtCore.QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
|