Skip to content

Commit

Permalink
External terminal: Add menu entry to run file with it
Browse files Browse the repository at this point in the history
This is necessary now that the Run buttons use a default executor.
  • Loading branch information
ccordoba12 committed Jan 31, 2025
1 parent c559618 commit 01ecdf5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion spyder/plugins/externalterminal/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ExtTerminalPyConfiguration, ExtTerminalShConfiguration)
from spyder.plugins.externalterminal.widgets.run_conf import (
ExternalTerminalPyConfiguration, ExternalTerminalShConfiguration)
from spyder.plugins.mainmenu.api import ApplicationMenus, RunMenuSections
from spyder.plugins.run.api import (
RunContext, run_execute, RunConfiguration, ExtendedRunExecutionParameters,
RunResult, RunExecutor)
Expand Down Expand Up @@ -175,6 +176,19 @@ def on_run_available(self):
run = self.get_plugin(Plugins.Run)
run.register_executor_configuration(self, self.executor_configuration)

run.create_run_in_executor_button(
RunContext.File,
self.NAME,
text=_("Run in external terminal"),
tip=_("Run in an operating system terminal"),
icon=self.get_icon(),
register_shortcut=False,
add_to_menu={
"menu": ApplicationMenus.Run,
"section": RunMenuSections.RunInExecutors
},
)

@on_plugin_available(plugin=Plugins.Editor)
def on_editor_available(self):
editor = self.get_plugin(Plugins.Editor)
Expand All @@ -185,7 +199,9 @@ def on_editor_available(self):
def on_run_teardown(self):
run = self.get_plugin(Plugins.Run)
run.deregister_executor_configuration(
self, self.executor_configuration)
self, self.executor_configuration
)
run.destroy_run_in_executor_button(RunContext.File, self.NAME)

@on_plugin_teardown(plugin=Plugins.Editor)
def on_editor_teardown(self):
Expand Down

0 comments on commit 01ecdf5

Please sign in to comment.