Skip to content

Commit

Permalink
Added current radio station to smallplayerinfo widget
Browse files Browse the repository at this point in the history
  • Loading branch information
akamal committed Dec 19, 2015
1 parent d29e4a7 commit a165318
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
16 changes: 14 additions & 2 deletions widgets/smallplayerinfo/smallplayerinfowidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()


Expand Down Expand Up @@ -100,15 +105,22 @@ def _slotInfoUpdated(self):
if (effect.child('Name').value() == 'Rads'):
radChange += effect.child('Value').value()


radChangePrefix = ''
if (radChange > 0):
radChangePrefix = '+'

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()
Expand Down
21 changes: 21 additions & 0 deletions widgets/smallplayerinfo/ui/smallplayerinfowidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,27 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="lblRadio">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Off</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down

0 comments on commit a165318

Please sign in to comment.