示例#1
0
 def setupTest(self):
     # Setup Test
     self.test_step_current = 1
     self.test_step_major_current = 1
     self.test_progress_current = 0
     self.progressbar_signal.emit(self.test_progress_current)
     BaseLogger.info('Test Started')
示例#2
0
 def __init__(self, printer, tip_holder, well, pcr, tip_trash, pipette,
              magnet, imagebox_signal, textbox_signal, progressbar_signal,
              test_abort_signal, test_finish_signal):
     if not printer \
         or not tip_holder \
         or not well \
         or not pcr \
         or not tip_trash \
         or not pipette \
         or not magnet \
         or not imagebox_signal \
         or not textbox_signal \
         or not progressbar_signal \
         or not test_abort_signal \
         or not test_finish_signal:
         raise TypeError('required arguments missing')
     super(TestBase, self).__init__()
     self.printer = printer
     self.tip_holder = tip_holder
     self.well = well
     self.pcr = pcr
     self.tip_trash = tip_trash
     self.pipette = pipette
     self.magnet = magnet
     self.imagebox_signal = imagebox_signal
     self.textbox_signal = textbox_signal
     self.progressbar_signal = progressbar_signal
     self.aborted_signal = test_abort_signal
     self.finished_signal = test_finish_signal
     BaseLogger.info('Test Initialized')
示例#3
0
 def sendCommand(self, command=None):
     # Send Serial Command To MKS
     if not command:
         raise TypeError('Required arguments missing')
     self.serial_command = '%s\r\n' % command
     self.serial_handle.write(self.serial_command.encode())
     BaseLogger.debug('<<< ' + self.serial_command.rstrip())
示例#4
0
 def getResponse(self):
     # Get Incoming Response Data From MKS If Any
     time.sleep(self.serial_response_wait)
     self.serial_response = self.serial_handle.readline()
     if self.serial_response:
         BaseLogger.debug('>>> ' + self.serial_response.decode().rstrip())
         return self.serial_response.decode()
     return None
 def disengage(self, instance = None):
     # Disengage Magnetic Assembly Specific Instance
     if instance == None:
         raise TypeError('Required arguments missing')
     if instance not in MechanicalParameters.servo_ports:
         BaseLogger.error('invalid servo port')
         return
     self.printer_handle.moveServo(instance, \
         MechanicalParameters.servo_position_degree_disengaged[instance])
示例#6
0
 def run(self):
     # Find Which Port MKS Is On
     self.mks_port = USBIdentifyFTDIPort()
     if (self.mks_port is None):
         BaseLogger.info('MKS - cannot find port')
         self.signal.emit('MKS-FAIL')
         return
     BaseLogger.info('MKS PORT : ' + self.mks_port)
     self.connected = True
     self.signal.emit('MKS-OK')
 def __init__(self, test_file_path=None):
     if not test_file_path:
         raise TypeError('Required argument \'test_file_path\' missing')
     self.testConfigFile = test_file_path
     with open(self.testConfigFile, 'r') as ymlfile:
         try:
             data = yaml.safe_load(ymlfile)
             self._testCount = len(data.get('tests'))
             self._testList = data.get('tests')
             BaseLogger.info('Found ' + str(self._testCount) + ' tests ...')
         except yaml.YAMLError as error:
             print(error)
 def showFileSelector(self):
     # Show QT File Selector
     selector = QFileDialog(self, 'Select CSV File', '/home/pi','CSV files(*.csv)')
     filenames = []
     if selector.exec_():
         filenames = selector.selectedFiles()
     if len(filenames) != 0:
         # CSV File Selected
         BaseLogger.info('PD File : ' + filenames[0])
         self.pdNextButton.setEnabled(True)
         # Load CSV Data
         table_data = CSVRead(filenames[0])
         self.pdTableView.setModel(QTablePatientDetailsDataModel(table_data))
         self.current_test_pd_file_path = filenames[0]
    def __init__(self):
        super(MainUI, self).__init__()
        uic.loadUi(self.path_ui_file, self)

        # Setup UI Signals / Slots
        self.setupButtons()
        self.setupSignalSlots()

        # Setup Main Window
        self.showMainScreen()
        
        self.show()
        self.showFullScreen()
        BaseLogger.info('gui loaded')
    def run(self):
        BaseLogger.info('Initializing Printer ...')

        self._thread_mks_check = MKSCheck()
        self._thread_mks_check.start()

        # Wait For MKS Checking To Finish
        # Check If Initialized Properly
        self._thread_mks_check.wait()
        if (not bool(self._thread_mks_check.getStatus())):
            BaseLogger.info('Hardware Error ... HALTING')
            while (True):
                pass

        # Create MKS Serial Connection
        self.mks_serial_comm = MKSSerialCommunication(
            self._thread_mks_check.getPort(), 115200)
        self.connected = True

        # Set Printer Parameters
        BaseLogger.info('Setting Printer Parameters ...')
        self.positionAbsolute()
        self.temperatureCelcius()

        # Printer Home
        BaseLogger.info('Homing Printer ...')
        self.moveServo(0, 0)
        self.home()

        self.homed = True

        # Run Thread Indefinitly
        while True:
            pass
 def testsListbuttonGroupOnClick(self, index):
     # Tests List Button Group Callback
     test_text = self.test_list_button_group.button(index).text()
     self.cpNextButton.setEnabled(True)
     BaseLogger.info('selected test : ' + test_text)
     test_index = self.handle_tests.getTestIndexFromName(test_text)
     self.current_test_index = test_index
     BaseLogger.info('test index : ' + str(test_index))
     BaseLogger.info('test description : ' + self.handle_tests.getTestDescription(test_index))
     BaseLogger.info('test filename : ' + self.handle_tests.getTestFileName(test_index))
