aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Morman <jmorman@perspectalabs.com>2019-08-30 15:26:43 -0400
committerMartin Braun <martin.braun@ettus.com>2019-09-17 14:30:50 -0500
commit44a6f5ddc82233730c9702888c6796874a352f07 (patch)
tree0d5dd53ff823d33821896930a962b0e83d43ade5
parentfft_shift: use unit test macros that exist in Boost 1.53 (diff)
downloadgnuradio-44a6f5ddc82233730c9702888c6796874a352f07.tar.xz
gnuradio-44a6f5ddc82233730c9702888c6796874a352f07.zip
grc: option toggle the show id on all blocks
Addresses the issue of losing access to the block id on many/most blocks though there are scenarios where you may need to see them in GRC Added a menu item tied into the grc prefs that will show the block ids Fixes #2780
-rw-r--r--grc/gui/Actions.py6
-rw-r--r--grc/gui/Application.py7
-rw-r--r--grc/gui/Bars.py2
-rw-r--r--grc/gui/PropsDialog.py4
-rw-r--r--grc/gui/canvas/block.py4
5 files changed, 21 insertions, 2 deletions
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 8497565b2..be157d90b 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -400,6 +400,12 @@ TOGGLE_HIDE_VARIABLES = actions.register("win.hide_variables",
preference_name='hide_variables',
default=False,
)
+TOGGLE_SHOW_BLOCK_IDS = actions.register("win.show_block_ids",
+ label='Show All Block IDs',
+ tooltip='Show all the block IDs',
+ preference_name='show_block_ids',
+ default=False,
+)
TOGGLE_FLOW_GRAPH_VAR_EDITOR = actions.register("win.toggle_variable_editor",
label='Show _Variable Editor',
tooltip='Show the variable editor. Modify variables and imports in this flow graph',
diff --git a/grc/gui/Application.py b/grc/gui/Application.py
index 3fee7a001..6b773f413 100644
--- a/grc/gui/Application.py
+++ b/grc/gui/Application.py
@@ -204,6 +204,7 @@ class Application(Gtk.Application):
Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR,
Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR,
Actions.TOGGLE_HIDE_VARIABLES,
+ Actions.TOGGLE_SHOW_BLOCK_IDS,
):
action.set_enabled(True)
if hasattr(action, 'load_from_preferences'):
@@ -512,6 +513,12 @@ class Application(Gtk.Application):
action.save_to_preferences()
varedit.save_to_preferences()
flow_graph_update()
+ elif action == Actions.TOGGLE_SHOW_BLOCK_IDS:
+ action.set_active(not action.get_active())
+ active = action.get_active()
+ Actions.NOTHING_SELECT()
+ action.save_to_preferences()
+ flow_graph_update()
elif action == Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR:
# TODO: There may be issues at startup since these aren't triggered
# the same was as Gtk.Actions when loading preferences.
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index 6fde43a4d..83edbb1cd 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -83,7 +83,7 @@ MENU_BAR_LIST = [
[Actions.TOGGLE_BLOCKS_WINDOW],
[Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_SCROLL_LOCK, Actions.SAVE_CONSOLE, Actions.CLEAR_CONSOLE],
[Actions.TOGGLE_HIDE_VARIABLES, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR],
- [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS],
+ [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS, Actions.TOGGLE_SHOW_BLOCK_IDS,],
[Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB],
[Actions.ERRORS_WINDOW_DISPLAY, Actions.FIND_BLOCKS],
]),
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index 1e23e0413..7d0226d20 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -180,7 +180,11 @@ class PropsDialog(Gtk.Dialog):
# child.destroy() # disabled because it throws errors...
# repopulate the params box
box_all_valid = True
+ force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active()
+
for param in self._block.params.values():
+ if force_show_id and param.dtype == 'id':
+ param.hide = 'none'
# todo: why do we even rebuild instead of really hiding params?
if param.category != category or param.hide == 'all':
continue
diff --git a/grc/gui/canvas/block.py b/grc/gui/canvas/block.py
index e55c76f2c..9323949c7 100644
--- a/grc/gui/canvas/block.py
+++ b/grc/gui/canvas/block.py
@@ -165,11 +165,13 @@ class Block(CoreBlock, Drawable):
)
)
title_width, title_height = title_layout.get_size()
+
+ force_show_id = Actions.TOGGLE_SHOW_BLOCK_IDS.get_active()
# update the params layout
if not self.is_dummy_block:
markups = [param.format_block_surface_markup()
- for param in self.params.values() if param.hide not in ('all', 'part')]
+ for param in self.params.values() if (param.hide not in ('all', 'part') or (param.dtype == 'id' and force_show_id))]
else:
markups = ['<span font_desc="{font}"><b>key: </b>{key}</span>'.format(font=PARAM_FONT, key=self.key)]