From e30f0a7ca02801732ad7a25ab83e1d27dc45c6ce Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 20 Jan 2011 22:31:31 -0800 Subject: grc: added tabbed widget in qtgui for grc created gui_hint type to handle tab descriptor + position markup, and to handle the generation of the name of the parent widget. No support python modules required in gr-qtgui. --- grc/python/Generator.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'grc/python/Generator.py') diff --git a/grc/python/Generator.py b/grc/python/Generator.py index d53802bef..7d08b914b 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -100,6 +100,10 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') filter(lambda b: b.get_key() == 'notebook', blocks), lambda n: n.get_id(), lambda n: n.get_param('notebook').get_value(), ) + notebooks += expr_utils.sort_objects( + filter(lambda b: b.get_key() == 'qtgui_tab_widget', blocks), + lambda n: n.get_id(), lambda n: n.get_param('gui_hint').get_value(), + ) #list of regular blocks (all blocks minus the special ones) blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes #list of connections where each endpoint is enabled -- cgit From 47f621a14c9a6e3696155dd5a223da40bcb7721c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 27 Feb 2011 23:18:11 -0800 Subject: grc: work on generator for gui flowgraphs to simplify generation generator does not differentiate between notebooks and controls, they are all block, but block are now sorted by variables present in the make also adjusted categories listed in the wx and qt widget related blocks --- grc/python/Generator.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'grc/python/Generator.py') diff --git a/grc/python/Generator.py b/grc/python/Generator.py index 7d08b914b..b669fa65a 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009, 2010 Free Software Foundation, Inc. +Copyright 2008-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -90,22 +90,20 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') imports = self._flow_graph.get_imports() variables = self._flow_graph.get_variables() parameters = self._flow_graph.get_parameters() - #list of variables with controls - controls = filter(lambda v: v.get_make(), variables) #list of blocks not including variables and imports and parameters and disabled - blocks = sorted(self._flow_graph.get_enabled_blocks(), lambda x, y: cmp(x.get_id(), y.get_id())) - probes = filter(lambda b: b.get_key().startswith('probe_'), blocks) #ensure probes are last in the block list - #get a list of notebooks and sort them according dependencies - notebooks = expr_utils.sort_objects( - filter(lambda b: b.get_key() == 'notebook', blocks), - lambda n: n.get_id(), lambda n: n.get_param('notebook').get_value(), - ) - notebooks += expr_utils.sort_objects( - filter(lambda b: b.get_key() == 'qtgui_tab_widget', blocks), - lambda n: n.get_id(), lambda n: n.get_param('gui_hint').get_value(), + def _get_block_sort_text(block): + code = block.get_make().replace(block.get_id(), ' ') + try: code += block.get_param('notebook').get_value() #older gui markup w/ wxgui + except: pass + try: code += block.get_param('gui_hint').get_value() #newer gui markup w/ qtgui + except: pass + return code + blocks = expr_utils.sort_objects( + self._flow_graph.get_enabled_blocks(), + lambda b: b.get_id(), _get_block_sort_text ) #list of regular blocks (all blocks minus the special ones) - blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes + blocks = filter(lambda b: b not in (imports + parameters), blocks) #list of connections where each endpoint is enabled connections = filter(lambda c: not c.is_msg(), self._flow_graph.get_enabled_connections()) messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections()) @@ -129,8 +127,6 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''') 'imports': imports, 'flow_graph': self._flow_graph, 'variables': variables, - 'notebooks': notebooks, - 'controls': controls, 'parameters': parameters, 'blocks': blocks, 'connections': connections, -- cgit