Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from qtpy.QtWidgets import QCheckBox
from qtpy.QtCore import Property, QEvent
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalCheckBox(QCheckBox, HALWidget):
"""HAL CheckBox
CheckBox for displaying and setting `bit` HAL pin values.
.. table:: Generated HAL Pins
========================= ===== =========
HAL Pin Name Type Direction
========================= ===== =========
qtpyvcp.checkbox.enable bit in
qtpyvcp.checkbox.check bit in
qtpyvcp.checkbox.checked bit out
========================= ===== =========
"""
def __init__(self, parent=None):
super(HalCheckBox, self).__init__(parent)
from qtpy.QtWidgets import QLCDNumber
from qtpy.QtCore import Property
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalLCDNumber(QLCDNumber, HALWidget):
"""HAL LCD Number
LCD Number for displaying `float` or `s32` HAL pin values.
.. table:: Generated HAL Pins
===================== ========= =========
HAL Pin Name Type Direction
===================== ========= =========
qtpyvcp.lcd.in-i s32 in
qtpyvcp.lcd.in-f float in
===================== ========= =========
"""
def __init__(self, parent=None):
super(HalLCDNumber, self).__init__(parent)
from qtpy.QtWidgets import QGroupBox
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalGroupBox(QGroupBox, HALWidget):
"""HAL GroupBox
GroupBox that can be enabled/disabled via HAL pins.
.. table:: Generated HAL Pins
========================= ===== =========
HAL Pin Name Type Direction
========================= ===== =========
qtpyvcp.group-box.enable bit in
qtpyvcp.group-box.visible bit in
qtpyvcp.group-box.check bit in
qtpyvcp.group-box.checked bit out
========================= ===== =========
"""
from qtpy.QtCore import Property, QTimer
from qtpy.QtWidgets import QPushButton
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalButton(QPushButton, HALWidget):
"""HAL Button
Button for setting `bit` HAL pin values.
.. table:: Generated HAL Pins
========================= ===== =========
HAL Pin Name Type Direction
========================= ===== =========
qtpyvcp.button.enable bit in
qtpyvcp.button.out bit out
========================= ===== =========
"""
def __init__(self, parent=None):
super(HalButton, self).__init__(parent)
qtpyvcp.bar-indicator.in-f float in
qtpyvcp.bar-indicator.min-val float in
qtpyvcp.bar-indicator.max-val float in
============================= ===== =========
"""
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
from qtpyvcp.widgets.base_widgets.bar_indicator import BarIndicatorBase
# Setup logging
from qtpyvcp.utilities.logger import getLogger
log = getLogger(__name__)
class HalBarIndicator(BarIndicatorBase, HALWidget):
"""HAL Bar Indicator"""
def __init__(self, parent=None):
super(HalBarIndicator, self).__init__(parent)
self._int_in_pin = None
self._float_in_pin = None
self._min_val_pin = None
self._max_val_pin = None
def initialize(self):
comp = hal.getComponent('qtpyvcp')
obj_name = str(self.objectName()).replace('_', '-')
if self.minimum < 0:
int_pin_typ = 's32'
from qtpy.QtWidgets import QDoubleSpinBox
from qtpy.QtCore import QEvent
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalDoubleSpinBox(QDoubleSpinBox, HALWidget):
"""HAL DoubleSpinBox
DoubleSpinBox for displaying and setting `float` HAL pin values.
.. table:: Generated HAL Pins
========================= ========= =========
HAL Pin Name Type Direction
========================= ========= =========
qtpyvcp.spinbox.enable bit in
qtpyvcp.spinbox.in float in
qtpyvcp.spinbox.out float out
========================= ========= =========
"""
def __init__(self, parent=None):
super(HalDoubleSpinBox, self).__init__(parent)
from qtpyvcp.widgets import HALWidget
IN_DESIGNER = os.getenv('DESIGNER', False)
class TimeAxisItem(pg.AxisItem):
"""Internal timestamp for x-axis"""
def __init__(self, *args, **kwargs):
super(TimeAxisItem, self).__init__(*args, **kwargs)
def tickStrings(self, values, scale, spacing):
"""Function overloading the weak default version to provide timestamp"""
return [QTime().currentTime().addMSecs(value).toString('mm:ss') for value in values]
class HalPlot(QWidget, HALWidget):
"""HAL Plot
Plot for displaying HAL pin values.
Input pin type is HAL type ( float).
Up to four HAL pin values can be plotted
.. table:: Generated HAL Pins
========================= =========== =========
HAL Pin Name Type Direction
========================= =========== =========
qtpyvcp.seriesXname.in float in
========================= =========== =========
"""
from qtpy.QtWidgets import QSlider
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
class HalSlider(QSlider, HALWidget):
"""HAL Slider
Slider for setting `u32` or `float` HAL pin values.
.. table:: Generated HAL Pins
========================= ===== =========
HAL Pin Name Type Direction
========================= ===== =========
qtpyvcp.slider.enable bit in
qtpyvcp.slider.out-i u32 out
qtpyvcp.slider.out-f float out
========================= ===== =========
"""
def __init__(self, parent=None):
super(HalSlider, self).__init__(parent)
from qtpy.QtWidgets import QLabel
from qtpy.QtCore import Property, Q_ENUMS
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
from . import HalType
class HalLabel(QLabel, HALWidget, HalType):
"""HAL Label
Label for displaying HAL pin values.
Input pin type is selectable via the :class:`.pinType` property in designer,
and can be any valid HAL type (bit, u32, s32, float).
The text format can be specified via the :class:`.textFormat` property in
designer and can be any valid python style format string.
.. table:: Generated HAL Pins
========================= =========== =========
HAL Pin Name Type Direction
========================= =========== =========
qtpyvcp.label.enable bit in
from qtpyvcp import hal
from qtpyvcp.widgets import HALWidget
from qtpyvcp.widgets.base_widgets.led_widget import LEDWidget
# Setup logging
from qtpyvcp.utilities.logger import getLogger
log = getLogger(__name__)
class HalLedIndicator(LEDWidget, HALWidget):
"""HAL LED
LED for indicated the state of `bit` HAL pins.
.. table:: Generated HAL Pins
========================= ========= =========
HAL Pin Name Type Direction
========================= ========= =========
qtpyvcp.led.on bit in
qtpyvcp.led.flash bit in
qtpyvcp.led.flash-rate u32 out
========================= ========= =========
"""
def __init__(self, parent=None):
super(HalLedIndicator, self).__init__(parent)