PyDMTabWidget
The PyDM Tab Widget is a container widget that lets you switch between different pages of content using a tab bar. Each tab has an optional alarm channel. When a tab specifies an alarm channel, an alarm indicator will appear next to the label for that tab. When the channel’s alarm severity changes, the indicator will update accordingly. This is most useful for ‘summary’ alarms, where you have one alarm that represents the alarm state of a whole group of devices.
Using the PyDM Tab Widget in Designer
In designer, drag a tab widget from the widget list onto your display, and resize it appropriately. You can use the property editor to give the current tab a label (the ‘currentTabText’ property), a name (the ‘currentTabName’ property - this is what you will use to refer to this tab in code), and an alarm channel (‘currentTabAlarmChannel’). To add a new tab to the tab widget, right click on the widget and select ‘Insert Page’. You can choose to insert before or after the current tab. To remove a tab, right click on the tab widget, and select ‘Page X of Y’ -> Delete.
Widget Properties
Property |
Type |
Description |
---|---|---|
currentTabAlarmChannel |
str |
A channel to use for the alarm indicator on the current tab. |
currentTabText |
str |
The label to use for the current tab. |
currentTabName |
str |
A name for the tab. This is how you will refer to the tab in python code. |
API Documentation
- class pydm.widgets.tab_bar.PyDMTabWidget(parent=None)[source]
Bases:
QTabWidget
PyDMTabWidget provides a tabbed container widget. Each tab has an alarm channel property which can be used to show an alarm indicator on the tab. The indicator is driven by the alarm severity of the specified channel, not the value.
- Parameters:
parent (QWidget) – The parent widget for the Tab Widget
- alarmChannels
alarmChannels is a property used to store the configuration of this tab bar when it has been created in Qt Designer. This property isn’t directly editable by users, they will go through the currentTabAlarmChannel property to edit this information.
- currentTabAlarmChannel
A channel to use for the current tab’s alarm indicator.
- Return type:
str
- disconnectedAlarmIconColor
A color to use for alarm-sensitive tabs that have PyDMWidget.ALARM_DISCONNECTED severity level. This property can be defined in a stylesheet by using ‘qproperty-disconnectedAlarmIconColor’.
- Return type:
QColor
- documentMode
- getAlarmChannels()[source]
alarmChannels is a property used to store the configuration of this tab bar when it has been created in Qt Designer. This property isn’t directly editable by users, they will go through the currentTabAlarmChannel property to edit this information.
- invalidAlarmIconColor
A color to use for alarm-sensitive tabs that have PyDMWidget.ALARM_INVALID severity level. This property can be defined in a stylesheet by using ‘qproperty-majorAlarmIconColor’.
- Return type:
QColor
- majorAlarmIconColor
A color to use for alarm-sensitive tabs that have PyDMWidget.ALARM_MAJOR severity level. This property can be defined in a stylesheet by using ‘qproperty-majorAlarmIconColor’.
- Return type:
QColor
- minorAlarmIconColor
A color to use for alarm-sensitive tabs that have PyDMWidget.ALARM_MINOR severity level. This property can be defined in a stylesheet by using ‘qproperty-minorAlarmIconColor’.
- Return type:
QColor
- noAlarmIconColor
A color to use for alarm-sensitive tabs that have PyDMWidget.ALARM_NONE severity level. This property can be defined in a stylesheet by using ‘qproperty-noAlarmIconColor’.
- Return type:
QColor
- setAlarmChannels(new_alarm_channels)[source]
Sets the list of alarm channels for each tab. This is needed for instantiating a tab widget from a .ui file, and is probably not very useful for users.
- tabsClosable
Note
See QTabWidget Documentation for all inherited properties and methods.