diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py index cf813dda09e..c2df08b9b98 100644 --- a/spyder/app/mainwindow.py +++ b/spyder/app/mainwindow.py @@ -109,7 +109,7 @@ # Create our QApplication instance here because it's needed to render the # splash screen created below #============================================================================== -from spyder.utils.qthelpers import qapplication +from spyder.utils.qthelpers import qapplication, MENU_SEPARATOR MAIN_APP = qapplication() @@ -659,7 +659,7 @@ def create_edit_action(text, tr_text, icon): "(i.e. for all sessions)"), triggered=self.win_env) self.tools_menu_actions.append(winenv_action) - self.tools_menu_actions += [reset_spyder_action, None, + self.tools_menu_actions += [reset_spyder_action, MENU_SEPARATOR, update_modules_action] # External Tools submenu @@ -953,9 +953,9 @@ def trigger(i=i, self=self): # closure needed! self.tours_menu = None self.help_menu_actions = [doc_action, tut_action, self.tours_menu, - None, report_action, dep_action, + MENU_SEPARATOR, report_action, dep_action, self.check_updates_action, support_action, - None] + MENU_SEPARATOR] # Python documentation if get_python_doc_path() is not None: pydoc_act = create_action(self, _("Python documentation"), @@ -1024,7 +1024,7 @@ def add_ipm_action(text, path): _("About %s...") % "Spyder", icon=ima.icon('MessageBoxInformation'), triggered=self.about) - self.help_menu_actions += [None, about_action] + self.help_menu_actions += [MENU_SEPARATOR, about_action] # Status bar widgets from spyder.widgets.status import MemoryStatus, CPUStatus @@ -1053,9 +1053,9 @@ def add_ipm_action(text, path): self.view_menu.addMenu(self.plugins_menu) # Panes add_actions(self.view_menu, (self.lock_dockwidgets_action, - self.close_dockwidget_action, - self.maximize_action, - None)) + self.close_dockwidget_action, + self.maximize_action, + MENU_SEPARATOR)) self.show_toolbars_action = create_action(self, _("Show toolbars"), triggered=self.show_toolbars, @@ -1064,18 +1064,18 @@ def add_ipm_action(text, path): "Show toolbars") self.view_menu.addMenu(self.toolbars_menu) self.view_menu.addAction(self.show_toolbars_action) - add_actions(self.view_menu, (None, + add_actions(self.view_menu, (MENU_SEPARATOR, self.quick_layout_menu, self.toggle_previous_layout_action, self.toggle_next_layout_action, - None, + MENU_SEPARATOR, self.fullscreen_action)) if set_attached_console_visible is not None: cmd_act = create_action(self, _("Attached console window (debugging)"), toggled=set_attached_console_visible) cmd_act.setChecked(is_attached_console_visible()) - add_actions(self.view_menu, (None, cmd_act)) + add_actions(self.view_menu, (MENU_SEPARATOR, cmd_act)) # Adding external tools action to "Tools" menu if self.external_tools_menu_actions: diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py index 1b71b42e3b3..dbf693121f9 100644 --- a/spyder/plugins/editor.py +++ b/spyder/plugins/editor.py @@ -38,7 +38,7 @@ from spyder.utils import codeanalysis, encoding, programs, sourcecode from spyder.utils import icon_manager as ima from spyder.utils.introspection.manager import IntrospectionManager -from spyder.utils.qthelpers import create_action, add_actions +from spyder.utils.qthelpers import create_action, add_actions, MENU_SEPARATOR from spyder.widgets.findreplace import FindReplace from spyder.widgets.editor import (EditorMainWindow, EditorSplitter, EditorStack, Printer) @@ -985,24 +985,24 @@ def get_plugin_actions(self): self.recent_file_menu.aboutToShow.connect(self.update_recent_file_menu) file_menu_actions = [self.new_action, - None, + MENU_SEPARATOR, self.open_action, self.open_last_closed_action, self.recent_file_menu, - None, - None, + MENU_SEPARATOR, + MENU_SEPARATOR, self.save_action, self.save_all_action, save_as_action, self.file_switcher_action, self.revert_action, - None, + MENU_SEPARATOR, print_preview_action, self.print_action, - None, + MENU_SEPARATOR, self.close_action, self.close_all_action, - None] + MENU_SEPARATOR] self.main.file_menu_actions += file_menu_actions file_toolbar_actions = [self.new_action, self.open_action, @@ -1023,8 +1023,9 @@ def get_plugin_actions(self): self.edit_menu_actions = [self.toggle_comment_action, blockcomment_action, unblockcomment_action, self.indent_action, self.unindent_action, - self.text_uppercase_action, self.text_lowercase_action] - self.main.edit_menu_actions += [None]+self.edit_menu_actions + self.text_uppercase_action, + self.text_lowercase_action] + self.main.edit_menu_actions += [MENU_SEPARATOR] + self.edit_menu_actions edit_toolbar_actions = [self.toggle_comment_action, self.unindent_action, self.indent_action] self.main.edit_toolbar_actions += edit_toolbar_actions @@ -1036,8 +1037,9 @@ def get_plugin_actions(self): # ---- Run menu/toolbar construction ---- run_menu_actions = [run_action, run_cell_action, - run_cell_advance_action, None, run_selected_action, - re_run_action, configure_action, None] + run_cell_advance_action, MENU_SEPARATOR, + run_selected_action, re_run_action, + configure_action, MENU_SEPARATOR] self.main.run_menu_actions += run_menu_actions run_toolbar_actions = [run_action, run_cell_action, run_cell_advance_action, re_run_action, @@ -1054,12 +1056,12 @@ def get_plugin_actions(self): debug_return_action, debug_continue_action, debug_exit_action, - None, + MENU_SEPARATOR, set_clear_breakpoint_action, set_cond_breakpoint_action, clear_all_breakpoints_action, 'list_breakpoints', - None, + MENU_SEPARATOR, self.winpdb_action] self.main.debug_menu_actions += debug_menu_actions debug_toolbar_actions = [debug_action, debug_next_action, @@ -1072,12 +1074,12 @@ def get_plugin_actions(self): self.showblanks_action, trailingspaces_action, fixindentation_action, - None, + MENU_SEPARATOR, self.todo_list_action, self.warning_list_action, self.previous_warning_action, self.next_warning_action, - None, + MENU_SEPARATOR, self.previous_edit_cursor_action, self.previous_cursor_action, self.next_cursor_action] @@ -1087,23 +1089,31 @@ def get_plugin_actions(self): self.warning_list_action, self.previous_warning_action, self.next_warning_action, - None, + MENU_SEPARATOR, self.previous_edit_cursor_action, self.previous_cursor_action, self.next_cursor_action] self.main.source_toolbar_actions += source_toolbar_actions # ---- Dock widget and file dependent actions ---- - self.dock_toolbar_actions = file_toolbar_actions + [None] + \ - source_toolbar_actions + [None] + \ - run_toolbar_actions + [None] + \ - debug_toolbar_actions + [None] + \ - edit_toolbar_actions + self.dock_toolbar_actions = (file_toolbar_actions + + [MENU_SEPARATOR] + + source_toolbar_actions + + [MENU_SEPARATOR] + + run_toolbar_actions + + [MENU_SEPARATOR] + + debug_toolbar_actions + + [MENU_SEPARATOR] + + edit_toolbar_actions) self.pythonfile_dependent_actions = [run_action, configure_action, - set_clear_breakpoint_action, set_cond_breakpoint_action, - debug_action, run_selected_action, run_cell_action, - run_cell_advance_action, blockcomment_action, - unblockcomment_action, self.winpdb_action] + set_clear_breakpoint_action, + set_cond_breakpoint_action, + debug_action, run_selected_action, + run_cell_action, + run_cell_advance_action, + blockcomment_action, + unblockcomment_action, + self.winpdb_action] self.file_dependent_actions = self.pythonfile_dependent_actions + \ [self.save_action, save_as_action, print_preview_action, self.print_action, self.save_all_action, gotoline_action, diff --git a/spyder/plugins/findinfiles.py b/spyder/plugins/findinfiles.py index b892e00c854..1d5dcb7ebb3 100644 --- a/spyder/plugins/findinfiles.py +++ b/spyder/plugins/findinfiles.py @@ -23,7 +23,7 @@ from spyder.config.utils import get_edit_extensions from spyder.py3compat import getcwd from spyder.utils import icon_manager as ima -from spyder.utils.qthelpers import create_action +from spyder.utils.qthelpers import create_action, MENU_SEPARATOR from spyder.widgets.findinfiles import FindInFilesWidget from spyder.plugins import SpyderPluginMixin @@ -150,8 +150,9 @@ def register_plugin(self): triggered=self.findinfiles_callback, tip=_("Search text in multiple files")) - self.main.search_menu_actions += [None, findinfiles_action] - self.main.search_toolbar_actions += [None, findinfiles_action] + self.main.search_menu_actions += [MENU_SEPARATOR, findinfiles_action] + self.main.search_toolbar_actions += [MENU_SEPARATOR, + findinfiles_action] def refresh_plugin(self): """Refresh widget""" diff --git a/spyder/plugins/ipythonconsole.py b/spyder/plugins/ipythonconsole.py index 006d3705ec0..ac41defa1c5 100644 --- a/spyder/plugins/ipythonconsole.py +++ b/spyder/plugins/ipythonconsole.py @@ -50,7 +50,7 @@ from spyder.plugins.configdialog import PluginConfigPage from spyder.py3compat import (iteritems, PY2, to_binary_string, to_text_string) -from spyder.utils.qthelpers import create_action +from spyder.utils.qthelpers import create_action, MENU_SEPARATOR from spyder.utils import icon_manager as ima from spyder.utils import encoding, programs from spyder.utils.misc import (add_pathlist_to_PYTHONPATH, get_error_match, @@ -751,7 +751,7 @@ def get_plugin_actions(self): # Add the action to the 'Consoles' menu on the main window main_consoles_menu = self.main.consoles_menu_actions main_consoles_menu.insert(0, main_create_client_action) - main_consoles_menu += [None, connect_to_kernel_action] + main_consoles_menu += [MENU_SEPARATOR, connect_to_kernel_action] # Plugin actions self.menu_actions = [create_client_action, connect_to_kernel_action] diff --git a/spyder/plugins/projects.py b/spyder/plugins/projects.py index a790b282410..b4139c69349 100644 --- a/spyder/plugins/projects.py +++ b/spyder/plugins/projects.py @@ -24,7 +24,7 @@ from spyder.plugins import SpyderPluginMixin from spyder.py3compat import is_text_string, getcwd from spyder.utils import icon_manager as ima -from spyder.utils.qthelpers import add_actions, create_action +from spyder.utils.qthelpers import add_actions, create_action, MENU_SEPARATOR from spyder.widgets.projects.explorer import ProjectExplorerWidget from spyder.widgets.projects.projectdialog import ProjectDialog from spyder.widgets.projects import EmptyProject @@ -106,11 +106,11 @@ def get_plugin_actions(self): explorer_action = self.toggle_view_action self.main.projects_menu_actions += [self.new_project_action, - None, + MENU_SEPARATOR, self.open_project_action, self.close_project_action, self.delete_project_action, - None, + MENU_SEPARATOR, self.recent_project_menu, explorer_action] diff --git a/spyder/utils/qthelpers.py b/spyder/utils/qthelpers.py index 2c2d1837c6c..89ce61fec5d 100644 --- a/spyder/utils/qthelpers.py +++ b/spyder/utils/qthelpers.py @@ -499,6 +499,9 @@ def show_std_icons(): dialog.show() sys.exit(app.exec_()) + +MENU_SEPARATOR = None + if __name__ == "__main__": show_std_icons() diff --git a/spyder_pylint/pylint.py b/spyder_pylint/pylint.py index a5e2e050713..798f831bde2 100644 --- a/spyder_pylint/pylint.py +++ b/spyder_pylint/pylint.py @@ -23,7 +23,7 @@ from spyder.plugins import SpyderPluginMixin from spyder.plugins.configdialog import PluginConfigPage from spyder.utils import icon_manager as ima -from spyder.utils.qthelpers import create_action +from spyder.utils.qthelpers import create_action, MENU_SEPARATOR from .widgets.pylintgui import (PYLINT_PATH, PylintWidget) @@ -136,7 +136,7 @@ def register_plugin(self): self.register_shortcut(pylint_act, context="Pylint", name="Run analysis") - self.main.source_menu_actions += [None, pylint_act] + self.main.source_menu_actions += [MENU_SEPARATOR, pylint_act] self.main.editor.pythonfile_dependent_actions += [pylint_act] def refresh_plugin(self):