From deb7e98d2c413869e6615fb011f24c2a9944c6d3 Mon Sep 17 00:00:00 2001 From: jblum Date: Thu, 25 Jun 2009 17:59:26 +0000 Subject: [PATCH] better fix for selected ports, added variable config example to examples git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11283 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/examples/Makefile.am | 1 + grc/examples/simple/variable_config.grc | 329 ++++++++++++++++++++++++ grc/gui/FlowGraph.py | 8 +- grc/todo.txt | 1 - 4 files changed, 334 insertions(+), 5 deletions(-) create mode 100644 grc/examples/simple/variable_config.grc diff --git a/grc/examples/Makefile.am b/grc/examples/Makefile.am index 95f352a6..969485c0 100644 --- a/grc/examples/Makefile.am +++ b/grc/examples/Makefile.am @@ -31,6 +31,7 @@ simpledatadir = $(grc_examples_prefix)/simple dist_simpledata_DATA = \ simple/ber_simulation.grc \ simple/dpsk_loopback.grc \ + simple/variable_config.grc \ simple/var_sink_taps.grc trellisdatadir = $(grc_examples_prefix)/trellis diff --git a/grc/examples/simple/variable_config.grc b/grc/examples/simple/variable_config.grc new file mode 100644 index 00000000..95c287cc --- /dev/null +++ b/grc/examples/simple/variable_config.grc @@ -0,0 +1,329 @@ + + + Thu Jun 25 10:56:04 2009 + + options + + id + variable_config_demo + + + _enabled + True + + + title + Variable Config Block Demonstration + + + author + Example + + + description + Save/Load freq from a config file. + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + autostart + True + + + realtime_scheduling + + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 32000 + + + _coordinate + (10, 170) + + + _rotation + 0 + + + + variable_config + + id + freq_init + + + _enabled + True + + + value + 1000 + + + type + real + + + config_file + config.conf + + + section + main + + + option + freq + + + writeback + freq + + + _coordinate + (255, 17) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency (Hz) + + + value + freq_init + + + min + -samp_rate/2 + + + max + samp_rate/2 + + + num_steps + 100 + + + style + wx.SL_HORIZONTAL + + + converver + float_converter + + + grid_pos + + + + _coordinate + (429, 24) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle_0 + + + _enabled + True + + + type + complex + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (392, 233) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x_0 + + + _enabled + True + + + type + complex + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + freq + + + amp + 1 + + + offset + 0 + + + _coordinate + (148, 233) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2_0 + + + _enabled + True + + + type + complex + + + title + FFT Plot + + + samp_rate + samp_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 10 + + + ref_level + 50 + + + fft_size + 1024 + + + fft_rate + 30 + + + peak_hold + False + + + average + False + + + avg_alpha + 0 + + + grid_pos + + + + _coordinate + (671, 233) + + + _rotation + 0 + + + + gr_sig_source_x_0 + gr_throttle_0 + 0 + 0 + + + gr_throttle_0 + wxgui_fftsink2_0 + 0 + 0 + + diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index 63f28902..f8028f19 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -281,10 +281,10 @@ class FlowGraph(Element): for selected in selected_elements: if selected in elements: continue selected_elements.remove(selected) - if self._old_selected_port not in elements: - self._old_selected_port = None - if self._new_selected_port not in elements: - self._new_selected_port = None + try: assert self._old_selected_port.get_parent() in elements + except: self._old_selected_port = None + try: assert self._new_selected_port.get_parent() in elements + except: self._new_selected_port = None #update highlighting for element in elements: element.set_highlighted(element in selected_elements) diff --git a/grc/todo.txt b/grc/todo.txt index 4c6471c7..3f47a1bf 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -2,7 +2,6 @@ # Examples ################################################## * Push-to-Talk example -* Variable Config usage example * Start/Stop the flow graph ################################################## -- 2.30.2