""" The versions ui loader class """ # Python import os # Qt from PySide2 import QtWidgets from PySide2.QtCore import Slot # parent from simulator.dynamicloader import DynamicLoader # hd Simulator from simulator.interface import SimulationInterface # plugin specific # -- none -- class Loader(DynamicLoader): """ The Versions ui loader class """ sbHDMajor: QtWidgets.QSpinBox sbHDMinor: QtWidgets.QSpinBox sbHDMicro: QtWidgets.QSpinBox sbHDBuild: QtWidgets.QSpinBox sbHDFPGAid: QtWidgets.QSpinBox sbHDFPGAMajor: QtWidgets.QSpinBox sbHDFPGAMinor: QtWidgets.QSpinBox sbHDFPGALab: QtWidgets.QSpinBox sbDGMajor: QtWidgets.QSpinBox sbDGMinor: QtWidgets.QSpinBox sbDGMicro: QtWidgets.QSpinBox sbDGBuild: QtWidgets.QSpinBox sbDGFPGAid: QtWidgets.QSpinBox sbDGFPGAMajor: QtWidgets.QSpinBox sbDGFPGAMinor: QtWidgets.QSpinBox sbDGFPGALab: QtWidgets.QSpinBox leHDSerial: QtWidgets.QLineEdit leDGSerial: QtWidgets.QLineEdit pbHDSend: QtWidgets.QPushButton pbDGSend: QtWidgets.QPushButton def __init__(self, interface: SimulationInterface): super().__init__(os.path.dirname(__file__), interface) def _init_loader(self): """ finds and creates widgets :return: none """ self.sbHDMajor = self.find_spinbox('sbHDMajor') self.sbHDMinor = self.find_spinbox('sbHDMinor') self.sbHDMicro = self.find_spinbox('sbHDMicro') self.sbHDBuild = self.find_spinbox('sbHDBuild') self.sbHDFPGAid = self.find_spinbox('sbHDFPGAid') self.sbHDFPGAMajor = self.find_spinbox('sbHDFPGAMajor') self.sbHDFPGAMinor = self.find_spinbox('sbHDFPGAMinor') self.sbHDFPGALab = self.find_spinbox('sbHDFPGALab') self.sbDGMajor = self.find_spinbox('sbDGMajor') self.sbDGMinor = self.find_spinbox('sbDGMinor') self.sbDGMicro = self.find_spinbox('sbDGMicro') self.sbDGBuild = self.find_spinbox('sbDGBuild') self.sbDGFPGAid = self.find_spinbox('sbDGFPGAid') self.sbDGFPGAMajor = self.find_spinbox('sbDGFPGAMajor') self.sbDGFPGAMinor = self.find_spinbox('sbDGFPGAMinor') self.sbDGFPGALab = self.find_spinbox('sbDGFPGALab') self.leHDSerial = self.find_line_edit('leHDSerial') self.leDGSerial = self.find_line_edit('leDGSerial') self.pbHDSend = self.find_button('pbHDSend') self.pbDGSend = self.find_button('pbDGSend') def _init_widgets(self): """ initializes the widgets' properties :return: none """ pass def _init_connections(self): """ initializes the widgets connections :return: """ self.pbHDSend.clicked.connect(self.do_hd_version_data) self.pbDGSend.clicked.connect(self.do_dg_version_data) self.pbHDSend.clicked.connect(self.do_hd_serial_data) self.pbDGSend.clicked.connect(self.do_dg_serial_data) @Slot() def do_hd_version_data(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_version_hd_data :return: none """ sb_hd_major = self.sbHDMajor.value() sb_hd_minor = self.sbHDMinor.value() sb_hd_micro = self.sbHDMicro.value() sb_hd_build = self.sbHDBuild.value() sb_hd_fpga_id = self.sbHDFPGAid.value() sb_hd_fpga_major = self.sbHDFPGAMajor.value() sb_hd_fpga_minor = self.sbHDFPGAMinor.value() sb_hd_fpga_lab = self.sbHDFPGALab.value() self.interface.hd.cmd_send_version_hd_data( sb_hd_major, sb_hd_minor, sb_hd_micro, sb_hd_build, sb_hd_fpga_id, sb_hd_fpga_major, sb_hd_fpga_minor, sb_hd_fpga_lab, ) @Slot() def do_dg_version_data(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_version_dg_data :return: none """ print("DG version") sb_dg_major = self.sbDGMajor.value() sb_dg_minor = self.sbDGMinor.value() sb_dg_micro = self.sbDGMicro.value() sb_dg_build = self.sbDGBuild.value() sb_dg_fpga_id = self.sbDGFPGAid.value() sb_dg_fpga_major = self.sbDGFPGAMajor.value() sb_dg_fpga_minor = self.sbDGFPGAMinor.value() sb_dg_fpga_lab = self.sbDGFPGALab.value() self.interface.dg.cmd_send_version_dg_data( sb_dg_major, sb_dg_minor, sb_dg_micro, sb_dg_build, sb_dg_fpga_id, sb_dg_fpga_major, sb_dg_fpga_minor, sb_dg_fpga_lab, ) @Slot() def do_hd_serial_data(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_serial_hd_data :return: none """ self.interface.hd.cmd_send_serial_hd_data( self.leHDSerial.text() ) @Slot() def do_dg_serial_data(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_serial_dg_data :return: none """ self.interface.dg.cmd_send_serial_dg_data( self.leDGSerial.text() )