aboutsummaryrefslogtreecommitdiffstats
path: root/grc/gui
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui')
-rw-r--r--grc/gui/Actions.py6
-rw-r--r--grc/gui/Application.py8
-rw-r--r--grc/gui/Bars.py2
-rw-r--r--grc/gui/ParamWidgets.py17
-rw-r--r--grc/gui/PropsDialog.py15
-rw-r--r--grc/gui/canvas/block.py15
-rw-r--r--grc/gui/canvas/flowgraph.py16
-rw-r--r--grc/gui/canvas/param.py3
8 files changed, 50 insertions, 32 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..a792549b3 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.
@@ -686,6 +693,7 @@ class Application(Gtk.Application):
# Import the old data and mark the current as not saved
new_flow_graph.import_data(previous.export_data())
flow_graph_update(new_flow_graph)
+ page.state_cache.save_new_state(new_flow_graph.export_data())
page.saved = False
elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
file_path, background_transparent = FileDialogs.SaveScreenShot(main, page.file_path).run()
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/ParamWidgets.py b/grc/gui/ParamWidgets.py
index 3701a7181..d168b62d7 100644
--- a/grc/gui/ParamWidgets.py
+++ b/grc/gui/ParamWidgets.py
@@ -230,23 +230,6 @@ class EnumParam(InputParam):
def set_tooltip_text(self, text):
self._input.set_tooltip_text(text)
-class BoolParam(InputParam):
- """Provide a switch button for Bool types."""
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- self._input = Gtk.Switch()
- self._input.connect('state-set', self._apply_change)
- self._input.connect('state-set', self._editing_callback)
- self.pack_start(self._input, False, False, 0)
- value = self.param.get_value()
- self._input.set_active(eval(value))
-
- def get_text(self):
- return self._input.get_active()
-
- def set_tooltip_text(self, text):
- self._input.set_tooltip_text(text)
class EnumEntryParam(InputParam):
"""Provide an entry box and drop down menu for Raw Enum types."""
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index 1e23e0413..6bf2745a4 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
@@ -212,11 +216,12 @@ class PropsDialog(Gtk.Dialog):
buf.delete(buf.get_start_iter(), buf.get_end_iter())
pos = buf.get_end_iter()
- # Add link to wiki page for this block, at the top
- note = "Wiki Page for this Block: "
- prefix = self._config.wiki_block_docs_url_prefix
- suffix = self._block.label.replace(" ", "_")
- buf.insert(pos, note + prefix + suffix + '\n\n')
+ # Add link to wiki page for this block, at the top, as long as it's not an OOT block
+ if self._block.category[0] == "Core":
+ note = "Wiki Page for this Block: "
+ prefix = self._config.wiki_block_docs_url_prefix
+ suffix = self._block.label.replace(" ", "_")
+ buf.insert(pos, note + prefix + suffix + '\n\n')
docstrings = self._block.documentation.copy()
if not docstrings:
diff --git a/grc/gui/canvas/block.py b/grc/gui/canvas/block.py
index e55c76f2c..981077440 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)]
@@ -327,6 +329,17 @@ class Block(CoreBlock, Drawable):
))
return tuple(extent)
+ def get_extents_comment(self):
+ x, y = self.coordinate
+ if not self._comment_layout:
+ return x, y, x, y
+ if self.is_horizontal():
+ y += self.height + BLOCK_LABEL_PADDING
+ else:
+ x += self.height + BLOCK_LABEL_PADDING
+ w, h = self._comment_layout.get_pixel_size()
+ return x, y, x + w, y + h
+
##############################################
# Controller Modify
##############################################
diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py
index 248ea3ba2..9657930f1 100644
--- a/grc/gui/canvas/flowgraph.py
+++ b/grc/gui/canvas/flowgraph.py
@@ -804,9 +804,15 @@ class FlowGraph(CoreFlowgraph, Drawable):
return redraw
def get_extents(self):
- extent = 100000, 100000, 0, 0
- for element in self._elements_to_draw:
- extent = (min_or_max(xy, e_xy) for min_or_max, xy, e_xy in zip(
- (min, min, max, max), extent, element.get_extents()
- ))
+ show_comments = Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active()
+ def sub_extents():
+ for element in self._elements_to_draw:
+ yield element.get_extents()
+ if element.is_block and show_comments and element.enabled:
+ yield element.get_extents_comment()
+
+ extent = 10000000, 10000000, 0, 0
+ cmps = (min, min, max, max)
+ for sub_extent in sub_extents():
+ extent = [cmp(xy, e_xy) for cmp, xy, e_xy in zip(cmps, extent, sub_extent)]
return tuple(extent)
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py
index 2ff714c60..5777423c6 100644
--- a/grc/gui/canvas/param.py
+++ b/grc/gui/canvas/param.py
@@ -46,9 +46,6 @@ class Param(CoreParam):
elif dtype == 'enum':
input_widget_cls = ParamWidgets.EnumParam
- elif dtype == 'bool':
- input_widget_cls = ParamWidgets.BoolParam
-
elif self.options:
input_widget_cls = ParamWidgets.EnumEntryParam