Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lib/python/qtvcp/widgets/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <enum>HalBar::REAL</enum> 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)
Expand Down
20 changes: 8 additions & 12 deletions lib/python/qtvcp/widgets/joypad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -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 <enum>HALPad::REAL</enum> with getattr(HALPad, 'REAL')
for _name, _member in HALPinType.__members__.items():
setattr(HALPad, _name, _member)

#############################
# Testing #
#############################
Expand Down
20 changes: 8 additions & 12 deletions lib/python/qtvcp/widgets/simple_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -509,6 +500,11 @@ def reset_exclusive_value(self):

exclusiveHALValue = QtCore.Property(float, get_exclusive_value, set_exclusive_value, reset_exclusive_value)


# uic resolves <enum>PushButton::REAL</enum> 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.
Expand Down
Loading