From 06a35ee5ca3fa86cca27f76cfe142d84e46c50a2 Mon Sep 17 00:00:00 2001 From: Mathieu Deous Date: Wed, 28 May 2025 21:56:56 +0200 Subject: [PATCH 1/4] ignore build dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ From 979f9c1b4d0d661b4739dfe96f5566aeb9981bcd Mon Sep 17 00:00:00 2001 From: Mathieu Deous Date: Wed, 28 May 2025 22:04:08 +0200 Subject: [PATCH 2/4] allow users to disable auto scrolling --- python/dect2/console.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/python/dect2/console.py b/python/dect2/console.py index 136afe1..9bb0cc4 100644 --- a/python/dect2/console.py +++ b/python/dect2/console.py @@ -34,11 +34,13 @@ class console(gr.basic_block, QtWidgets.QTextEdit): console_update = QtCore.pyqtSignal() - def __init__(self): + def __init__(self, auto_scroll=True): gr.basic_block.__init__(self, name="console", in_sig=[], out_sig=[]) QtWidgets.QTextEdit.__init__(self) self.message_port_register_in(pmt.intern("in")) self.set_msg_handler(pmt.intern("in"), self.handle_msg) + self.message_port_register_in(pmt.intern("config")) + self.set_msg_handler(pmt.intern("config"), self.handle_config) self.console_update.connect(self.update) @@ -46,22 +48,35 @@ def __init__(self): self.font.setFamily("Courier New"); self.font.setStyleStrategy(QtGui.QFont.NoAntialias); self.document().setDefaultFont(self.font); - + self.auto_scroll = auto_scroll def handle_msg(self, msg): if(pmt.dict_has_key( msg, pmt.to_pmt("log_msg"))): log_msg = pmt.dict_ref( msg, pmt.to_pmt("log_msg"), pmt.PMT_NIL) self.console_msg = pmt.to_python(log_msg) self.console_update.emit() + + def handle_config(self, msg): + value = pmt.to_python(msg) + if isinstance(value, tuple): + data = dict([value]) + if "auto_scroll" in data: + self.auto_scroll = data["auto_scroll"] - def update(self): - self.append(self.console_msg) - self.verticalScrollBar().setValue(self.verticalScrollBar().maximum()) - #self.moveCursor(QtGui.QTextCursor.End) + def update(self): + scrollbar = self.verticalScrollBar() + current_scroll_pos = scrollbar.value() + cursor = self.textCursor() + cursor.movePosition(QtGui.QTextCursor.End) + + if not self.console_msg.endswith("\n"): + self.console_msg += "\n" + cursor.insertText(self.console_msg) + + if self.auto_scroll: + scrollbar.setValue(scrollbar.maximum()) + else: + scrollbar.setValue(current_scroll_pos) def work(self, input_items, output_items): - pass - - - - + pass From 6b62282e57b0c98437c972af49f01328f9cafe93 Mon Sep 17 00:00:00 2001 From: Mathieu Deous Date: Wed, 28 May 2025 22:21:58 +0200 Subject: [PATCH 3/4] reflect auto scrolling changes in block def --- grc/dect2_console.block.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/grc/dect2_console.block.yml b/grc/dect2_console.block.yml index 09d90ae..fec09e3 100644 --- a/grc/dect2_console.block.yml +++ b/grc/dect2_console.block.yml @@ -9,11 +9,18 @@ parameters: label: GUI Hint dtype: gui_hint hide: part +- id: auto_scroll + label: Auto Scroll + dtype: bool + default: true inputs: - domain: message id: in optional: true +- domain: message + id: config + optional: true templates: imports: import gnuradio.dect2 as dect2 @@ -22,6 +29,6 @@ templates: <% win = 'self.%s' % id %>\ - dect2.console() + dect2.console(auto_scroll=${auto_scroll}) ${gui_hint() % win} file_format: 1 From aa311201058fdfe763ccca4191ac6a10b0019669 Mon Sep 17 00:00:00 2001 From: Mathieu Deous Date: Wed, 28 May 2025 22:37:11 +0200 Subject: [PATCH 4/4] add auto scroll checkbox --- examples/dect2.grc | 29 +++++++++++- examples/dect2_Hackrf.grc | 93 +++++++++++++++++++++++-------------- examples/dect2_b200.grc | 28 +++++++++-- examples/dect2_plutosdr.grc | 29 ++++++++++-- examples/dect2_soapy.grc | 29 ++++++++++-- 5 files changed, 162 insertions(+), 46 deletions(-) diff --git a/examples/dect2.grc b/examples/dect2.grc index df1bdee..5f15054 100644 --- a/examples/dect2.grc +++ b/examples/dect2.grc @@ -23,6 +23,7 @@ options: sizing_mode: fixed thread_safe_setters: '' title: '' + window_size: (1000,1000) states: bus_sink: false bus_source: false @@ -32,6 +33,27 @@ options: state: enabled blocks: +- name: auto_scroll + id: variable_qtgui_msgcheckbox + parameters: + cellalignment: '1' + comment: '' + gui_hint: '[0,2]' + initPressed: 'True' + label: Auto Scroll + outputmsgname: auto_scroll + pressed: 'True' + released: 'False' + type: bool + value: 'True' + verticalalignment: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [544, 280.0] + rotation: 0 + state: enabled - name: baseband_sampling_rate id: variable parameters: @@ -84,7 +106,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,1]' label: Select Part label0: '' label1: '' @@ -140,7 +162,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,0]' label: Carrier Number label0: ch0 label1: ch1 @@ -231,6 +253,7 @@ blocks: parameters: affinity: '' alias: '' + auto_scroll: 'True' comment: '' gui_hint: '' states: @@ -797,6 +820,7 @@ blocks: state: enabled connections: +- [auto_scroll, state, console_0, config] - [blocks_short_to_float_0, '0', rational_resampler_xxx_0, '0'] - [dect2_packet_decoder_0, '0', vocoder_g721_decode_bs_0, '0'] - [dect2_packet_decoder_0, log_out, console_0, in] @@ -811,3 +835,4 @@ connections: metadata: file_format: 1 + grc_version: 3.10.12.0 diff --git a/examples/dect2_Hackrf.grc b/examples/dect2_Hackrf.grc index 46d470e..baa6ca1 100644 --- a/examples/dect2_Hackrf.grc +++ b/examples/dect2_Hackrf.grc @@ -11,7 +11,7 @@ options: gen_linking: dynamic generate_options: qt_gui hier_block_src_path: '.:' - id: top_block + id: dect2_hackrf max_nouts: '0' output_language: python placement: (0,0) @@ -28,7 +28,7 @@ options: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 10] + coordinate: [16, 12.0] rotation: 0 state: enabled @@ -51,7 +51,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [496, 432] + coordinate: [536, 80.0] rotation: 0 state: enabled - name: VGA_bb_gain @@ -72,7 +72,28 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [632, 432] + coordinate: [656, 80.0] + rotation: 0 + state: enabled +- name: auto_scroll + id: variable_qtgui_msgcheckbox + parameters: + cellalignment: '1' + comment: '' + gui_hint: '[0,2]' + initPressed: 'True' + label: Auto Scroll + outputmsgname: auto_scroll + pressed: 'True' + released: 'False' + type: bool + value: 'True' + verticalalignment: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [296, 592.0] rotation: 0 state: enabled - name: baseband_sampling_rate @@ -84,7 +105,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 74] + coordinate: [168, 12.0] rotation: 0 state: enabled - name: dect_channel_bandwidth @@ -96,7 +117,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 270] + coordinate: [600, 12.0] rotation: 0 state: enabled - name: dect_occupied_bandwidth @@ -108,7 +129,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 202] + coordinate: [440, 12.0] rotation: 0 state: enabled - name: dect_symbol_rate @@ -120,7 +141,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [9, 138] + coordinate: [320, 12.0] rotation: 0 state: enabled - name: if_gain @@ -141,7 +162,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [360, 432] + coordinate: [432, 80.0] rotation: 0 state: enabled - name: options_low_pass @@ -153,15 +174,15 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [536, 28] + coordinate: [1000, 12.0] rotation: 0 state: enabled - name: part_id id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' - label: Select Part + gui_hint: '[0,1]' + label: Part label0: '' label1: '' label2: '' @@ -183,7 +204,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 410] + coordinate: [184, 80.0] rotation: 0 state: enabled - name: ppm_corr @@ -204,7 +225,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [224, 432] + coordinate: [328, 80.0] rotation: 0 state: enabled - name: resample_ratio @@ -216,7 +237,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [671, 26] + coordinate: [1120, 12.0] rotation: 0 state: true - name: resampler_filter_taps @@ -229,14 +250,14 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [10, 340] + coordinate: [752, 12.0] rotation: 0 state: enabled - name: rx_freq id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,0]' label: Carrier Number label0: ch0 label1: ch1 @@ -272,7 +293,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [11, 548] + coordinate: [16, 80.0] rotation: 0 state: enabled - name: xlate_offset1 @@ -284,7 +305,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [432, 28] + coordinate: [904, 12.0] rotation: 0 state: enabled - name: audio_sink_0 @@ -301,7 +322,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1080, 484] + coordinate: [912, 500.0] rotation: 0 state: enabled - name: blocks_short_to_float_0 @@ -318,7 +339,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1064, 268] + coordinate: [560, 500.0] rotation: 0 state: enabled - name: console_0 @@ -326,13 +347,14 @@ blocks: parameters: affinity: '' alias: '' + auto_scroll: auto_scroll comment: '' gui_hint: '' states: - bus_sink: false + bus_sink: true bus_source: false bus_structure: null - coordinate: [840, 344] + coordinate: [584, 552.0] rotation: 0 state: enabled - name: dect2_packet_decoder_0 @@ -348,7 +370,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [584, 272] + coordinate: [160, 520.0] rotation: 0 state: enabled - name: dect2_packet_receiver_0 @@ -363,8 +385,8 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [256, 272] - rotation: 0 + coordinate: [160, 424.0] + rotation: 180 state: enabled - name: dect2_phase_diff_0 id: dect2_phase_diff @@ -378,8 +400,8 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1188, 189] - rotation: 0 + coordinate: [856, 440.0] + rotation: 180 state: enabled - name: freq_xlating_fir_filter_xxx_0 id: freq_xlating_fir_filter_xxx @@ -398,7 +420,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [440, 96] + coordinate: [328, 288.0] rotation: 0 state: enabled - name: mmse_resampler_xx_0 @@ -416,7 +438,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [985, 66] + coordinate: [776, 312.0] rotation: 0 state: true - name: rational_resampler_xxx_0 @@ -436,7 +458,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [848, 456] + coordinate: [728, 480.0] rotation: 0 state: enabled - name: rational_resampler_xxx_1 @@ -456,7 +478,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [728, 92.0] + coordinate: [552, 288.0] rotation: 0 state: true - name: rtlsdr_source_0 @@ -813,7 +835,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [192, 36] + coordinate: [64, 216.0] rotation: 0 state: enabled - name: vocoder_g721_decode_bs_0 @@ -828,11 +850,12 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [816, 272] + coordinate: [376, 504.0] rotation: 0 state: enabled connections: +- [auto_scroll, state, console_0, config] - [blocks_short_to_float_0, '0', rational_resampler_xxx_0, '0'] - [dect2_packet_decoder_0, '0', vocoder_g721_decode_bs_0, '0'] - [dect2_packet_decoder_0, log_out, console_0, in] @@ -848,4 +871,4 @@ connections: metadata: file_format: 1 - grc_version: v3.11.0.0git-46-g614681ba + grc_version: 3.10.12.0 diff --git a/examples/dect2_b200.grc b/examples/dect2_b200.grc index 4764951..0903e67 100644 --- a/examples/dect2_b200.grc +++ b/examples/dect2_b200.grc @@ -33,6 +33,27 @@ options: state: enabled blocks: +- name: auto_scroll + id: variable_qtgui_msgcheckbox + parameters: + cellalignment: '1' + comment: '' + gui_hint: '[0,2]' + initPressed: 'True' + label: Auto Scroll + outputmsgname: auto_scroll + pressed: 'True' + released: 'False' + type: bool + value: 'True' + verticalalignment: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [552, 280.0] + rotation: 0 + state: enabled - name: baseband_sampling_rate id: variable parameters: @@ -85,7 +106,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,1]' label: Select Part label0: '' label1: '' @@ -128,7 +149,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,0]' label: Carrier Number label0: ch0 label1: ch1 @@ -215,6 +236,7 @@ blocks: parameters: affinity: '' alias: '' + auto_scroll: 'True' comment: '' gui_hint: '' states: @@ -795,4 +817,4 @@ connections: metadata: file_format: 1 - grc_version: v3.11.0.0git-46-g614681ba + grc_version: 3.10.12.0 diff --git a/examples/dect2_plutosdr.grc b/examples/dect2_plutosdr.grc index 98c40bf..2296426 100644 --- a/examples/dect2_plutosdr.grc +++ b/examples/dect2_plutosdr.grc @@ -33,6 +33,27 @@ options: state: enabled blocks: +- name: auto_scroll + id: variable_qtgui_msgcheckbox + parameters: + cellalignment: '1' + comment: '' + gui_hint: '[0,2]' + initPressed: 'True' + label: Auto Scroll + outputmsgname: auto_scroll + pressed: 'True' + released: 'False' + type: bool + value: 'True' + verticalalignment: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [544, 304.0] + rotation: 0 + state: enabled - name: baseband_sampling_rate id: variable parameters: @@ -85,7 +106,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,1]' label: Select Part label0: '' label1: '' @@ -141,7 +162,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,0]' label: Carrier Number label0: ch0 label1: ch1 @@ -232,6 +253,7 @@ blocks: parameters: affinity: '' alias: '' + auto_scroll: 'True' comment: '' gui_hint: '' states: @@ -393,6 +415,7 @@ blocks: state: enabled connections: +- [auto_scroll, state, console_0, config] - [blocks_short_to_float_0, '0', rational_resampler_xxx_0, '0'] - [dect2_packet_decoder_0, '0', vocoder_g721_decode_bs_0, '0'] - [dect2_packet_decoder_0, log_out, console_0, in] @@ -407,4 +430,4 @@ connections: metadata: file_format: 1 - grc_version: v3.11.0.0git-104-g8ccb8e65 + grc_version: 3.10.12.0 diff --git a/examples/dect2_soapy.grc b/examples/dect2_soapy.grc index 41fc610..fec2270 100644 --- a/examples/dect2_soapy.grc +++ b/examples/dect2_soapy.grc @@ -33,6 +33,27 @@ options: state: enabled blocks: +- name: auto_scroll + id: variable_qtgui_msgcheckbox + parameters: + cellalignment: '1' + comment: '' + gui_hint: '[0,2]' + initPressed: 'True' + label: Auto Scroll + outputmsgname: auto_scroll + pressed: 'True' + released: 'False' + type: bool + value: 'True' + verticalalignment: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [536, 304.0] + rotation: 0 + state: enabled - name: baseband_sampling_rate id: variable parameters: @@ -85,7 +106,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,1]' label: Select Part label0: '' label1: '' @@ -141,7 +162,7 @@ blocks: id: variable_qtgui_chooser parameters: comment: '' - gui_hint: '' + gui_hint: '[0,0]' label: Carrier Number label0: ch0 label1: ch1 @@ -232,6 +253,7 @@ blocks: parameters: affinity: '' alias: '' + auto_scroll: 'True' comment: '' gui_hint: '' states: @@ -405,6 +427,7 @@ blocks: state: enabled connections: +- [auto_scroll, state, console_0, config] - [blocks_short_to_float_0, '0', rational_resampler_xxx_0, '0'] - [dect2_packet_decoder_0, '0', vocoder_g721_decode_bs_0, '0'] - [dect2_packet_decoder_0, log_out, console_0, in] @@ -419,4 +442,4 @@ connections: metadata: file_format: 1 - grc_version: v3.11.0.0git-46-g614681ba + grc_version: 3.10.12.0