示例#12
0
 def runTest(self, test_steps):
     # Run Test
     self.tip_holder.reset()
     self.pipette.dispense()
     if not test_steps:
         raise TypeError('required arguments missing')
     for step in test_steps:
         BaseLogger.info('Test step (' + str(self.test_step_current) + '/' +
                         str(self.test_step_major + self.test_step_minor) +
                         ')')
         exec(step)
         if bool(self.isTestStepMajor(step)):
             self.test_progress_current = self.test_progress_delta * self.test_step_major_current
             self.test_step_major_current += 1
             self.progressbar_signal.emit(self.test_progress_current)
         self.test_step_current += 1
         # Check For Test Abort
         if (self.test_aborting):
             self.printer.home()
             self.test_aborted = True
             BaseLogger.info('Test aborted')
             self.aborted_signal.emit()
             return
     BaseLogger.info('Test Finished')
     self.finished_signal.emit()
示例#13
0
 def __init__(self, config_file_path):
     self.configFilePath = config_file_path
     with open(self.configFilePath, 'r') as ymlfile:
         try:
             self.configData = yaml.safe_load(ymlfile)
             self.isConfigPresent = True
             self.deviceName = self.configData.get('info_device').get(
                 'name')
             self.deviceFirmware = str(
                 self.configData.get('info_release').get('version_major')
             ) + '.' + str(
                 self.configData.get('info_release').get('version_minor'))
             self.deviceFirmwareDate = self.configData.get(
                 'info_release').get('date')
         except yaml.YAMLError as error:
             self.isConfigPresent = False
             self.deviceName = ''
             self.deviceFirmware = ''
             self.deviceFirmwareDate = ''
             self.octoprintServerIP = ''
             self.octoprintAPIKey = ''
             BaseLogger.error(error)
示例#14
0
 def parseTest(self, test_steps=None):
     # Parse Test And Update Test Metrics
     self.test_step_major = 0
     self.test_step_minor = 0
     if not test_steps:
         raise TypeError('required arguments missing')
     for i in test_steps:
         if not i.startswith('self.imagebox_signal') and not i.startswith(
                 'self.textbox_signal'):
             # This Is A Major Test Step
             self.test_step_major += 1
         else:
             # This Is A Minor  Test Step
             self.test_step_minor += 1
     self.test_progress_delta = 100 / self.test_step_major
     BaseLogger.info('Test step total = ' +
                     str(self.test_step_major + self.test_step_minor))
     BaseLogger.info('Test step major = ' + str(self.test_step_major))
     BaseLogger.info('Test step minor = ' + str(self.test_step_minor))
     BaseLogger.info('Test progress delta = ' +
                     str(self.test_progress_delta))
示例#15
0
 def __init__(self, serialport=None, serialspeed=None):
     if not serialport or not serialspeed:
         raise TypeError('Required arguments missing')
     self.serial_port = serialport
     self.serial_speed = serialspeed
     # Open Serial Port
     # Give 5 Second Delay For Port To Finish Opening
     # Flash Any Garbage That Comes In Between
     BaseLogger.info('Opening Serial Port ' + self.serial_port + ' @ ' + str(self.serial_speed))
     self.serial_handle = serial.Serial(self.serial_port, self.serial_speed)
     time.sleep(self.serial_opening_wait)
     self.serial_handle.flushInput()
     if(self.serial_handle):
         BaseLogger.info('Serial Port Opened ...')
     else:
         BaseLogger.info('Serial Port Error ...')
# Global Variables
device_config = None
tests = None
main_app = None
main_window = None
thread_printer = None

path_config_file_system = '/home/pi/xenovia/config/config_system.yaml'
path_config_file_test = '/home/pi/xenovia/config/config_tests.yaml'

if __name__ == '__main__':

    faulthandler.enable()

    #Start GUI Subsystem
    BaseLogger.info('Starting GUI ...')
    main_app = QtWidgets.QApplication(sys.argv)
    main_window = MainUI()

    # Read Device Configuration
    BaseLogger.info('Reading device configuration')
    device_config = DeviceConfig(config_file_path=path_config_file_system)

    # Print Firmware Info
    BaseLogger.info('---------------------------')
    BaseLogger.info(device_config.deviceName)
    BaseLogger.info('ver : ' + device_config.deviceFirmware)
    BaseLogger.info('date : ' + device_config.deviceFirmwareDate)
    BaseLogger.info('---------------------------')

    # Read Tests
示例#17
0
 def abortTest(self):
     # Initiate Test Abort
     self.test_aborting = True
     BaseLogger.info('Test aborting')