diff --git a/lib/python/qtvcp/widgets/bar.py b/lib/python/qtvcp/widgets/bar.py index 1d59c283c2b..c72febf6930 100644 --- a/lib/python/qtvcp/widgets/bar.py +++ b/lib/python/qtvcp/widgets/bar.py @@ -408,23 +408,16 @@ def resetVert(self): class HALPinType(enum.IntEnum): NONE = 0 - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated SINT = hal.Type.SINT REAL = hal.Type.REAL + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated class HalBar(Bar, _HalWidgetBase): HALPinType = HALPinType QEnum(HALPinType) - # older version of pyqt5 need this as well as QEnum - NONE = 0 - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated - SINT = hal.Type.SINT - REAL = hal.Type.REAL - def __init__(self, *args, **kwargs): super(). __init__( *args, **kwargs) self._pin_type = HALPinType.SINT @@ -480,6 +473,11 @@ def reset_invert_negative(self): pinName = Property(str, get_pin_name, set_pin_name, reset_pin_name) invertOnNegative = Property(bool, get_invert_negative, set_invert_negative, reset_invert_negative) + +# uic resolves HalBar::REAL with getattr(HalBar, 'REAL') +for _name, _member in HALPinType.__members__.items(): + setattr(HalBar, _name, _member) + if __name__ == '__main__': from qtpy.QtWidgets import (QLabel, QSlider, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QCheckBox) diff --git a/lib/python/qtvcp/widgets/joypad.py b/lib/python/qtvcp/widgets/joypad.py index 85620e61b8e..17d07fb5fe2 100644 --- a/lib/python/qtvcp/widgets/joypad.py +++ b/lib/python/qtvcp/widgets/joypad.py @@ -539,26 +539,17 @@ def __setitem__(self, item, value): class HALPinType(enum.IntEnum): NONE = 0 - BIT = hal.Type.BOOL # Deprecated - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT REAL = hal.Type.REAL + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated class HALPad(JoyPad, _HalWidgetBase): HALPinType = HALPinType QEnum(HALPinType) - # older version of pyqt5 need this as well as QEnum - NONE = 0 - BIT = hal.Type.BOOL # Deprecated - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated - BOOL = hal.Type.BOOL - SINT = hal.Type.SINT - REAL = hal.Type.REAL - def __init__(self, parent=None): super(HALPad, self).__init__(parent) self._pin_name = '' @@ -657,6 +648,11 @@ def reset_pin_type(self): pin_type = QtCore.Property(HALPinType, get_pin_type, set_pin_type, reset_pin_type) pin_name = QtCore.Property(str, get_pin_name, set_pin_name, reset_pin_name) + +# uic resolves HALPad::REAL with getattr(HALPad, 'REAL') +for _name, _member in HALPinType.__members__.items(): + setattr(HALPad, _name, _member) + ############################# # Testing # ############################# diff --git a/lib/python/qtvcp/widgets/simple_widgets.py b/lib/python/qtvcp/widgets/simple_widgets.py index 3e814efee42..050bd2f1e05 100644 --- a/lib/python/qtvcp/widgets/simple_widgets.py +++ b/lib/python/qtvcp/widgets/simple_widgets.py @@ -45,12 +45,12 @@ class HALPinType(enum.IntEnum): NONE = 0 - BIT = hal.Type.BOOL # Deprecated - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated BOOL = hal.Type.BOOL SINT = hal.Type.SINT REAL = hal.Type.REAL + BIT = hal.Type.BOOL # Deprecated + S32 = hal.Type.SINT # Removed + FLOAT= hal.Type.REAL # Deprecated # reacts to HAL pin changes class LCDNumber(QtWidgets.QLCDNumber, _HalWidgetBase): @@ -360,15 +360,6 @@ class PushButton(QtWidgets.QPushButton, IndicatedMixIn): HALPinType = HALPinType QEnum(HALPinType) - # older version of pyqt5 need this as well as QEnum - NONE = 0 - BIT = hal.Type.BOOL # Deprecated - S32 = hal.Type.SINT # Removed - FLOAT= hal.Type.REAL # Deprecated - BOOL = hal.Type.BOOL - SINT = hal.Type.SINT - REAL = hal.Type.REAL - def __init__(self, parent=None): super(PushButton, self).__init__(parent) @@ -509,6 +500,11 @@ def reset_exclusive_value(self): exclusiveHALValue = QtCore.Property(float, get_exclusive_value, set_exclusive_value, reset_exclusive_value) + +# uic resolves PushButton::REAL with getattr(PushButton, 'REAL') +for _name, _member in HALPinType.__members__.items(): + setattr(PushButton, _name, _member) + class ScaledLabel(QtWidgets.QLabel): ''' Label that scales the text based on available size.