commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 02/05: grc: add toggle switch to hide comme


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/05: grc: add toggle switch to hide comments
Date: Sat, 4 Apr 2015 17:45:40 +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 74fe1d0ea867a3971e369218e4da411f75b4d5ad
Author: Sebastian Koslowski <address@hidden>
Date:   Thu Apr 2 11:58:56 2015 +0200

    grc: add toggle switch to hide comments
---
 grc/gui/ActionHandler.py | 8 ++++++--
 grc/gui/Actions.py       | 5 +++++
 grc/gui/Bars.py          | 1 +
 grc/gui/FlowGraph.py     | 9 +++++----
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 6dc088c..83ce5ff 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -122,7 +122,8 @@ class ActionHandler:
                 Actions.TOGGLE_REPORTS_WINDOW, 
Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
                 Actions.TOOLS_RUN_FDESIGN, Actions.TOGGLE_SCROLL_LOCK,
                 Actions.CLEAR_REPORTS, Actions.SAVE_REPORTS,
-                Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, 
Actions.TOGGLE_SNAP_TO_GRID
+                Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, 
Actions.TOGGLE_SNAP_TO_GRID,
+                Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
             ): action.set_sensitive(True)
             if ParseXML.xml_failures:
                 Messages.send_xml_errors_if_any(ParseXML.xml_failures)
@@ -143,7 +144,8 @@ class ActionHandler:
                 Actions.TOGGLE_BLOCKS_WINDOW,
                 Actions.TOGGLE_AUTO_HIDE_PORT_LABELS,
                 Actions.TOGGLE_SCROLL_LOCK,
-                Actions.TOGGLE_SNAP_TO_GRID
+                Actions.TOGGLE_SNAP_TO_GRID,
+                Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
             ): action.load_from_preferences()
         elif action == Actions.APPLICATION_QUIT:
             if self.main_window.close_pages():
@@ -401,6 +403,8 @@ class ActionHandler:
                 page.get_flow_graph().create_shapes()
         elif action == Actions.TOGGLE_SNAP_TO_GRID:
             action.save_to_preferences()
+        elif action == Actions.TOGGLE_SHOW_BLOCK_COMMENTS:
+            action.save_to_preferences()
         ##################################################
         # Param Modifications
         ##################################################
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 26c827f..b2b3a76 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -263,6 +263,11 @@ TOGGLE_AUTO_HIDE_PORT_LABELS = ToggleAction(
     tooltip='Automatically hide port labels',
     preference_name='auto_hide_port_labels'
 )
+TOGGLE_SHOW_BLOCK_COMMENTS = ToggleAction(
+    label='Show Block Comments',
+    tooltip="Show comment beneath each block",
+    preference_name='show_block_comments'
+)
 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 6ce614b..40ce205 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -99,6 +99,7 @@ MENU_BAR_LIST = (
         Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
         Actions.TOGGLE_AUTO_HIDE_PORT_LABELS,
         Actions.TOGGLE_SNAP_TO_GRID,
+        Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
         None,
         Actions.ERRORS_WINDOW_DISPLAY,
         Actions.FIND_BLOCKS,
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index d512a67..51b522a 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -282,10 +282,11 @@ class FlowGraph(Element):
         window.draw_rectangle(gc, True, 0, 0, W, H)
         # draw comments first
         hide_disabled_blocks = Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active()
-        for block in self.get_blocks():
-            if hide_disabled_blocks and not block.get_enabled():
-                continue  # skip hidden disabled block comments
-            block.draw_comment(gc, window)
+        if Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active():
+            for block in self.get_blocks():
+                if hide_disabled_blocks and not block.get_enabled():
+                    continue  # skip hidden disabled block comments
+                block.draw_comment(gc, window)
         #draw multi select rectangle
         if self.mouse_pressed and (not self.get_selected_elements() or 
self.get_ctrl_mask()):
             #coordinates



reply via email to

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