MCPcopy Create free account
hub / github.com/PyQt5/PyQt / on_buttonSend_clicked

Method on_buttonSend_clicked

QSerialPort/SerialDebugAssistant.py:82–96  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80
81 @pyqtSlot()
82 def on_buttonSend_clicked(self):
83 # 发送消息按钮
84 if not self._serial.isOpen():
85 print('串口未连接')
86 return
87 text = self.plainTextEdit.toPlainText()
88 if not text:
89 return
90 text = QByteArray(text.encode('gb2312')) # emmm windows 测试的工具貌似是这个编码
91 if self.checkBoxHexSend.isChecked():
92 # 如果勾选了hex发送
93 text = text.toHex()
94 # 发送数据
95 print('发送数据:', text)
96 self._serial.write(text)
97
98 def onReadyRead(self):
99 # 数据接收响应

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected