1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| from PyQt5 import QtCore, QtGui, QtWidgets
from send import *
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(975, 603)
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(130, 110, 91, 21))
self.pushButton.setObjectName("pushButton")
self.pushButton_2 = QtWidgets.QPushButton(Form)
self.pushButton_2.setGeometry(QtCore.QRect(130, 170, 93, 21))
self.pushButton_2.setObjectName("pushButton_2")
self.comboBox = QtWidgets.QComboBox(Form)
self.comboBox.setGeometry(QtCore.QRect(30, 110, 73, 22))
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox_2 = QtWidgets.QComboBox(Form)
self.comboBox_2.setGeometry(QtCore.QRect(30, 170, 73, 22))
self.comboBox_2.setObjectName("comboBox_2")
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.pushButton_3 = QtWidgets.QPushButton(Form)
self.pushButton_3.setGeometry(QtCore.QRect(130, 230, 93, 21))
self.pushButton_3.setObjectName("pushButton_3")
self.comboBox_3 = QtWidgets.QComboBox(Form)
self.comboBox_3.setGeometry(QtCore.QRect(30, 230, 73, 22))
self.comboBox_3.setObjectName("comboBox_3")
self.comboBox_3.addItem("")
self.comboBox_3.addItem("")
self.pushButton.clicked.connect(self.BTN1)
self.pushButton_2.clicked.connect(self.BTN2)
self.pushButton_3.clicked.connect(self.BTN3)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def BTN1(self,DAT1):
x=int(self.comboBox.currentText())
if x == 1:
a= 0b00000111 or DAT1
DAT1 = a
print("Communication BTN1 Detected")
return DAT1
elif x == 0:
b= 0b11111000 and DAT1
DAT1 = b
print("Communication BTN1 NOT Detected")
return DAT1
def BTN2(self,DAT1):
x=int(self.comboBox_2.currentText())
if x == 1:
a= 0b00111000 or DAT1
DAT1 = a
print("Communication BTN2 Detected")
return DAT1
elif x == 0:
b= 0b11000111 and DAT1
DAT1 = b
print("Communication BTN2 NOT Detected")
return DAT1
def BTN3(self,DAT1):
x=int(self.comboBox_3.currentText())
if x == 1:
a= 0b11000000 or DAT1
DAT1 = a
print("Communication BTN3 Detected")
return DAT1
elif x == 0:
b= 0b00111111 and DATA1
DATA1 = b
print("Communication BTN3 NOT Detected")
return DAT1
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton.setText(_translate("Form", "BTN1"))
self.pushButton_2.setText(_translate("Form", "BTN2"))
self.comboBox.setItemText(0, _translate("Form", "1"))
self.comboBox.setItemText(1, _translate("Form", "0"))
self.comboBox_2.setItemText(0, _translate("Form", "1"))
self.comboBox_2.setItemText(1, _translate("Form", "0"))
self.pushButton_3.setText(_translate("Form", "BTN3"))
self.comboBox_3.setItemText(0, _translate("Form", "1"))
self.comboBox_3.setItemText(1, _translate("Form", "0"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_()) |
Partager