Skip to content

Commit

Permalink
Merge pull request #696 from cristinasewell/PyDMTabWidget_taking_wron…
Browse files Browse the repository at this point in the history
…g_tabAlarmChannel

PyDMTabWidget taking wrong tab alarm channel
  • Loading branch information
hhslepicka authored Sep 5, 2020
2 parents 5e10310 + 68c3ba2 commit fa567f2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pydm/widgets/tab_bar.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qtpy.QtWidgets import (QTabBar, QTabWidget, QWidget)
from qtpy.QtGui import QIcon, QColor
from qtpy.QtCore import QByteArray
from .base import PyDMWidget
from .channel import PyDMChannel
from qtpy.QtCore import Property
Expand Down Expand Up @@ -57,7 +58,7 @@ def set_channel_for_tab(self, index, channel):
self.tab_channels[index]["address"] = str(channel)
self.set_initial_icon_for_tab(index)
if channel:
# Create PyDMChannel and connecdt
# Create PyDMChannel and connect
chan = PyDMChannel(address=str(channel),
connection_slot=partial(self.connection_changed_for_tab, index),
severity_slot=partial(self.alarm_changed_for_tab, index))
Expand Down Expand Up @@ -189,7 +190,7 @@ def __init__(self, parent=None):
self.tb = PyDMTabBar(parent=self)
self.setTabBar(self.tb)

@Property(str)
@Property(QByteArray)
def currentTabAlarmChannel(self):
"""
A channel to use for the current tab's alarm indicator.
Expand All @@ -198,11 +199,15 @@ def currentTabAlarmChannel(self):
-------
str
"""
return self.tabBar().currentTabAlarmChannel
if self.tabBar().currentTabAlarmChannel:
return bytearray(
self.tabBar().currentTabAlarmChannel.encode('utf-8'))
else:
return bytearray()

@currentTabAlarmChannel.setter
def currentTabAlarmChannel(self, new_alarm_channel):
self.tabBar().currentTabAlarmChannel = new_alarm_channel
self.tabBar().currentTabAlarmChannel = bytes(new_alarm_channel).decode()

def channels(self):
"""
Expand Down

0 comments on commit fa567f2

Please sign in to comment.