def singleMeasurment(self):
        # self.running = True
        # self.stopButton.setHidden(False)
        # self.startButton.setHidden(True)
        # self.stateLabel.setText('Подготовка к измерениям...')

        self.running = True
        self.stopButton.setHidden(False)
        self.startButton.setHidden(True)
        self.stateLabel.setText("Проводятся измерения")

        selectedDevice = self.devicesBox.currentText()
        selectedSpeed = int(self.speedBox.currentText())
        selectedDuration = int(self.durationBox.currentText())
        # selectedStopBits = int(self.stop.currentText())
        # selectedByteSize = int(self.byteSizeBox.currentText())
        dirName = str(time.ctime()).replace(":", "-")
        try:
            measurment.run(port=selectedDevice,
                           speed=selectedSpeed,
                           duration=selectedDuration,
                           dirName=dirName,
                           num=1,
                           saving=True,
                           widget=self)

        except Exception as error:
            print(error)
            QMessageBox.question(
                self, 'Уведомление',
                "Не удалось подключиться к %s" % selectedDevice,
                QMessageBox.Ok | QMessageBox.Ok)
        finally:
            self.stateLabel.setText('Отключено')
        def thread():
            i = 1
            while self.running:
                try:
                    measurment.run(port=selectedDevice,
                                   speed=selectedSpeed,
                                   dirName=dirName,
                                   num=i,
                                   uGraph=False,
                                   iGraph=False)
                    i += 1
                except Exception as error:
                    print(error)

                time.sleep(10)
Exemple #3
0
 def thread():
     i = 1
     # while self.running:
     try:
         measurment.run(
             statusLabel=self.stateLabel,
             port=selectedDevice,
             speed=selectedSpeed,
             dirName=dirName,
             num=i,
             uGraph=False,
             iGraph=False
         )
         i += 1
     except Exception as error:
         print("Thread", error)
    def singleMeasurment(self):

        selectedDevice = self.devicesBox.currentText()
        selectedSpeed = int(self.speedBox.currentText())
        # selectedStopBits = int(self.stop.currentText())
        # selectedByteSize = int(self.byteSizeBox.currentText())
        dirName = str(time.ctime()).replace(":", "-")
        try:
            measurment.run(port=selectedDevice,
                           speed=selectedSpeed,
                           dirName=dirName)

        except Exception as error:
            print(error)
            QMessageBox.question(
                self, 'Уведомление',
                "Не удалось подключиться к %s" % selectedDevice,
                QMessageBox.Ok | QMessageBox.Ok)