Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'Tellurium oscillation', '"""',
'', 'import tellurium as te', 'import roadrunner',
'import antimony', '',
"r = te.loada ('''", 'model feedback()', ' // Reactions:',
' J0: $X0 -> S1; (VM1 * (X0 - S1/Keq1))/(1 + X0 + S1 + S4^h);',
' J1: S1 -> S2; (10 * S1 - 2 * S2) / (1 + S1 + S2);',
' J2: S2 -> S3; (10 * S2 - 2 * S3) / (1 + S2 + S3);',
' J3: S3 -> S4; (10 * S3 - 2 * S4) / (1 + S3 + S4);',
' J4: S4 -> $X1; (V4 * S4) / (KS4 + S4);','',
' // Species initializations:', ' S1 = 0; S2 = 0; S3 = 0;',
' S4 = 0; X0 = 10; X1 = 0;','', ' // Variable initialization:',
' VM1 = 10; Keq1 = 10; h = 10; V4 = 2.5; KS4 = 0.5;',
"end''')", '', 'result = r.simulate(0, 40, 500)', 'r.plot(result)', '']
text = os.linesep.join([encoding.to_unicode(qstr)
for qstr in default])
encoding.write(to_text_string(text), self.TEMPFILE_PATH, 'utf-8')
self.load(self.TEMPFILE_PATH)
else:
label = '{} ({})'.format(name, _('not available'))
self.framework_combobox.addItem(label)
self.framework_combobox.model().item(ix).setEnabled(installed)
framework_layout.addWidget(self.framework_combobox)
layout.addLayout(framework_layout)
layout.addSpacing(10)
wdir_label = QLabel(_('Directory from which to run tests'))
layout.addWidget(wdir_label)
wdir_layout = QHBoxLayout()
self.wdir_lineedit = QLineEdit(self)
wdir_layout.addWidget(self.wdir_lineedit)
self.wdir_button = QPushButton(ima.icon('DirOpenIcon'), '', self)
self.wdir_button.setToolTip(_("Select directory"))
self.wdir_button.clicked.connect(lambda: self.select_directory())
wdir_layout.addWidget(self.wdir_button)
layout.addLayout(wdir_layout)
layout.addSpacing(20)
self.buttons = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel)
layout.addWidget(self.buttons)
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.ok_button = self.buttons.button(QDialogButtonBox.Ok)
self.ok_button.setEnabled(False)
self.framework_combobox.currentIndexChanged.connect(
def create_shortcuts(self):
"""Create shortcuts for ipyconsole."""
inspect = config_shortcut(self._control.inspect_current_object,
context='Console',
name='Inspect current object', parent=self)
clear_console = config_shortcut(self.clear_console, context='Console',
name='Clear shell', parent=self)
restart_kernel = config_shortcut(self.ipyclient.restart_kernel,
context='ipython_console',
name='Restart kernel', parent=self)
new_tab = config_shortcut(lambda: self.new_client.emit(),
context='ipython_console', name='new tab',
parent=self)
reset_namespace = config_shortcut(lambda: self._reset_namespace(),
context='ipython_console',
name='reset namespace', parent=self)
array_inline = config_shortcut(self._control.enter_array_inline,
context='array_builder',
name='enter array inline', parent=self)
array_table = config_shortcut(self._control.enter_array_table,
context='array_builder',
name='enter array table', parent=self)
clear_line = config_shortcut(self.ipyclient.clear_line,
context='console', name='clear line',
def create_shortcuts(self):
"""Create shortcuts for ipyconsole."""
inspect = config_shortcut(self._control.inspect_current_object,
context='Console',
name='Inspect current object', parent=self)
clear_console = config_shortcut(self.clear_console, context='Console',
name='Clear shell', parent=self)
restart_kernel = config_shortcut(self.ipyclient.restart_kernel,
context='ipython_console',
name='Restart kernel', parent=self)
new_tab = config_shortcut(lambda: self.new_client.emit(),
context='ipython_console', name='new tab',
parent=self)
reset_namespace = config_shortcut(lambda: self._reset_namespace(),
context='ipython_console',
name='reset namespace', parent=self)
array_inline = config_shortcut(self._control.enter_array_inline,
context='array_builder',
name='enter array inline', parent=self)
array_table = config_shortcut(self._control.enter_array_table,
context='array_builder',
name='enter array table', parent=self)
def create_shortcuts(self):
"""Create shortcuts for ipyconsole."""
inspect = config_shortcut(self._control.inspect_current_object,
context='Console',
name='Inspect current object', parent=self)
clear_console = config_shortcut(self.clear_console, context='Console',
name='Clear shell', parent=self)
restart_kernel = config_shortcut(self.ipyclient.restart_kernel,
context='ipython_console',
name='Restart kernel', parent=self)
new_tab = config_shortcut(lambda: self.new_client.emit(),
context='ipython_console', name='new tab',
parent=self)
reset_namespace = config_shortcut(lambda: self._reset_namespace(),
context='ipython_console',
name='reset namespace', parent=self)
array_inline = config_shortcut(self._control.enter_array_inline,
context='array_builder',
name='enter array inline', parent=self)
array_table = config_shortcut(self._control.enter_array_table,
context='array_builder',
name='enter array table', parent=self)
clear_line = config_shortcut(self.ipyclient.clear_line,
context='console', name='clear line',
parent=self)
return [inspect, clear_console, restart_kernel, new_tab,
reset_namespace, array_inline, array_table, clear_line]
run_lines_label.setWordWrap(True)
run_lines_edit = self.create_lineedit(_("Lines:"), 'startup/run_lines',
'', alignment=Qt.Horizontal)
run_lines_layout = QVBoxLayout()
run_lines_layout.addWidget(run_lines_label)
run_lines_layout.addWidget(run_lines_edit)
run_lines_group.setLayout(run_lines_layout)
# Run file Group
run_file_group = QGroupBox(_("Run a file"))
run_file_label = QLabel(_("You can also run a whole file at startup "
"instead of just some lines (This is "
"similar to have a PYTHONSTARTUP file)."))
run_file_label.setWordWrap(True)
file_radio = newcb(_("Use the following file:"),
'startup/use_run_file', False)
run_file_browser = self.create_browsefile('', 'startup/run_file', '')
run_file_browser.setEnabled(False)
file_radio.toggled.connect(run_file_browser.setEnabled)
run_file_layout = QVBoxLayout()
run_file_layout.addWidget(run_file_label)
run_file_layout.addWidget(file_radio)
run_file_layout.addWidget(run_file_browser)
run_file_group.setLayout(run_file_layout)
# ---- Advanced settings ----
# Enable Jedi completion
jedi_group = QGroupBox(_("Jedi completion"))
jedi_label = QLabel(_("Enable Jedi-based <tt>Tab</tt> completion "
"in the IPython console; similar to the "
def __init__(self, parent=None):
super(KernelConnectionDialog, self).__init__(parent)
self.setWindowTitle(_('Connect to an existing kernel'))
main_label = QLabel(_("Please enter the connection info of the kernel "
"you want to connect to. For that you can "
"either select its JSON connection file using "
"the <tt>Browse</tt> button, or write directly "
"its id, in case it's a local kernel (for "
"example <tt>kernel-3764.json</tt> or just "
"<tt>3764</tt>)."))
main_label.setWordWrap(True)
main_label.setAlignment(Qt.AlignJustify)
# connection file
cf_label = QLabel(_('Connection info:'))
self.cf = QLineEdit()
self.cf.setPlaceholderText(_('Path to connection file or kernel id'))
self.cf.setMinimumWidth(250)
cf_open_btn = QPushButton(_('Browse'))
cf_open_btn.clicked.connect(self.select_connection_file)
cf_layout = QHBoxLayout()
cf_layout.addWidget(cf_label)
cf_layout.addWidget(self.cf)
cf_layout.addWidget(cf_open_btn)
# remote kernel checkbox
self.rm_cb = QCheckBox(_('This is a remote kernel'))
# ssh connection
self.hn = QLineEdit()
self.outlineexplorer.register_plugin()
# Editor plugin
self.set_splash(_("Loading editor..."))
from spyder.plugins.editor import Editor
self.editor = Editor(self)
self.editor.register_plugin()
# Populating file menu entries
quit_action = create_action(self, _("&Quit"),
icon=ima.icon('exit'),
tip=_("Quit"),
triggered=self.console.quit,
context=Qt.ApplicationShortcut)
self.register_shortcut(quit_action, "_", "Quit")
restart_action = create_action(self, _("&Restart"),
icon=ima.icon('restart'),
tip=_("Restart"),
triggered=self.restart,
context=Qt.ApplicationShortcut)
self.register_shortcut(restart_action, "_", "Restart")
self.file_menu_actions += [self.file_switcher_action,
self.symbol_finder_action, None,
restart_action, quit_action]
self.set_splash("")
self.debug_print(" ..widgets")
# Explorer
if CONF.get('explorer', 'enable'):
self.set_splash(_("Loading file explorer..."))
# then set them again as floating windows here.
for widget in self.floating_dockwidgets:
widget.setFloating(True)
# In MacOS X 10.7 our app is not displayed after initialized (I don't
# know why because this doesn't happen when started from the terminal),
# so we need to resort to this hack to make it appear.
if running_in_mac_app():
idx = __file__.index(MAC_APP_NAME)
app_path = __file__[:idx]
subprocess.call(['open', app_path + MAC_APP_NAME])
# Server to maintain just one Spyder instance and open files in it if
# the user tries to start other instances with
# $ spyder foo.py
if CONF.get('main', 'single_instance') and not self.new_instance:
t = threading.Thread(target=self.start_open_files_server)
t.setDaemon(True)
t.start()
# Connect the window to the signal emmited by the previous server
# when it gets a client connected to it
self.sig_open_external_file.connect(self.open_external_file)
# Create Plugins and toolbars submenus
self.create_plugins_menu()
self.create_toolbars_menu()
self.extconsole.setMinimumHeight(0)
# Update toolbar visibility status
self.toolbars_visible = CONF.get('main', 'toolbars_visible')
nexttab = config_shortcut(lambda: self.tabs.tab_navigate(1),
context='Editor',
name='Cycle to next file', parent=self)
run_selection = config_shortcut(self.run_selection, context='Editor',
name='Run selection', parent=self)
new_file = config_shortcut(lambda : self.sig_new_file[()].emit(),
context='Editor', name='New file',
parent=self)
open_file = config_shortcut(lambda : self.plugin_load[()].emit(),
context='Editor', name='Open file',
parent=self)
save_file = config_shortcut(self.save, context='Editor',
name='Save file', parent=self)
save_all = config_shortcut(self.save_all, context='Editor',
name='Save all', parent=self)
save_as = config_shortcut(lambda : self.sig_save_as.emit(),
context='Editor', name='Save As',
parent=self)
close_all = config_shortcut(self.close_all_files, context='Editor',
name='Close all', parent=self)
prev_edit_pos = config_shortcut(lambda : self.sig_prev_edit_pos.emit(),
context="Editor",
name="Last edit location",
parent=self)
prev_cursor = config_shortcut(lambda : self.sig_prev_cursor.emit(),
context="Editor",
name="Previous cursor position",
parent=self)
next_cursor = config_shortcut(lambda : self.sig_next_cursor.emit(),
context="Editor",
name="Next cursor position",
parent=self)