Made SDR Radio selectable in a combobox making irrelevant entries invisible

This commit is contained in:
Mark J. Fine 2022-12-08 11:18:19 -05:00
parent 8f2e8d4c8a
commit b65a8828be
2 changed files with 197 additions and 146 deletions

View File

@ -290,21 +290,24 @@ class NRSC5_DUI(object):
self.lblExtend.set_sensitive(dlCoversSet)
self.cbExtend.set_sensitive(dlCoversSet)
def on_cbSDRPlay_clicked(self, btn):
useSDRPlay = self.cbSDRPlay.get_active()
self.lblSdrPlay.set_sensitive(useSDRPlay)
self.txtSDRPlaySer.set_sensitive(useSDRPlay)
def on_cbxSDRRadio_changed(self, btn):
useSDRPlay = (self.cbxSDRRadio.get_active_text() == "SDRPlay")
self.lblSdrPlaySer.set_visible(useSDRPlay)
self.txtSDRPlaySer.set_visible(useSDRPlay)
self.txtSDRPlaySer.set_can_focus(useSDRPlay)
self.lblSDRPlayAnt.set_sensitive(useSDRPlay)
self.cbxSDRPlayAnt.set_sensitive(useSDRPlay)
self.label14d.set_visible(useSDRPlay)
self.lblSDRPlayAnt.set_visible(useSDRPlay)
self.cbxSDRPlayAnt.set_visible(useSDRPlay)
self.cbxSDRPlayAnt.set_can_focus(useSDRPlay)
self.lblRTL.set_sensitive(not(useSDRPlay))
self.spinRTL.set_sensitive(not(useSDRPlay))
self.label14a.set_visible(useSDRPlay)
self.lblRTL.set_visible(not(useSDRPlay))
self.spinRTL.set_visible(not(useSDRPlay))
self.spinRTL.set_can_focus(not(useSDRPlay))
self.lblDevIP.set_sensitive(not(useSDRPlay))
self.txtDevIP.set_sensitive(not(useSDRPlay))
self.label14b.set_visible(useSDRPlay)
self.lblDevIP.set_visible(not(useSDRPlay))
self.txtDevIP.set_visible(not(useSDRPlay))
self.txtDevIP.set_can_focus(not(useSDRPlay))
self.cbDevIP.set_sensitive(not(useSDRPlay))
self.cbDevIP.set_visible(not(useSDRPlay))
self.cbDevIP.set_can_focus(not(useSDRPlay))
def img_to_pixbuf(self,img):
@ -573,6 +576,8 @@ class NRSC5_DUI(object):
self.spinPPM.update()
self.spinRTL.update()
useSDRPlay = (self.cbxSDRRadio.get_active_text() == "SDRPlay")
# enable aas output if temp dir was created
if (aasDir is not None):
self.nrsc5Args.append("--dump-aas-files")
@ -600,16 +605,19 @@ class NRSC5_DUI(object):
self.nrsc5Args.append(str(int(self.spinRTL.get_value())))
# set log level to 2 if SDRPLay enabled
if (self.cbSDRPlay.get_active()):
#if (self.cbSDRPlay.get_active()):
if (useSDRPlay):
self.nrsc5Args.append("-l2")
# set SDRPlay serial number if not blank
if (self.cbSDRPlay.get_active()) and (self.txtSDRPlaySer.get_text() != ""):
#if (self.cbSDRPlay.get_active()) and (self.txtSDRPlaySer.get_text() != ""):
if (useSDRPlay) and (self.txtSDRPlaySer.get_text() != ""):
self.nrsc5Args.append("-d")
self.nrsc5Args.append(self.txtSDRPlaySer.get_text())
# set SDRPlay antenna if not blank
if (self.cbSDRPlay.get_active()) and (self.cbxSDRPlayAnt.get_active_text() != ""):
#if (self.cbSDRPlay.get_active()) and (self.cbxSDRPlayAnt.get_active_text() != ""):
if (useSDRPlay) and (self.cbxSDRPlayAnt.get_active_text() != ""):
self.nrsc5Args.append("-A")
self.nrsc5Args.append("\"Antenna "+self.cbxSDRPlayAnt.get_active_text()+"\"")
@ -625,13 +633,13 @@ class NRSC5_DUI(object):
# disable the controls
self.spinFreq.set_sensitive(False)
self.cbxSDRRadio.set_sensitive(False)
self.spinGain.set_sensitive(False)
self.spinPPM.set_sensitive(False)
self.spinRTL.set_sensitive(False)
self.txtDevIP.set_sensitive(False)
self.cbDevIP.set_sensitive(False)
self.txtSDRPlaySer.set_sensitive(False)
self.cbSDRPlay.set_sensitive(False)
self.cbxSDRPlayAnt.set_sensitive(False)
self.btnPlay.set_sensitive(False)
self.btnStop.set_sensitive(True)
@ -688,15 +696,14 @@ class NRSC5_DUI(object):
# enable controls
if (not self.cbAutoGain.get_active()):
self.spinGain.set_sensitive(True)
useSDRPlay = self.cbSDRPlay.get_active()
self.spinFreq.set_sensitive(True)
self.cbxSDRRadio.set_sensitive(True)
self.spinPPM.set_sensitive(True)
self.spinRTL.set_sensitive(not(useSDRPlay))
self.txtDevIP.set_sensitive(not(useSDRPlay))
self.cbDevIP.set_sensitive(not(useSDRPlay))
self.txtSDRPlaySer.set_sensitive(useSDRPlay)
self.cbSDRPlay.set_sensitive(True)
self.cbxSDRPlayAnt.set_sensitive(useSDRPlay)
self.spinRTL.set_sensitive(True)
self.txtDevIP.set_sensitive(True)
self.cbDevIP.set_sensitive(True)
self.txtSDRPlaySer.set_sensitive(True)
self.cbxSDRPlayAnt.set_sensitive(True)
self.btnPlay.set_sensitive(True)
self.btnStop.set_sensitive(False)
self.btnBookmark.set_sensitive(False)
@ -1545,19 +1552,22 @@ class NRSC5_DUI(object):
self.alignmentMap = builder.get_object("alignment_map")
self.imgMap = builder.get_object("imgMap")
self.spinFreq = builder.get_object("spinFreq")
self.cbxSDRRadio = builder.get_object("cbxSDRRadio")
self.spinGain = builder.get_object("spinGain")
self.cbAutoGain = builder.get_object("cbAutoGain")
self.spinPPM = builder.get_object("spinPPM")
self.lblRTL = builder.get_object("lblRTL")
self.spinRTL = builder.get_object("spinRTL")
self.label14b = builder.get_object("label14b")
self.lblDevIP = builder.get_object("lblDevIP")
self.txtDevIP = builder.get_object("txtDevIP")
self.lblSdrPlay = builder.get_object("lblSdrPlay")
self.cbDevIP = builder.get_object("cbDevIP")
self.lblSdrPlaySer = builder.get_object("lblSdrPlaySer")
self.txtSDRPlaySer = builder.get_object("txtSDRPlaySer")
self.cbSDRPlay = builder.get_object("cbSDRPlay")
self.label14d = builder.get_object("label14d")
self.lblSDRPlayAnt = builder.get_object("lblSDRPlayAnt")
self.cbxSDRPlayAnt = builder.get_object("cbxSDRPlayAnt")
self.cbAutoGain = builder.get_object("cbAutoGain")
self.cbDevIP = builder.get_object("cbDevIP")
self.label14a = builder.get_object("label14a")
self.cbLog = builder.get_object("cbLog")
self.cbCovers = builder.get_object("cbCovers")
self.lblCoverIncl = builder.get_object("lblCoverIncl")
@ -1775,8 +1785,8 @@ class NRSC5_DUI(object):
self.cbAutoGain.set_active(config["AutoGain"])
self.spinPPM.set_value(config["PPMError"])
self.spinRTL.set_value(config["RTL"])
if ("SDRPlay" in config):
self.cbSDRPlay.set_active(config["SDRPlay"])
if ("SDRRadio" in config):
self.cbxSDRRadio.set_active_id("rcvr"+config["SDRRadio"])
if ("SDRPlaySer" in config):
self.txtSDRPlaySer.set_text(config["SDRPlaySer"])
if ("SDRPlayAnt" in config):
@ -1869,7 +1879,7 @@ class NRSC5_DUI(object):
"PPMError" : int(self.spinPPM.get_value()),
"RTL" : int(self.spinRTL.get_value()),
"DevIP" : self.txtDevIP.get_text(),
"SDRPlay" : self.cbSDRPlay.get_active(),
"SDRRadio" : self.cbxSDRRadio.get_active_text(),
"SDRPlaySer" : self.txtSDRPlaySer.get_text(),
"SDRPlayAnt" : self.cbxSDRPlayAnt.get_active_text(),
"LogToFile" : self.cbLog.get_active(),

