Ejemplo n.º 1
0
 def getPortSettings(self):
     comPort = util.QStringToStr(self.port_comboBox.currentText())
     baud = int(util.QStringToStr(self.baud_comboBox.currentText()))
     parity = Serial.PARITIES[self.parity_comboBox.currentIndex()]
     bytesize = Serial.BYTESIZES[self.bytesize_comboBox.currentIndex()]
     stopbits = Serial.STOPBITSES[self.stopbits_comboBox.currentIndex()]
     
     return  {
         "port": comPort, "baund": baud, "bytesize": bytesize,
         "parity": parity, "stopbits": stopbits, "timeout": 1
     }
Ejemplo n.º 2
0
 def onRecvData(self, data):
     text = data
     if not self.hideSRFlag_checkBox.isChecked():
         text = 'RECV (%s)\n%s' % (util.QStringToStr(QTime.currentTime().toString()), data)
     
     self.recv_TextBrowser.setPlainTextWithNoNL(text)
     
     if self.autoLF_checkBox.isChecked():
         self.recv_TextBrowser.setPlainTextWithNoNL("\n")
Ejemplo n.º 3
0
 def onSendData(self, data, _type=config.ASCII_TYPE):
     if self.clearSentText_checkBox.isChecked() and not self.autoSend_checkBox.isChecked():
         self.send_TextEdit.clear()
         
     if not self.showSent_checkBox.isChecked():
         return
         
     text = data
     if not self.hideSRFlag_checkBox.isChecked():
         text = 'SEND (%s)\n%s\n' % (util.QStringToStr(QTime.currentTime().toString()), data)
         
     self.recv_TextBrowser.setPlainTextWithNoNL(text)
Ejemplo n.º 4
0
    def getCurrentConfigDict(self):
        configDict = {
            config.COMSETTINGS_KEY: {},
            config.RECVSETTINGS_KEY: {},
            config.SENDSETTINGS_KEY: {}
        }
        configDict[config.COMSETTINGS_KEY][
            config.PORT_KEY] = util.QStringToStr(
                self.port_comboBox.currentText())
        configDict[config.COMSETTINGS_KEY][
            config.BAUD_KEY] = util.QStringToStr(
                self.baud_comboBox.currentText())
        configDict[config.COMSETTINGS_KEY][
            config.BYTESIZE_KEY] = util.QStringToStr(
                self.bytesize_comboBox.currentText())
        configDict[config.COMSETTINGS_KEY][
            config.PARITY_KEY] = util.QStringToStr(
                self.parity_comboBox.currentText())
        configDict[config.COMSETTINGS_KEY][
            config.STOPBITS_KEY] = util.QStringToStr(
                self.stopbits_comboBox.currentText())

        configDict[config.RECVSETTINGS_KEY][
            config.RECVTYPE_KEY] = util.QStringToStr(
                self.recvType_comboBox.currentText())
        configDict[config.RECVSETTINGS_KEY][
            config.AUTOLINEFEED_KEY] = self.autoLF_checkBox.isChecked(
            ) and config.YES or config.NO
        configDict[config.RECVSETTINGS_KEY][
            config.HIDERSFLAG_KEY] = self.hideSRFlag_checkBox.isChecked(
            ) and config.YES or config.NO
        configDict[config.RECVSETTINGS_KEY][
            config.MERGE_INTERVAL_KEY] = config.mergeInterval

        configDict[config.SENDSETTINGS_KEY][
            config.SENDTYPE_KEY] = util.QStringToStr(
                self.sendType_comboBox.currentText())
        configDict[config.SENDSETTINGS_KEY][
            config.CLEARSENTTEXT_KEY] = self.clearSentText_checkBox.isChecked(
            ) and config.YES or config.NO
        configDict[config.SENDSETTINGS_KEY][
            config.SHOWSENT_KEY] = self.showSent_checkBox.isChecked(
            ) and config.YES or config.NO
        configDict[config.SENDSETTINGS_KEY][config.SENDINTERVAL_KEY] = str(
            self.sendInterval_spinBox.value())

        return configDict