Skip to content

Commit

Permalink
ENH: HalButton - only add checked hal pin if the button is checkable
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtJacobson committed Aug 7, 2020
1 parent 5a772cb commit 1889e16
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions qtpyvcp/widgets/hal_widgets/hal_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ class HalButton(QPushButton, HALWidget):
========================= ===== =========
qtpyvcp.button.enable bit in
qtpyvcp.button.out bit out
qtpyvcp.button.checked bit out
========================= ===== =========
.. note::
The `qtpyvcp.button.checked` halpin is only present if the :class:`.checkable` property is set to true.
"""
def __init__(self, parent=None):
super(HalButton, self).__init__(parent)
Expand Down Expand Up @@ -84,9 +90,10 @@ def initialize(self):
# add button.out HAL pin
self._pressed_pin = comp.addPin(obj_name + ".out", "bit", "out")

# add checkbox.checked HAL pin
self._checked_pin = comp.addPin(obj_name + ".checked", "bit", "out")
self._checked_pin.value = self.isChecked()
if self.isCheckable():
# add button.checked HAL pin
self._checked_pin = comp.addPin(obj_name + ".checked", "bit", "out")
self._checked_pin.value = self.isChecked()

if self._pulse:
self.pulse_timer = QTimer()
Expand Down

0 comments on commit 1889e16

Please sign in to comment.