Search code examples
gnuradiognuradio-companion

gnuradio: Is there a way to change GUI chooser labels/values at run-time?


I'm trying to make an FM radio that would search for radio stations automatically and then let the user choose a station using an rtl-sdr. I wanted to use a QT GUI Chooser block to show the found channels, however now I don't think this would work, I did a few tests and then noticed the parameters for list values and labels are not underlined (which I understand means run-time adjustable). Is there a way to make this work or anything else I could use?

I'm using gnuradio 3.8.1 .


Solution

  • Labels for Qt GUI Chooser are not exposed to modifications at run-time. However, Gnuradio companion flowgraph generates a python script with Qt application. These Qt parameters are accessible from the top_class top_block_cls().

    Assuming a simple flowgraph with only 'QT GUI Chooser', you can add a 'Python Snippet' block to populate the GUI chooser. For instance, insert:

        self._variable_qtgui_chooser_0_combo_box.addItem("FM Radio")
    

    where

    • self refers to the top block class
    • _variable_qtgui_chooser_0_combo_box is the target comb box (Qt.QComboBox())

    The grc flowgraph for this example is provided in the image below : https://i.sstatic.net/gkNvm.png