Stream controls

Enable/disable stream controls depending upon whether a valid stream exists.
This commit is contained in:
markjfine 2021-04-06 16:26:20 -04:00 committed by GitHub
parent b225ca9ddd
commit 9e36095d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,6 +272,7 @@ class NRSC5_DUI(object):
def set_tuning_actions(self, widget, name, has_win, set_curs):
widget.set_property("name",name)
widget.set_sensitive(False)
if has_win:
widget.set_has_window(True)
widget.set_events(Gdk.EventMask.BUTTON_PRESS_MASK)
@ -844,12 +845,19 @@ class NRSC5_DUI(object):
self.imgSynch.set_visible(state == 1)
self.imgLostDevice.set_visible(state == -1)
def set_button_name(self, widget, stream):
def set_button_name(self, btnWidget, lblWidget, stream):
temp = self.streamInfo["Streams"][stream]
if ((temp == "") or (temp == "MPS") or (temp[0:3] == "SPS") or (temp[0:2] == "HD") ):
if (self.booknames[stream] != ""):
temp = self.booknames[stream]
widget.set_label(temp)
lblWidget.set_label(temp)
btnWidget.set_sensitive(temp != "")
def set_label_name(self, lblWidget, inString, doSens):
lblWidget.set_label(inString)
lblWidget.set_tooltip_text(inString)
if (doSens):
lblWidget.set_sensitive(inString != "")
def checkStatus(self):
# update status information
@ -882,46 +890,26 @@ class NRSC5_DUI(object):
self.lblMessage.set_tooltip_text(self.streamInfo["Message"])
self.lblAlert.set_label(self.streamInfo["Alert"])
self.lblAlert.set_tooltip_text(self.streamInfo["Alert"])
#self.btnAudioLbl0.set_label(self.streamInfo["Streams"][0])
self.set_button_name(self.btnAudioLbl0,0)
#self.btnAudioLbl1.set_label(self.streamInfo["Streams"][1])
self.set_button_name(self.btnAudioLbl1,1)
#self.btnAudioLbl2.set_label(self.streamInfo["Streams"][2])
self.set_button_name(self.btnAudioLbl2,2)
#self.btnAudioLbl3.set_label(self.streamInfo["Streams"][3])
self.set_button_name(self.btnAudioLbl3,3)
self.lblAudioPrgs0.set_label(self.streamInfo["Streams"][0])
self.lblAudioPrgs0.set_tooltip_text(self.streamInfo["Streams"][0])
self.lblAudioPrgs1.set_label(self.streamInfo["Streams"][1])
self.lblAudioPrgs1.set_tooltip_text(self.streamInfo["Streams"][1])
self.lblAudioPrgs2.set_label(self.streamInfo["Streams"][2])
self.lblAudioPrgs2.set_tooltip_text(self.streamInfo["Streams"][2])
self.lblAudioPrgs3.set_label(self.streamInfo["Streams"][3])
self.lblAudioPrgs3.set_tooltip_text(self.streamInfo["Streams"][3])
self.lblAudioSvcs0.set_label(self.streamInfo["Programs"][0])
self.lblAudioSvcs0.set_tooltip_text(self.streamInfo["Programs"][0])
self.lblAudioSvcs1.set_label(self.streamInfo["Programs"][1])
self.lblAudioSvcs1.set_tooltip_text(self.streamInfo["Programs"][1])
self.lblAudioSvcs2.set_label(self.streamInfo["Programs"][2])
self.lblAudioSvcs2.set_tooltip_text(self.streamInfo["Programs"][2])
self.lblAudioSvcs3.set_label(self.streamInfo["Programs"][3])
self.lblAudioSvcs3.set_tooltip_text(self.streamInfo["Programs"][3])
self.lblDataSvcs0.set_label(self.streamInfo["Services"][0])
self.lblDataSvcs0.set_tooltip_text(self.streamInfo["Services"][0])
self.lblDataSvcs1.set_label(self.streamInfo["Services"][1])
self.lblDataSvcs1.set_tooltip_text(self.streamInfo["Services"][1])
self.lblDataSvcs2.set_label(self.streamInfo["Services"][2])
self.lblDataSvcs2.set_tooltip_text(self.streamInfo["Services"][2])
self.lblDataSvcs3.set_label(self.streamInfo["Services"][3])
self.lblDataSvcs3.set_tooltip_text(self.streamInfo["Services"][3])
self.lblDataType0.set_label(self.streamInfo["SvcTypes"][0])
self.lblDataType0.set_tooltip_text(self.streamInfo["SvcTypes"][0])
self.lblDataType1.set_label(self.streamInfo["SvcTypes"][1])
self.lblDataType1.set_tooltip_text(self.streamInfo["SvcTypes"][1])
self.lblDataType2.set_label(self.streamInfo["SvcTypes"][2])
self.lblDataType2.set_tooltip_text(self.streamInfo["SvcTypes"][2])
self.lblDataType3.set_label(self.streamInfo["SvcTypes"][3])
self.lblDataType3.set_tooltip_text(self.streamInfo["SvcTypes"][3])
self.set_button_name(self.btnAudioPrgs0,self.btnAudioLbl0,0)
self.set_button_name(self.btnAudioPrgs1,self.btnAudioLbl1,1)
self.set_button_name(self.btnAudioPrgs2,self.btnAudioLbl2,2)
self.set_button_name(self.btnAudioPrgs3,self.btnAudioLbl3,3)
self.set_label_name(self.lblAudioPrgs0, self.streamInfo["Streams"][0], True)
self.set_label_name(self.lblAudioPrgs1, self.streamInfo["Streams"][1], True)
self.set_label_name(self.lblAudioPrgs2, self.streamInfo["Streams"][2], True)
self.set_label_name(self.lblAudioPrgs3, self.streamInfo["Streams"][3], True)
self.set_label_name(self.lblAudioSvcs0, self.streamInfo["Programs"][0], True)
self.set_label_name(self.lblAudioSvcs1, self.streamInfo["Programs"][1], True)
self.set_label_name(self.lblAudioSvcs2, self.streamInfo["Programs"][2], True)
self.set_label_name(self.lblAudioSvcs3, self.streamInfo["Programs"][3], True)
self.set_label_name(self.lblDataSvcs0, self.streamInfo["Services"][0], False)
self.set_label_name(self.lblDataSvcs1, self.streamInfo["Services"][1], False)
self.set_label_name(self.lblDataSvcs2, self.streamInfo["Services"][2], False)
self.set_label_name(self.lblDataSvcs3, self.streamInfo["Services"][3], False)
self.set_label_name(self.lblDataType0, self.streamInfo["SvcTypes"][0], False)
self.set_label_name(self.lblDataType1, self.streamInfo["SvcTypes"][1], False)
self.set_label_name(self.lblDataType2, self.streamInfo["SvcTypes"][2], False)
self.set_label_name(self.lblDataType3, self.streamInfo["SvcTypes"][3], False)
self.lblMerLower.set_label("{:1.2f} dB".format(self.streamInfo["MER"][0]))
self.lblMerUpper.set_label("{:1.2f} dB".format(self.streamInfo["MER"][1]))
self.lblBerNow.set_label("{:1.3f}% (Now)".format(ber[0]))
@ -1516,14 +1504,26 @@ class NRSC5_DUI(object):
self.lblSlogan.set_tooltip_text("")
self.lblMessage.set_label("")
self.lblMessage.set_tooltip_text("")
self.btnAudioPrgs0.set_sensitive(False)
self.btnAudioPrgs1.set_sensitive(False)
self.btnAudioPrgs2.set_sensitive(False)
self.btnAudioPrgs3.set_sensitive(False)
self.lblAudioPrgs0.set_label("")
self.lblAudioPrgs0.set_sensitive(False)
self.lblAudioPrgs1.set_label("")
self.lblAudioPrgs1.set_sensitive(False)
self.lblAudioPrgs2.set_label("")
self.lblAudioPrgs2.set_sensitive(False)
self.lblAudioPrgs3.set_label("")
self.lblAudioPrgs3.set_sensitive(False)
self.lblAudioSvcs0.set_label("")
self.lblAudioSvcs0.set_sensitive(False)
self.lblAudioSvcs1.set_label("")
self.lblAudioSvcs1.set_sensitive(False)
self.lblAudioSvcs2.set_label("")
self.lblAudioSvcs2.set_sensitive(False)
self.lblAudioSvcs3.set_label("")
self.lblAudioSvcs3.set_sensitive(False)
self.lblDataSvcs0.set_label("")
self.lblDataSvcs1.set_label("")
self.lblDataSvcs2.set_label("")