From 9988664127b367fa8fee4409f8460673d6f265e1 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 23 Jun 2009 20:38:18 +0000 Subject: Merging r11186:11273 from grc branch. Fixes, features, and reorganization for grc. Minor fixes and features for wxgui forms. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11274 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/gui/Bars.py | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 grc/gui/Bars.py (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py new file mode 100644 index 000000000..e0c547eba --- /dev/null +++ b/grc/gui/Bars.py @@ -0,0 +1,138 @@ +""" +Copyright 2007, 2008, 2009 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +import Actions +import pygtk +pygtk.require('2.0') +import gtk + +##The list of actions for the toolbar. +TOOLBAR_LIST = ( + Actions.FLOW_GRAPH_NEW, + Actions.FLOW_GRAPH_OPEN, + Actions.FLOW_GRAPH_SAVE, + Actions.FLOW_GRAPH_CLOSE, + None, + Actions.FLOW_GRAPH_SCREEN_CAPTURE, + None, + Actions.BLOCK_CUT, + Actions.BLOCK_COPY, + Actions.BLOCK_PASTE, + Actions.ELEMENT_DELETE, + None, + Actions.FLOW_GRAPH_UNDO, + Actions.FLOW_GRAPH_REDO, + None, + Actions.FLOW_GRAPH_GEN, + Actions.FLOW_GRAPH_EXEC, + Actions.FLOW_GRAPH_KILL, + None, + Actions.BLOCK_ROTATE_CCW, + Actions.BLOCK_ROTATE_CW, + None, + Actions.BLOCK_ENABLE, + Actions.BLOCK_DISABLE, +) + +##The list of actions and categories for the menu bar. +MENU_BAR_LIST = ( + (gtk.Action('File', '_File', None, None), [ + Actions.FLOW_GRAPH_NEW, + Actions.FLOW_GRAPH_OPEN, + None, + Actions.FLOW_GRAPH_SAVE, + Actions.FLOW_GRAPH_SAVE_AS, + None, + Actions.FLOW_GRAPH_SCREEN_CAPTURE, + None, + Actions.FLOW_GRAPH_CLOSE, + Actions.APPLICATION_QUIT, + ]), + (gtk.Action('Edit', '_Edit', None, None), [ + Actions.FLOW_GRAPH_UNDO, + Actions.FLOW_GRAPH_REDO, + None, + Actions.BLOCK_CUT, + Actions.BLOCK_COPY, + Actions.BLOCK_PASTE, + Actions.ELEMENT_DELETE, + None, + Actions.BLOCK_ROTATE_CCW, + Actions.BLOCK_ROTATE_CW, + None, + Actions.BLOCK_ENABLE, + Actions.BLOCK_DISABLE, + None, + Actions.BLOCK_PARAM_MODIFY, + ]), + (gtk.Action('Build', '_Build', None, None), [ + Actions.FLOW_GRAPH_GEN, + Actions.FLOW_GRAPH_EXEC, + Actions.FLOW_GRAPH_KILL, + ]), + (gtk.Action('Help', '_Help', None, None), [ + Actions.HELP_WINDOW_DISPLAY, + Actions.COLORS_WINDOW_DISPLAY, + None, + Actions.ABOUT_WINDOW_DISPLAY, + ]), +) + +class Toolbar(gtk.Toolbar): + """The gtk toolbar with actions added from the toolbar list.""" + + def __init__(self): + """ + Parse the list of action names in the toolbar list. + Look up the action for each name in the action list and add it to the toolbar. + """ + gtk.Toolbar.__init__(self) + self.set_style(gtk.TOOLBAR_ICONS) + for action_name in TOOLBAR_LIST: + if action_name: #add a tool item + action = Actions.get_action_from_name(action_name) + self.add(action.create_tool_item()) + #this reset of the tooltip property is required (after creating the tool item) for the tooltip to show + action.set_property('tooltip', action.get_property('tooltip')) + else: self.add(gtk.SeparatorToolItem()) + +class MenuBar(gtk.MenuBar): + """The gtk menu bar with actions added from the menu bar list.""" + + def __init__(self): + """ + Parse the list of submenus from the menubar list. + For each submenu, get a list of action names. + Look up the action for each name in the action list and add it to the submenu. + Add the submenu to the menu bar. + """ + gtk.MenuBar.__init__(self) + for main_action,action_names in MENU_BAR_LIST: + #create the main menu item + main_menu_item = main_action.create_menu_item() + self.append(main_menu_item) + #create the menu + main_menu = gtk.Menu() + main_menu_item.set_submenu(main_menu) + for action_name in action_names: + if action_name: #append a menu item + action = Actions.get_action_from_name(action_name) + main_menu.append(action.create_menu_item()) + else: main_menu.append(gtk.SeparatorMenuItem()) + main_menu.show_all() #this show all is required for the separators to show -- cgit From b8df6584312f1f03d0bf86375945b8d743b6a6d7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Aug 2009 20:40:36 -0700 Subject: renamed the colors dialog to types --- grc/gui/Bars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index e0c547eba..697d48a3c 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -88,7 +88,7 @@ MENU_BAR_LIST = ( ]), (gtk.Action('Help', '_Help', None, None), [ Actions.HELP_WINDOW_DISPLAY, - Actions.COLORS_WINDOW_DISPLAY, + Actions.TYPES_WINDOW_DISPLAY, None, Actions.ABOUT_WINDOW_DISPLAY, ]), -- cgit From 91a83e6f1fda6483bfd4b449a1ef7903a00af0ab Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 13 Sep 2009 02:14:27 -0700 Subject: Reworked actions api and actions objects: Created standardized Action object for all gui actions. Actions module constants are actual Action objects (not strings). Keypresses, labels, tooltips, stock icons, etc all associate in the Action constructor. Usage of the action's signaling call () eliminated the need for a reference to handle_states. --- grc/gui/Bars.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 697d48a3c..fff5ebc08 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -104,9 +104,8 @@ class Toolbar(gtk.Toolbar): """ gtk.Toolbar.__init__(self) self.set_style(gtk.TOOLBAR_ICONS) - for action_name in TOOLBAR_LIST: - if action_name: #add a tool item - action = Actions.get_action_from_name(action_name) + for action in TOOLBAR_LIST: + if action: #add a tool item self.add(action.create_tool_item()) #this reset of the tooltip property is required (after creating the tool item) for the tooltip to show action.set_property('tooltip', action.get_property('tooltip')) @@ -123,16 +122,15 @@ class MenuBar(gtk.MenuBar): Add the submenu to the menu bar. """ gtk.MenuBar.__init__(self) - for main_action,action_names in MENU_BAR_LIST: + for main_action, actions in MENU_BAR_LIST: #create the main menu item main_menu_item = main_action.create_menu_item() self.append(main_menu_item) #create the menu main_menu = gtk.Menu() main_menu_item.set_submenu(main_menu) - for action_name in action_names: - if action_name: #append a menu item - action = Actions.get_action_from_name(action_name) + for action in actions: + if action: #append a menu item main_menu.append(action.create_menu_item()) else: main_menu.append(gtk.SeparatorMenuItem()) main_menu.show_all() #this show all is required for the separators to show -- cgit From 14895064d7345c2223ff2b8ff3b9cbcdf69dd8c9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 18 Sep 2009 02:10:13 -0700 Subject: added errors dialog to show all error messages in flow graph --- grc/gui/Bars.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index fff5ebc08..17835eb00 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -81,6 +81,9 @@ MENU_BAR_LIST = ( None, Actions.BLOCK_PARAM_MODIFY, ]), + (gtk.Action('View', '_View', None, None), [ + Actions.ERRORS_WINDOW_DISPLAY, + ]), (gtk.Action('Build', '_Build', None, None), [ Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, -- cgit From d28d40d33dac481296e1f836ec57f1018041d418 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 18 Sep 2009 02:22:43 -0700 Subject: put the flow graph errors button into the toolbar --- grc/gui/Bars.py | 1 + 1 file changed, 1 insertion(+) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 17835eb00..8fd167869 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -39,6 +39,7 @@ TOOLBAR_LIST = ( Actions.FLOW_GRAPH_UNDO, Actions.FLOW_GRAPH_REDO, None, + Actions.ERRORS_WINDOW_DISPLAY, Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL, -- cgit From a07fe1904412af78b3d70a6225e6efe10c9efbe5 Mon Sep 17 00:00:00 2001 From: Tim O'Shea Date: Tue, 25 Sep 2012 11:40:10 -0400 Subject: adding GRC Reload Block XML action --- grc/gui/Bars.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 8fd167869..0cdbdbb12 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -49,6 +49,8 @@ TOOLBAR_LIST = ( None, Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, + None, + Actions.RELOAD_BLOCKS, ) ##The list of actions and categories for the menu bar. -- cgit From 515d1b6f91f5dd28997525b1e88006bbfc0f170a Mon Sep 17 00:00:00 2001 From: Tim O'Shea Date: Wed, 26 Sep 2012 14:18:30 -0400 Subject: added the ability to open custom GRC hier block definitions from graphs using an instance of them --- grc/gui/Bars.py | 1 + 1 file changed, 1 insertion(+) (limited to 'grc/gui/Bars.py') diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 0cdbdbb12..d95d23f1f 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -51,6 +51,7 @@ TOOLBAR_LIST = ( Actions.BLOCK_DISABLE, None, Actions.RELOAD_BLOCKS, + Actions.OPEN_HIER, ) ##The list of actions and categories for the menu bar. -- cgit