Added preliminary support for SDRPlay version of nrsc5.

This commit is contained in:
Mark J. Fine 2022-12-06 17:10:47 -05:00
parent b8ae248bcf
commit 6ae3c93754
2 changed files with 170 additions and 26 deletions

View File

@ -290,6 +290,15 @@ 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)
self.txtSDRPlaySer.set_can_focus(useSDRPlay)
self.lblSDRPlayAnt.set_sensitive(useSDRPlay)
self.txtSDRPlayAnt.set_sensitive(useSDRPlay)
self.txtSDRPlayAnt.set_can_focus(useSDRPlay)
def img_to_pixbuf(self,img):
"""convert PIL.Image to GdkPixbuf.Pixbuf"""
data = GLib.Bytes.new(img.tobytes())
@ -581,11 +590,27 @@ class NRSC5_DUI(object):
if (self.spinRTL.get_value() != 0):
self.nrsc5Args.append("-d")
self.nrsc5Args.append(str(int(self.spinRTL.get_value())))
# set log level to 2 if SDRPLay enabled
if (self.cbSDRPlay.get_active()):
self.nrsc5Args.append("-l2")
# set SDRPlay serial number if not blank
if (self.cbSDRPlay.get_active()) 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.txtSDRPlayAnt.get_text() != ""):
self.nrsc5Args.append("-A")
self.nrsc5Args.append("\"Antenna "+self.txtSDRPlayAnt.get_text()+"\"")
# set frequency and stream
self.nrsc5Args.append(str(self.spinFreq.get_value()))
self.nrsc5Args.append(str(int(self.streamNum)))
print(self.nrsc5Args)
# start the timer
self.statusTimer = Timer(1, self.checkStatus)
self.statusTimer.start()
@ -1505,6 +1530,11 @@ class NRSC5_DUI(object):
self.spinPPM = builder.get_object("spinPPM")
self.spinRTL = builder.get_object("spinRTL")
self.txtDevIP = builder.get_object("txtDevIP")
self.lblSdrPlay = builder.get_object("lblSdrPlay")
self.txtSDRPlaySer = builder.get_object("txtSDRPlaySer")
self.cbSDRPlay = builder.get_object("cbSDRPlay")
self.lblSDRPlayAnt = builder.get_object("lblSDRPlayAnt")
self.txtSDRPlayAnt = builder.get_object("txtSDRPlayAnt")
self.cbAutoGain = builder.get_object("cbAutoGain")
self.cbDevIP = builder.get_object("cbDevIP")
self.cbLog = builder.get_object("cbLog")
@ -1724,6 +1754,12 @@ 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 ("SDRPlaySer" in config):
self.txtSDRPlaySer.set_text(config["SDRPlaySer"])
if ("SDRPlayAnt" in config):
self.txtSDRPlayAnt.set_text(config["SDRPlayAnt"])
self.cbLog.set_active(config["LogToFile"])
if ("DLoadArt" in config):
self.cbCovers.set_active(config["DLoadArt"])
@ -1812,6 +1848,9 @@ 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(),
"SDRPlaySer" : self.txtSDRPlaySer.get_text(),
"SDRPlayAnt" : self.txtSDRPlayAnt.get_text(),
"LogToFile" : self.cbLog.get_active(),
"DLoadArt" : self.cbCovers.get_active(),
"StationArt" : self.cbCoverIncl.get_active(),

View File

@ -1056,7 +1056,7 @@
<object class="GtkTable" id="tableSettings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">8</property>
<property name="n_rows">10</property>
<property name="n_columns">3</property>
<property name="column_spacing">10</property>
<property name="row_spacing">3</property>
@ -1213,6 +1213,7 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblDevIP">
<property name="visible">True</property>
@ -1264,6 +1265,110 @@
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lblSdrPlay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDRPlay #:</property>
<property name="xalign">1</property>
<property name="sensitive">False</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="can_focus">False</property>
<property name="tooltip_text" translatable="yes">SDRPlay Serial Number</property>
<property name="max_width_chars">16</property>
<property name="sensitive">False</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="active">False</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="can_focus">False</property>
<property name="xalign">1</property>
<property name="xpad">10</property>
<property name="label" translatable="yes">SDRPlay Ant:</property>
<property name="sensitive">False</property>
</object>
<packing>
<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="GtkEntry" id="txtSDRPlayAnt">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">SDRPlay antenna</property>
<property name="max_width_chars">1</property>
<property name="sensitive">False</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="label14a">
<property name="visible">True</property>
<property name="can_focus">False</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="lblGain3">
<property name="visible">True</property>
@ -1273,8 +1378,8 @@
<property name="label" translatable="yes">Log to File:</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</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>
@ -1292,8 +1397,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1305,8 +1410,8 @@
<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="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>
@ -1320,8 +1425,8 @@
<property name="label" translatable="yes">Download Album Art:</property>
</object>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</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>
@ -1340,8 +1445,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1353,8 +1458,8 @@
<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">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1369,8 +1474,8 @@
<property name="sensitive">False</property>
</object>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</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>
@ -1389,8 +1494,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">8</property>
<property name="bottom_attach">9</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1402,8 +1507,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">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
@ -1418,8 +1523,8 @@
<property name="sensitive">False</property>
</object>
<packing>
<property name="top_attach">7</property>
<property name="bottom_attach">8</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>
@ -1439,8 +1544,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">9</property>
<property name="bottom_attach">10</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@ -1452,8 +1557,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">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>