Skip to content

Commit

Permalink
Disable project action when project is inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Jul 7, 2017
1 parent 85af9e8 commit 0cf6de9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spyder_terminal/terminalplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,6 @@ def get_plugin_actions(self):
self.create_new_term(
path=self.project_path))

if self.project_path is None:
self.new_terminal_project.setEnabled(False)

new_terminal_file = create_action(self,
_("New terminal in current Editor "
"file"),
Expand All @@ -233,8 +230,15 @@ def get_plugin_actions(self):
self.menu_actions = [new_terminal_cwd, self.new_terminal_project,
new_terminal_file, MENU_SEPARATOR,
rename_tab_action]
self.setup_menu_actions()

return self.menu_actions

def setup_menu_actions(self):
"""Setup and update the Options menu actions."""
if self.project_path is None:
self.new_terminal_project.setEnabled(False)

def get_focus_widget(self):
"""
Set focus on current selected terminal.
Expand Down Expand Up @@ -274,6 +278,7 @@ def register_plugin(self):
self.main.projects.sig_project_loaded.connect(self.set_project_path)
self.main.projects.sig_project_closed.connect(self.unset_project_path)
self.main.editor.open_file_update.connect(self.set_current_opened_file)
self.menu.aboutToShow.connect(self.setup_menu_actions)

# ------ Public API (for terminals) -------------------------
def get_terms(self):
Expand Down

0 comments on commit 0cf6de9

Please sign in to comment.