View File

@ -1108,7 +1108,7 @@
<object class="GtkTable" id="tableSettings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">10</property>
<property name="n_rows">11</property>
<property name="n_columns">3</property>
<property name="column_spacing">10</property>
<property name="row_spacing">3</property>
@ -1121,6 +1121,56 @@
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="lblSDRRadio">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDR Radio:</property>
<property name="justify">right</property>
<property name="single_line_mode">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="cbxSDRRadio">
<property name="visible">True</property>
<property name="sensitive">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Choose SDR device</property>
<property name="has_entry">False</property>
<property name="active">0</property>
<signal name="changed" handler="on_cbxSDRRadio_changed" swapped="no"/>
<items>
<item translatable="yes" id="rcvrRTL-SDR">RTL-SDR</item>
<item translatable="yes" id="rcvrSDRPlay">SDRPlay</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14c">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblGain5">
<property name="visible">True</property>
@ -1132,6 +1182,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1153,6 +1205,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1172,6 +1226,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1187,8 +1243,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1209,8 +1265,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1227,8 +1283,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1245,8 +1301,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1268,8 +1324,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1283,8 +1339,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1301,8 +1357,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1319,8 +1375,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1339,16 +1395,16 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblSdrPlay">
<property name="visible">True</property>
<property name="sensitive">False</property>
<object class="GtkLabel" id="lblSdrPlaySer">
<property name="visible">False</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDRPlay Ser#:</property>
@ -1356,62 +1412,6 @@
<property name="single_line_mode">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="txtSDRPlaySer">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">SDRPlay Serial Number</property>
<property name="max_length">10</property>
<property name="max_width_chars">10</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cbSDRPlay">
<property name="label" translatable="yes">Enable</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Use SDRPlay</property>
<property name="draw_indicator">True</property>
<signal name="clicked" handler="on_cbSDRPlay_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblSDRPlayAnt">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDRPlay Ant:</property>
<property name="justify">right</property>
<property name="single_line_mode">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
@ -1420,19 +1420,60 @@
</packing>
</child>
<child>
<!--
<object class="GtkEntry" id="txtSDRPlayAnt">
<property name="visible">True</property>
<property name="sensitive">False</property>
<object class="GtkEntry" id="txtSDRPlaySer">
<property name="visible">False</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">SDRPlay antenna</property>
<property name="max_length">1</property>
<property name="max_width_chars">1</property>
<property name="tooltip_text" translatable="yes">SDRPlay Serial Number</property>
<property name="max_length">10</property>
<property name="max_width_chars">10</property>
</object>
-->
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14d">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblSDRPlayAnt">
<property name="visible">False</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDRPlay Ant:</property>
<property name="justify">right</property>
<property name="single_line_mode">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="cbxSDRPlayAnt">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="visible">False</property>
<property name="sensitive">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Choose SDRPlay antenna</property>
<property name="has_entry">False</property>
@ -1446,23 +1487,23 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14a">
<property name="visible">True</property>
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1478,8 +1519,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1497,8 +1538,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1511,8 +1552,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1528,8 +1569,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1548,8 +1589,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1562,8 +1603,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1580,8 +1621,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1600,8 +1641,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1614,8 +1655,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1632,8 +1673,8 @@
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1652,8 +1693,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1666,8 +1707,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>