summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Koslowski <koslowski@kit.edu>2015-04-02 11:58:56 +0200
committerSebastian Koslowski <koslowski@kit.edu>2015-04-03 22:17:59 +0200
commit74fe1d0ea867a3971e369218e4da411f75b4d5ad (patch)
treef8281ecfcbdd3fba703bca8aa417efdaa174ce99
parent3271e9f31c11a4fc36a3989e236f2dc919bda86b (diff)
grc: add toggle switch to hide comments
-rw-r--r--grc/gui/ActionHandler.py8
-rw-r--r--grc/gui/Actions.py5
-rw-r--r--grc/gui/Bars.py1
-rw-r--r--grc/gui/FlowGraph.py9
4 files changed, 17 insertions, 6 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 6dc088c36d..83ce5ff8ce 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 26c827f346..b2b3a76386 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 6ce614bc99..40ce20536c 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 d512a6793d..51b522a2d5 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