diff --git a/widgets/smallplayerinfo/smallplayerinfowidget.py b/widgets/smallplayerinfo/smallplayerinfowidget.py index 3c7960a..7c0be41 100644 --- a/widgets/smallplayerinfo/smallplayerinfowidget.py +++ b/widgets/smallplayerinfo/smallplayerinfowidget.py @@ -19,6 +19,7 @@ def __init__(self, handle, parent): self.pipPlayerInfo = None self.pipCurrWorldspace = None self.pipStats = None + self.pipRadioInfo = None self.maxHP = 0 self.curHP = 0 self.maxAP = 0 @@ -48,6 +49,10 @@ def _onPipRootObjectEvent(self, rootObject): if (self.pipStats): self.pipStats.registerValueUpdatedListener(self._onPipPlayerInfoUpdate, 1) + self.pipRadioInfo = rootObject.child('Radio') + if self.pipRadioInfo: + self.pipRadioInfo.registerValueUpdatedListener(self._onPipPlayerInfoUpdate, 2) + self._signalInfoUpdated.emit() @@ -100,7 +105,6 @@ def _slotInfoUpdated(self): if (effect.child('Name').value() == 'Rads'): radChange += effect.child('Value').value() - radChangePrefix = '' if (radChange > 0): radChangePrefix = '+' @@ -108,7 +112,15 @@ def _slotInfoUpdated(self): self.widget.radChangeLabel.setText(radChangePrefix + str(round(radChange))) self.widget.lblActiveEffects.setText(listEffectsSeperator.join(listEffects)) - + currentRadioStationName = 'Radio off' + if(self.pipRadioInfo): + for i in range(0, self.pipRadioInfo.childCount()): + station = self.pipRadioInfo.child(i) + if station.child('active').value(): + currentRadioStationName = station.child('text').value() + + self.widget.lblRadio.setText(currentRadioStationName) + maxHP = self.pipPlayerInfo.child('MaxHP') if maxHP: self.maxHP = maxHP.value() diff --git a/widgets/smallplayerinfo/ui/smallplayerinfowidget.ui b/widgets/smallplayerinfo/ui/smallplayerinfowidget.ui index c1ef228..ac56ec6 100644 --- a/widgets/smallplayerinfo/ui/smallplayerinfowidget.ui +++ b/widgets/smallplayerinfo/ui/smallplayerinfowidget.ui @@ -69,6 +69,27 @@ + + + + + + + 10 + 50 + false + + + + Off + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + +