Source code for qtpyvcp.widgets.input_widgets.action_slider

import linuxcnc
from qtpy.QtWidgets import QSlider
from qtpy.QtCore import Slot, Property

from qtpyvcp.actions import bindWidget
from qtpyvcp.utilities.logger import getLogger
from qtpyvcp.plugins import getPlugin


LOG = getLogger(__name__)
STATUS = getPlugin('status')


[docs]class ActionSlider(QSlider): """docstring for ActionSlider.""" def __init__(self, parent=None): super(ActionSlider, self).__init__(parent) self._action_name = '' @Property(str) def actionName(self): """The fully qualified name of the action the slider should trigger. Returns: str : The action name. """ return self._action_name @actionName.setter def actionName(self, action_name): """Sets the name of the action the slider should trigger. Args: action_name (str) : A fully qualified action name. """ self._action_name = action_name bindWidget(self, action_name)
[docs] def mouseDoubleClickEvent(self, event): # Test for UI LOCK and consume event but do nothing if LOCK in place if STATUS.isLocked(): LOG.debug('Accept mouse Double Click Event') event.accept() return self.setValue(100)
[docs] def mousePressEvent(self, event): # Test for UI LOCK and consume event but do nothing if LOCK in place if STATUS.isLocked(): LOG.debug('Accept mouse Press Event') event.accept() return super().mousePressEvent(event)
[docs] def mouseReleaseEvent(self, event): if STATUS.isLocked(): LOG.debug('Accept mouse Release Event') event.accept() return super().mouseReleaseEvent(event)
[docs] def keyPressEvent(self, event): # Test for UI LOCK and consume event but do nothing if LOCK in place if STATUS.isLocked(): LOG.debug('Accept keyPressEvent Event') event.accept() return super().keyPressEvent(event)
[docs] def keyReleaseEvent(self, event): # Test for UI LOCK and consume event but do nothing if LOCK in place if STATUS.isLocked(): LOG.debug('Accept keyReleaseEvent Event') event.accept() return super().keyReleaseEvent(event)