Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Fix styling issues for UI consistency #166

Merged
merged 3 commits into from
Jan 23, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions spyder_terminal/terminalplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, parent):
self.project_path = None
self.current_file_path = None
self.current_cwd = getcwd()
self.options_menu = QMenu(self)
self._options_menu = QMenu(self)

try:
# Spyder 3
Expand All @@ -103,21 +103,16 @@ def __init__(self, parent):

layout = QVBoxLayout()
new_term_btn = create_toolbutton(self,
icon=ima.icon('expand'),
icon=ima.icon('expand_selection'),
tip=_('Open a new terminal'),
triggered=self.create_new_term)
menu_btn = create_toolbutton(self, icon=ima.icon('tooloptions'),
tip=_('Options'))
menu_btn.setMenu(self.options_menu)
menu_btn.setPopupMode(menu_btn.InstantPopup)

# if self.get_option('first_time', True):
# self.setup_shortcuts()
# self.shortcuts = self.create_shortcuts()
corner_widgets = {Qt.TopRightCorner: [new_term_btn, menu_btn]}
self.tabwidget = Tabs(self, menu=self.options_menu,

corner_widgets = {Qt.TopRightCorner: [new_term_btn,
self.options_button]}
self.tabwidget = Tabs(self, menu=self._options_menu,
actions=self.menu_actions,
corner_widgets=corner_widgets, rename_tabs=True)
corner_widgets=corner_widgets,
rename_tabs=True)

if hasattr(self.tabwidget, 'setDocumentMode') \
and not sys.platform == 'darwin':
Expand Down Expand Up @@ -246,17 +241,13 @@ def get_plugin_actions(self):
_("Rename terminal"),
triggered=self.tab_name_editor)

add_actions(self.options_menu, [new_terminal_cwd,
self.new_terminal_project,
new_terminal_file,
rename_tab_action])
self.plugin_actions = [new_terminal_cwd, self.new_terminal_project,
new_terminal_file, MENU_SEPARATOR,
rename_tab_action]

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
return self.plugin_actions

def setup_menu_actions(self):
"""Setup and update the Options menu actions."""
Expand Down Expand Up @@ -302,7 +293,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.options_menu.aboutToShow.connect(self.setup_menu_actions)
self._options_menu.aboutToShow.connect(self.setup_menu_actions)

def apply_plugin_settings(self, options):
"""Apply the config settings."""
Expand Down