""" The Stop State ui loader """ # Python import os # Qt from PySide2 import QtWidgets from PySide2.QtCore import Slot # parent from engine.dynamicloader import DynamicLoader # plugin specific # hd Simulator from leahi_dialin.ui.td_messaging import TD_Messaging class Loader(DynamicLoader): """ The Stop State ui loader """ def __init__(self): self.td_interface = TD_Messaging() super().__init__(os.path.dirname(__file__)) def _init_loader(self): """ finds and creates widgets :return: none """ self.sTotal = self.find_widget(QtWidgets.QSlider , 'totalSlider' ) self.lbTotal = self.find_widget(QtWidgets.QLabel , 'totalValue' ) self.sCountdown = self.find_widget(QtWidgets.QSlider , 'countdownSlider' ) self.lbCountdown = self.find_widget(QtWidgets.QLabel , 'countdownValue' ) def _init_connections(self): """ initializes the widgets connections :return: none """ self.sTotal .valueChanged.connect(self.do_stop_state_data) self.sCountdown .valueChanged.connect(self.do_stop_state_data) def _init_widgets(self): """ initializes the widgets' properties :return: none """ self.sTotal .setMinimum (0 ) self.sTotal .setMaximum (300) self.sTotal .setValue (0 ) self.sCountdown .setMinimum (0 ) self.sCountdown .setMaximum (300) self.sCountdown .setValue (0 ) @Slot() def do_stop_state_data(self): """ the slot for Stop Time Data :return: none """ self.lbTotal .setText(str(self.sTotal .value() ) ) self.lbCountdown .setText(str(self.sCountdown .value() ) ) self.td_interface.td_treatment_stop_state( self.sTotal .value() , self.sCountdown .value() )