Skip to content
Snippets Groups Projects
Verified Commit 97eb0c3d authored by Philipp S. Sommer's avatar Philipp S. Sommer
Browse files

ignore setting the sp and mp if not possible

parent 639b503d
No related branches found
No related tags found
2 merge requests!39[release] compatibility and bug fixes, cli improvements and code formatting,!35fix updating current projects in console
Pipeline #342715 passed
......@@ -244,13 +244,21 @@ class ConsoleWidget(QtInProcessRichJupyterWidget, DockMixin):
"""Update the `mp` variable in the shell is
``rcParams['console.auto_set_mp']`` with a main project"""
if self.rc["auto_set_mp"] and project is not None and project.is_main:
self.run_command_in_shell("mp = psy.gcp(True)")
try:
self.run_command_in_shell("mp = psy.gcp(True)")
except RuntimeError:
# probably running a script that via IPythons `run` magick
pass
def update_sp(self, project):
"""Update the `sp` variable in the shell is
``rcParams['console.auto_set_sp']`` with a sub project"""
if self.rc["auto_set_sp"] and (project is None or not project.is_main):
self.run_command_in_shell("sp = psy.gcp()")
try:
self.run_command_in_shell("sp = psy.gcp()")
except RuntimeError:
# probably running a script that via IPythons `run` magick
pass
def show_current_help(self, to_end=False, force=False):
"""Show the help of the object at the cursor position if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment