From 337a5a124c955ed3bc0d14d1c13226a6bc428c70 Mon Sep 17 00:00:00 2001 From: cristinasewell Date: Thu, 3 Sep 2020 17:24:04 -0700 Subject: [PATCH 1/4] MNT: set translatable true by default for currentAlarmChannel --- pydm/widgets/tab_bar.py | 2 +- pydm/widgets/tab_bar_qtplugin.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pydm/widgets/tab_bar.py b/pydm/widgets/tab_bar.py index 74a707985..5a52119cc 100644 --- a/pydm/widgets/tab_bar.py +++ b/pydm/widgets/tab_bar.py @@ -57,7 +57,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)) diff --git a/pydm/widgets/tab_bar_qtplugin.py b/pydm/widgets/tab_bar_qtplugin.py index 02a5dfa93..3a5936ab3 100644 --- a/pydm/widgets/tab_bar_qtplugin.py +++ b/pydm/widgets/tab_bar_qtplugin.py @@ -23,6 +23,9 @@ def domXml(self): " \n" " {2}\n" " \n" + "\n" + " \n" + "\n" "\n" "\n" " \n" From 368cd2b4e00b226e48b0fde33434286de541f982 Mon Sep 17 00:00:00 2001 From: cristinasewell Date: Fri, 4 Sep 2020 12:15:28 -0700 Subject: [PATCH 2/4] MNT: use QByteArray instead of string for currentTabAlarmChannel to get rid of translatable option --- pydm/widgets/tab_bar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pydm/widgets/tab_bar.py b/pydm/widgets/tab_bar.py index 5a52119cc..5548e34bd 100644 --- a/pydm/widgets/tab_bar.py +++ b/pydm/widgets/tab_bar.py @@ -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 @@ -24,7 +25,7 @@ def __init__(self, parent=None): self.alarm_icons = None self.generate_alarm_icons() - @Property(str) + @Property(QByteArray) def currentTabAlarmChannel(self): """A channel to use for this tab's alarm indicator.""" if self.currentIndex() < 0: @@ -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. @@ -198,7 +199,7 @@ def currentTabAlarmChannel(self): ------- str """ - return self.tabBar().currentTabAlarmChannel + return self.tabBar().currentTabAlarmChannel or '' @currentTabAlarmChannel.setter def currentTabAlarmChannel(self, new_alarm_channel): From 44127452b35dabaffbe9ebe9f8a7f34d2d7c8879 Mon Sep 17 00:00:00 2001 From: cristinasewell Date: Fri, 4 Sep 2020 15:56:50 -0700 Subject: [PATCH 3/4] MNT: move implementation in PyDMTabWidget class and make it compatible with python3 --- pydm/widgets/tab_bar.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pydm/widgets/tab_bar.py b/pydm/widgets/tab_bar.py index 5548e34bd..ddc7fadd7 100644 --- a/pydm/widgets/tab_bar.py +++ b/pydm/widgets/tab_bar.py @@ -25,7 +25,7 @@ def __init__(self, parent=None): self.alarm_icons = None self.generate_alarm_icons() - @Property(QByteArray) + @Property(str) def currentTabAlarmChannel(self): """A channel to use for this tab's alarm indicator.""" if self.currentIndex() < 0: @@ -199,11 +199,15 @@ def currentTabAlarmChannel(self): ------- str """ - return self.tabBar().currentTabAlarmChannel or '' + 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): """ From 68c3ba265f696c3881f924cec017202fddc01e88 Mon Sep 17 00:00:00 2001 From: cristinasewell Date: Fri, 4 Sep 2020 16:37:26 -0700 Subject: [PATCH 4/4] MNT: reverted back the additions in tab_bar_qtplugin in the domXML - not needed --- pydm/widgets/tab_bar_qtplugin.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pydm/widgets/tab_bar_qtplugin.py b/pydm/widgets/tab_bar_qtplugin.py index 3a5936ab3..02a5dfa93 100644 --- a/pydm/widgets/tab_bar_qtplugin.py +++ b/pydm/widgets/tab_bar_qtplugin.py @@ -23,9 +23,6 @@ def domXml(self): " \n" " {2}\n" " \n" - "\n" - " \n" - "\n" "\n" "\n" " \n"