commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/13: grc: option to hide disabled blocks


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/13: grc: option to hide disabled blocks
Date: Tue, 15 Apr 2014 23:55:53 +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 ab10b5bc162abc0e83abf13f7c754baff6b606c1
Author: Sebastian Koslowski <address@hidden>
Date:   Sat Mar 29 20:19:59 2014 +0100

    grc: option to hide disabled blocks
---
 grc/gui/ActionHandler.py |  4 +++-
 grc/gui/Actions.py       |  6 ++++++
 grc/gui/Bars.py          |  1 +
 grc/gui/FlowGraph.py     | 11 ++++++++++-
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 0d89987..aa692f5 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -115,7 +115,7 @@ class ActionHandler:
                 Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
                 Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
                 Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
-                Actions.TOGGLE_REPORTS_WINDOW,
+                Actions.TOGGLE_REPORTS_WINDOW, 
Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
             ): action.set_sensitive(True)
             if ParseXML.xml_failures:
                 Messages.send_xml_errors_if_any(ParseXML.xml_failures)
@@ -371,6 +371,8 @@ class ActionHandler:
             else:
                 self.main_window.btwin.hide()
             Preferences.blocks_window_visibility(visible)
+        elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS:
+            Actions.NOTHING_SELECT()
         ##################################################
         # Param Modifications
         ##################################################
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 284c78f..afbeb97 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -236,6 +236,12 @@ BLOCK_DISABLE = Action(
     stock_id=gtk.STOCK_DISCONNECT,
     keypresses=(gtk.keysyms.d, NO_MODS_MASK),
 )
+TOGGLE_HIDE_DISABLED_BLOCKS = ToggleAction(
+    label='Hide _disabled blocks',
+    tooltip='Toggle visibility of disabled blocks and connections',
+    stock_id=gtk.STOCK_MISSING_IMAGE,
+    keypresses=(gtk.keysyms.d, gtk.gdk.CONTROL_MASK),
+)
 BLOCK_CREATE_HIER = Action(
     label='C_reate Hier',
     tooltip='Create hier block from selected blocks',
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index f016209..ef8feb0 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -49,6 +49,7 @@ TOOLBAR_LIST = (
     None,
     Actions.BLOCK_ENABLE,
     Actions.BLOCK_DISABLE,
+    Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
     None,
     Actions.FIND_BLOCKS,
     Actions.RELOAD_BLOCKS,
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index c194dfb..1103aa1 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -37,7 +37,7 @@ class FlowGraph(Element):
 
     def __init__(self):
         """
-        FlowGraph contructor.
+        FlowGraph constructor.
         Create a list for signal blocks and connections. Connect mouse 
handlers.
         """
         Element.__init__(self)
@@ -309,6 +309,8 @@ class FlowGraph(Element):
             window.draw_rectangle(gc, False, x, y, w, h)
         #draw blocks on top of connections
         for element in self.get_connections() + self.get_blocks():
+            if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and not 
element.get_enabled():
+                continue  # skip hidden disabled blocks and connections
             element.draw(gc, window)
         #draw selected blocks on top of selected connections
         for selected_element in self.get_selected_connections() + 
self.get_selected_blocks():
@@ -374,6 +376,13 @@ class FlowGraph(Element):
         for element in reversed(self.get_elements()):
             selected_element = element.what_is_selected(coor, coor_m)
             if not selected_element: continue
+            # hidden disabled connections, blocks and their ports can not be 
selected
+            if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and (
+                selected_element.is_block() and not 
selected_element.get_enabled() or
+                selected_element.is_connection() and not 
selected_element.get_enabled() or
+                selected_element.is_port() and not 
selected_element.get_parent().get_enabled()
+            ):
+                continue
             #update the selected port information
             if selected_element.is_port():
                 if not coor_m: selected_port = selected_element



reply via email to

[Prev in Thread] Current Thread [Next in Thread]