Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
382 views
in Technique[技术] by (71.8m points)

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 .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.stack.imgur.com/gkNvm.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...