[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 29/43: grc: move context def into Bars.py a
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 29/43: grc: move context def into Bars.py and add submenu |
Date: |
Thu, 2 Apr 2015 19:15:51 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit a601b909daabe84c1a3c31ba13456e48c3871e46
Author: Sebastian Koslowski <address@hidden>
Date: Thu Apr 2 13:20:19 2015 +0200
grc: move context def into Bars.py and add submenu
---
grc/gui/Bars.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---
grc/gui/FlowGraph.py | 21 ++-------------------
2 files changed, 52 insertions(+), 22 deletions(-)
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index 5041a28..6ce614b 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -121,6 +121,30 @@ MENU_BAR_LIST = (
Actions.ABOUT_WINDOW_DISPLAY,
]),
)
+
+
+CONTEXT_MENU_LIST = [
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.ELEMENT_DELETE,
+ None,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
+ None,
+ (gtk.Action('More', '_More', None, None), [
+ Actions.BLOCK_CREATE_HIER,
+ Actions.OPEN_HIER,
+ None,
+ Actions.BUSSIFY_SOURCES,
+ Actions.BUSSIFY_SINKS,
+ ]),
+ Actions.BLOCK_PARAM_MODIFY
+]
+
+
class Toolbar(gtk.Toolbar):
"""The gtk toolbar with actions added from the toolbar list."""
@@ -138,6 +162,7 @@ class Toolbar(gtk.Toolbar):
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."""
@@ -157,7 +182,29 @@ class MenuBar(gtk.MenuBar):
main_menu = gtk.Menu()
main_menu_item.set_submenu(main_menu)
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.append(action.create_menu_item() if action else
+ gtk.SeparatorMenuItem())
main_menu.show_all() #this show all is required for the separators
to show
+
+
+class ContextMenu(gtk.Menu):
+ """The gtk menu with actions added from the context menu list."""
+
+ def __init__(self):
+ gtk.Menu.__init__(self)
+ for action in CONTEXT_MENU_LIST:
+ if isinstance(action, tuple):
+ action, sub_menu_action_list = action
+ item = action.create_menu_item()
+ self.append(item)
+ sub_menu = gtk.Menu()
+ item.set_submenu(sub_menu)
+ for action in sub_menu_action_list:
+ sub_menu.append(action.create_menu_item() if action else
+ gtk.SeparatorMenuItem())
+ sub_menu.show_all()
+
+ else:
+ self.append(action.create_menu_item() if action else
+ gtk.SeparatorMenuItem())
+ self.show_all()
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 794d992..f8be2f6 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -27,6 +27,7 @@ pygtk.require('2.0')
import gtk
import random
import Messages
+import Bars
class FlowGraph(Element):
"""
@@ -54,25 +55,7 @@ class FlowGraph(Element):
# current mouse hover element
self.element_under_mouse = None
#context menu
- self._context_menu = gtk.Menu()
- for action in [
- Actions.BLOCK_CUT,
- Actions.BLOCK_COPY,
- Actions.BLOCK_PASTE,
- Actions.ELEMENT_DELETE,
- None,
- Actions.BLOCK_ROTATE_CCW,
- Actions.BLOCK_ROTATE_CW,
- Actions.BLOCK_ENABLE,
- Actions.BLOCK_DISABLE,
- None,
- Actions.BLOCK_CREATE_HIER,
- Actions.OPEN_HIER,
- Actions.BUSSIFY_SOURCES,
- Actions.BUSSIFY_SINKS,
- None,
- Actions.BLOCK_PARAM_MODIFY
- ]: self._context_menu.append(action.create_menu_item() if action else
gtk.SeparatorMenuItem())
+ self._context_menu = Bars.ContextMenu()
self.get_context_menu = lambda: self._context_menu
###########################################################################
- [Commit-gnuradio] [gnuradio] 34/43: Merge remote-tracking branch 'saikwolf/logging_flat_flowgraph', (continued)
- [Commit-gnuradio] [gnuradio] 34/43: Merge remote-tracking branch 'saikwolf/logging_flat_flowgraph', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 03/43: gnuradio-runtime:: removed the individual port setting on hier_block2, current operation assuming the buffers are being set for latency and therefore all blocks are being set to a small amount, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 11/43: fec: LDPC cleaning up comments, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 30/43: grc: clean-up 'gnuradio-companion', add mode 'run from source', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 12/43: fec: re-shuffling LDPC make helper, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 31/43: grc: PropsDialog: apply button and hotkey (Ctrl+Enter), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 40/43: fec: Move the definition of yp_kernel from the class into a temp variable in the main code. This variable is used just to find the actual Volk kernel, and its current use is not c++11 complaint. Moving it makes the code c++11 complaint on both GCC / libstdc++ and Clang / libc++., git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 35/43: Merge remote-tracking branch 'osh/ldpc_add', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 20/43: grc: Reworked save confirmation dialog to allow cancel option, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 42/43: Merge remote-tracking branch 'michaelld/misc_fixes', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 29/43: grc: move context def into Bars.py and add submenu,
git <=
- [Commit-gnuradio] [gnuradio] 14/43: gnuradio-runtime: modified buffer length types to size_t, moved buffer length vectors into detail, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 22/43: grc: close unsaved pages first (for cancel save option), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 13/43: fec: ldpc GRC compat cleanup, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 36/43: Merge remote-tracking branch 'fengzhe/chunks_to_symbols_update', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 25/43: grc: set permissions for generated files, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 08/43: fec: adding ldpc encoder and decoder, initial compile working, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 23/43: grc: make use of GRC_HIER_PATH at runtime, git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 33/43: Merge remote-tracking branch 'saikwolf/hier_buff_tweak', git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 24/43: grc: use 'import' for grc-generated hier_blocks (#763), git, 2015/04/02
- [Commit-gnuradio] [gnuradio] 02/43: gnuradio-runtime: updated hier_block2 and hier_block_detail to allow for propagation of min/max output buffer to all blocks within the hier, git, 2015/04/02