diff options
Diffstat (limited to 'grc/gui/Bars.py')
-rw-r--r-- | grc/gui/Bars.py | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 86eb3a5716..84867a8b4c 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -42,11 +42,14 @@ TOOLBAR_LIST = [ (Actions.FLOW_GRAPH_OPEN, 'flow_graph_recent'), Actions.FLOW_GRAPH_SAVE, Actions.FLOW_GRAPH_CLOSE], [Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.FLOW_GRAPH_SCREEN_CAPTURE], - [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE], + [Actions.BLOCK_CUT, Actions.BLOCK_COPY, + Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE], [Actions.FLOW_GRAPH_UNDO, Actions.FLOW_GRAPH_REDO], - [Actions.ERRORS_WINDOW_DISPLAY, Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL], + [Actions.ERRORS_WINDOW_DISPLAY, Actions.FLOW_GRAPH_GEN, + Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL], [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW], - [Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS, Actions.TOGGLE_HIDE_DISABLED_BLOCKS], + [Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, + Actions.BLOCK_BYPASS, Actions.TOGGLE_HIDE_DISABLED_BLOCKS], [Actions.FIND_BLOCKS, Actions.RELOAD_BLOCKS, Actions.OPEN_HIER] ] @@ -56,23 +59,28 @@ MENU_BAR_LIST = [ ('_File', [ [(Actions.FLOW_GRAPH_NEW, 'flow_graph_new_type'), Actions.FLOW_GRAPH_DUPLICATE, Actions.FLOW_GRAPH_OPEN, (Actions.FLOW_GRAPH_OPEN_RECENT, 'flow_graph_recent')], - [Actions.FLOW_GRAPH_SAVE, Actions.FLOW_GRAPH_SAVE_AS, Actions.FLOW_GRAPH_SAVE_COPY], + [Actions.FLOW_GRAPH_SAVE, Actions.FLOW_GRAPH_SAVE_AS, + Actions.FLOW_GRAPH_SAVE_COPY], [Actions.FLOW_GRAPH_SCREEN_CAPTURE], [Actions.FLOW_GRAPH_CLOSE, Actions.APPLICATION_QUIT] ]), ('_Edit', [ [Actions.FLOW_GRAPH_UNDO, Actions.FLOW_GRAPH_REDO], - [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE, Actions.SELECT_ALL], - [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, ('_Align', Actions.BLOCK_ALIGNMENTS)], + [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, + Actions.ELEMENT_DELETE, Actions.SELECT_ALL], + [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, + ('_Align', Actions.BLOCK_ALIGNMENTS)], [Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS], [Actions.BLOCK_PARAM_MODIFY] ]), ('_View', [ [Actions.TOGGLE_BLOCKS_WINDOW], - [Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_SCROLL_LOCK, Actions.SAVE_CONSOLE, Actions.CLEAR_CONSOLE], + [Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_SCROLL_LOCK, + Actions.SAVE_CONSOLE, Actions.CLEAR_CONSOLE], [Actions.TOGGLE_HIDE_VARIABLES, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR, Actions.TOGGLE_SHOW_PARAMETER_EXPRESSION, Actions.TOGGLE_SHOW_PARAMETER_EVALUATION], - [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS, Actions.TOGGLE_SHOW_BLOCK_IDS,], + [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, + Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS, Actions.TOGGLE_SHOW_BLOCK_IDS, ], [Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB], [Actions.ZOOM_IN], [Actions.ZOOM_OUT], @@ -87,15 +95,18 @@ MENU_BAR_LIST = [ [Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY] ]), ('_Help', [ - [Actions.HELP_WINDOW_DISPLAY, Actions.TYPES_WINDOW_DISPLAY, Actions.KEYBOARD_SHORTCUTS_WINDOW_DISPLAY, Actions.XML_PARSER_ERRORS_DISPLAY], + [Actions.HELP_WINDOW_DISPLAY, Actions.TYPES_WINDOW_DISPLAY, + Actions.KEYBOARD_SHORTCUTS_WINDOW_DISPLAY, Actions.XML_PARSER_ERRORS_DISPLAY], [Actions.GET_INVOLVED_WINDOW_DISPLAY, Actions.ABOUT_WINDOW_DISPLAY] ])] # The list of actions for the context menu. CONTEXT_MENU_LIST = [ - [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE], - [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS], + [Actions.BLOCK_CUT, Actions.BLOCK_COPY, + Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE], + [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, + Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS], [("_More", [ [Actions.BLOCK_CREATE_HIER, Actions.OPEN_HIER], [Actions.BUSSIFY_SOURCES, Actions.BUSSIFY_SINKS] @@ -181,7 +192,8 @@ class MenuHelper(SubMenuHelper): target = "{}.{}".format(parent.prefix, parent.name) menuitem = Gio.MenuItem.new(label, None) if hasattr(parent, "icon_name"): - menuitem.set_icon(Gio.Icon.new_for_string(parent.icon_name)) + menuitem.set_icon( + Gio.Icon.new_for_string(parent.icon_name)) # Create the new submenu if isinstance(child, list): @@ -216,6 +228,7 @@ class MenuHelper(SubMenuHelper): parent_obj.remove(obj_idx) parent_obj.insert_item(obj_idx, obj) + class ToolbarHelper(SubMenuHelper): """ Builds a toolbar from a given list of actions. @@ -275,6 +288,7 @@ class ToolbarHelper(SubMenuHelper): create_func, parent_obj, _, obj, set_func = self.submenus[name] set_func(obj, create_func()) + class Menu(Gio.Menu, MenuHelper): """ Main Menu """ @@ -309,7 +323,7 @@ class Toolbar(Gtk.Toolbar, ToolbarHelper): ToolbarHelper.__init__(self) self.set_style(Gtk.ToolbarStyle.ICONS) - #self.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR) + # self.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR) - #SubMenuCreator.__init__(self) + # SubMenuCreator.__init__(self) self.build_toolbar(TOOLBAR_LIST, self) |