def local_explained(self): from LocalExplaining import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show()
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(894, 570) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("brainPic.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) Form.setWindowIcon(icon) self.txtGlobalComp = QtWidgets.QLabel(Form) self.txtGlobalComp.setGeometry(QtCore.QRect(450, 50, 301, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtGlobalComp.setFont(font) self.txtGlobalComp.setObjectName("txtGlobalComp") self.listWidget = QtWidgets.QListWidget(Form) self.listWidget.setGeometry(QtCore.QRect(460, 100, 321, 51)) self.listWidget.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidget.setLineWidth(3) self.listWidget.setMidLineWidth(3) self.listWidget.setObjectName("listWidget") item = QtWidgets.QListWidgetItem() self.listWidget.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidget.addItem(item) self.txtLocal = QtWidgets.QLabel(Form) self.txtLocal.setGeometry(QtCore.QRect(460, 330, 311, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtLocal.setFont(font) self.txtLocal.setObjectName("txtLocal") self.txtEloctrode = QtWidgets.QLabel(Form) self.txtEloctrode.setGeometry(QtCore.QRect(460, 360, 101, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(False) font.setItalic(False) font.setWeight(50) self.txtEloctrode.setFont(font) self.txtEloctrode.setObjectName("txtEloctrode") self.listWidget_2 = QtWidgets.QListWidget(Form) self.listWidget_2.setGeometry(QtCore.QRect(460, 410, 321, 51)) self.listWidget_2.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidget_2.setLineWidth(3) self.listWidget_2.setMidLineWidth(3) self.listWidget_2.setObjectName("listWidget_2") item = QtWidgets.QListWidgetItem() self.listWidget_2.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidget_2.addItem(item) self.BtnGlobal = QtWidgets.QPushButton(Form) self.BtnGlobal.setGeometry(QtCore.QRect(520, 170, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnGlobal.sizePolicy().hasHeightForWidth()) self.BtnGlobal.setSizePolicy(sizePolicy) self.BtnGlobal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnGlobal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnGlobal.setFont(font) self.BtnGlobal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnGlobal.setAutoDefault(True) self.BtnGlobal.setDefault(True) self.BtnGlobal.setObjectName("BtnGlobal") self.BrainPic_3 = QtWidgets.QLabel(Form) self.BrainPic_3.setGeometry(QtCore.QRect(800, 10, 81, 81)) self.BrainPic_3.setText("") self.BrainPic_3.setPixmap(QtGui.QPixmap("logo2.png")) self.BrainPic_3.setObjectName("BrainPic_3") self.TxtDes = QtWidgets.QLabel(Form) self.TxtDes.setGeometry(QtCore.QRect(630, 120, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes.setFont(font) self.TxtDes.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtDes.setObjectName("TxtDes") self.TxtAvg = QtWidgets.QLabel(Form) self.TxtAvg.setGeometry(QtCore.QRect(630, 100, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg.setFont(font) self.TxtAvg.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtAvg.setObjectName("TxtAvg") self.BtnLocal = QtWidgets.QPushButton(Form) self.BtnLocal.setGeometry(QtCore.QRect(520, 470, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnLocal.sizePolicy().hasHeightForWidth()) self.BtnLocal.setSizePolicy(sizePolicy) self.BtnLocal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnLocal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnLocal.setFont(font) self.BtnLocal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnLocal.setAutoDefault(True) self.BtnLocal.setDefault(True) self.BtnLocal.setObjectName("BtnLocal") self.cBoxElectrode = QtWidgets.QComboBox(Form) self.cBoxElectrode.setGeometry(QtCore.QRect(570, 360, 69, 22)) self.cBoxElectrode.setObjectName("cBoxElectrode") self.txtGlobHeaSub = QtWidgets.QLabel(Form) self.txtGlobHeaSub.setGeometry(QtCore.QRect(620, 80, 141, 21)) font = QtGui.QFont() font.setPointSize(7) font.setBold(True) font.setWeight(75) self.txtGlobHeaSub.setFont(font) self.txtGlobHeaSub.setObjectName("txtGlobHeaSub") self.TxtDes1 = QtWidgets.QLabel(Form) self.TxtDes1.setGeometry(QtCore.QRect(690, 120, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes1.setFont(font) self.TxtDes1.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtDes1.setObjectName("TxtDes1") self.TxtAvg1 = QtWidgets.QLabel(Form) self.TxtAvg1.setGeometry(QtCore.QRect(690, 100, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg1.setFont(font) self.TxtAvg1.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtAvg1.setObjectName("TxtAvg1") self.TxtAvg2 = QtWidgets.QLabel(Form) self.TxtAvg2.setGeometry(QtCore.QRect(740, 100, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg2.setFont(font) self.TxtAvg2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtAvg2.setObjectName("TxtAvg2") self.TxtDes3 = QtWidgets.QLabel(Form) self.TxtDes3.setGeometry(QtCore.QRect(740, 120, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes3.setFont(font) self.TxtDes3.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDes3.setObjectName("TxtDes3") self.listWidget_5 = QtWidgets.QListWidget(Form) self.listWidget_5.setGeometry(QtCore.QRect(460, 240, 321, 51)) self.listWidget_5.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidget_5.setLineWidth(3) self.listWidget_5.setMidLineWidth(3) self.listWidget_5.setObjectName("listWidget_5") item = QtWidgets.QListWidgetItem() self.listWidget_5.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidget_5.addItem(item) self.txtGlobHeaSub_2 = QtWidgets.QLabel(Form) self.txtGlobHeaSub_2.setGeometry(QtCore.QRect(590, 220, 131, 21)) font = QtGui.QFont() font.setPointSize(7) font.setBold(True) font.setWeight(75) self.txtGlobHeaSub_2.setFont(font) self.txtGlobHeaSub_2.setObjectName("txtGlobHeaSub_2") self.TxtHelMaxD = QtWidgets.QLabel(Form) self.TxtHelMaxD.setGeometry(QtCore.QRect(600, 260, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtHelMaxD.setFont(font) self.TxtHelMaxD.setStyleSheet("") self.TxtHelMaxD.setObjectName("TxtHelMaxD") self.TxtSubMinD = QtWidgets.QLabel(Form) self.TxtSubMinD.setGeometry(QtCore.QRect(670, 240, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtSubMinD.setFont(font) self.TxtSubMinD.setStyleSheet("") self.TxtSubMinD.setObjectName("TxtSubMinD") self.TxtSubMaxD = QtWidgets.QLabel(Form) self.TxtSubMaxD.setGeometry(QtCore.QRect(670, 260, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtSubMaxD.setFont(font) self.TxtSubMaxD.setStyleSheet("") self.TxtSubMaxD.setObjectName("TxtSubMaxD") self.txtGlobHeaSub_3 = QtWidgets.QLabel(Form) self.txtGlobHeaSub_3.setGeometry(QtCore.QRect(570, 390, 181, 21)) font = QtGui.QFont() font.setPointSize(7) font.setBold(True) font.setWeight(75) self.txtGlobHeaSub_3.setFont(font) self.txtGlobHeaSub_3.setObjectName("txtGlobHeaSub_3") self.TxtDes_2 = QtWidgets.QLabel(Form) self.TxtDes_2.setGeometry(QtCore.QRect(580, 430, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes_2.setFont(font) self.TxtDes_2.setStyleSheet("") self.TxtDes_2.setObjectName("TxtDes_2") self.TxtDes3_2 = QtWidgets.QLabel(Form) self.TxtDes3_2.setGeometry(QtCore.QRect(730, 430, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes3_2.setFont(font) self.TxtDes3_2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDes3_2.setObjectName("TxtDes3_2") self.TxtAvg2_2 = QtWidgets.QLabel(Form) self.TxtAvg2_2.setGeometry(QtCore.QRect(730, 410, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg2_2.setFont(font) self.TxtAvg2_2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtAvg2_2.setObjectName("TxtAvg2_2") self.TxtAvg_2 = QtWidgets.QLabel(Form) self.TxtAvg_2.setGeometry(QtCore.QRect(580, 410, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg_2.setFont(font) self.TxtAvg_2.setStyleSheet("") self.TxtAvg_2.setObjectName("TxtAvg_2") self.TxtAvg1_2 = QtWidgets.QLabel(Form) self.TxtAvg1_2.setGeometry(QtCore.QRect(650, 410, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg1_2.setFont(font) self.TxtAvg1_2.setStyleSheet("") self.TxtAvg1_2.setObjectName("TxtAvg1_2") self.TxtDes1_2 = QtWidgets.QLabel(Form) self.TxtDes1_2.setGeometry(QtCore.QRect(650, 430, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes1_2.setFont(font) self.TxtDes1_2.setStyleSheet("") self.TxtDes1_2.setObjectName("TxtDes1_2") self.widget = QtWidgets.QWidget(Form) self.widget.setGeometry(QtCore.QRect(0, 0, 411, 571)) self.widget.setStyleSheet("background-color: rgb(227, 227, 227);") self.widget.setObjectName("widget") self.txtCompare_3 = QtWidgets.QLabel(self.widget) self.txtCompare_3.setGeometry(QtCore.QRect(50, 120, 191, 16)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.txtCompare_3.setFont(font) self.txtCompare_3.setObjectName("txtCompare_3") self.txtCompare1 = QtWidgets.QLabel(self.widget) self.txtCompare1.setGeometry(QtCore.QRect(100, 160, 51, 16)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.txtCompare1.setFont(font) self.txtCompare1.setObjectName("txtCompare1") self.txtResearch = QtWidgets.QLabel(self.widget) self.txtResearch.setGeometry(QtCore.QRect(60, 40, 121, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtResearch.setFont(font) self.txtResearch.setStyleSheet("color: rgb(0, 0, 0);\n" "") self.txtResearch.setObjectName("txtResearch") self.cBoxCond = QtWidgets.QComboBox(self.widget) self.cBoxCond.setGeometry(QtCore.QRect(60, 60, 191, 22)) self.cBoxCond.setStyleSheet("background-color: rgb(255, 255, 255);") self.cBoxCond.setObjectName("cBoxCond") self.txtCompare2 = QtWidgets.QLabel(self.widget) self.txtCompare2.setGeometry(QtCore.QRect(270, 160, 51, 16)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.txtCompare2.setFont(font) self.txtCompare2.setObjectName("txtCompare2") self.buttonBox = QtWidgets.QDialogButtonBox(self.widget) self.buttonBox.setGeometry(QtCore.QRect(40, 510, 51, 31)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.buttonBox.setFont(font) self.buttonBox.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close) self.buttonBox.setObjectName("buttonBox") self.cBoxGrp1 = QtWidgets.QComboBox(self.widget) self.cBoxGrp1.setGeometry(QtCore.QRect(50, 180, 141, 22)) self.cBoxGrp1.setStyleSheet("background-color: rgb(255, 255, 255);") self.cBoxGrp1.setObjectName("cBoxGrp1") self.cBoxGrp2 = QtWidgets.QComboBox(self.widget) self.cBoxGrp2.setGeometry(QtCore.QRect(220, 180, 141, 22)) self.cBoxGrp2.setStyleSheet("background-color: rgb(255, 255, 255);") self.cBoxGrp2.setObjectName("cBoxGrp2") self.TxtHelMinD = QtWidgets.QLabel(Form) self.TxtHelMinD.setGeometry(QtCore.QRect(600, 240, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtHelMinD.setFont(font) self.TxtHelMinD.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtHelMinD.setObjectName("TxtHelMinD") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) # -------------------- Added Code ------------------------- # self.cBoxCond.addItem("") patient = Patient("id", "full_name", "group", 'research', "file_path") comoboBox_data = list( dict.fromkeys(patient.get_data_from_JSON('research_name')) ) # Remove duplicates from list - dictionary cannot have duplicates. self.cBoxCond.addItems(comoboBox_data) self.cBoxGrp1.addItem("") self.cBoxGrp1.setEnabled(False) self.cBoxGrp2.addItem("") self.cBoxGrp2.setEnabled(False) self.cBoxElectrode.addItem("") self.cBoxElectrode.setEnabled(False) self.cBoxElectrode.addItems(str(x) for x in range(1, 24)) # ---------------- Call to Functions ------------- # self.cBoxCond.currentTextChanged.connect(self.research_changed) self.cBoxGrp1.currentTextChanged.connect(self.group1_changed) self.cBoxGrp2.currentTextChanged.connect(self.group2_changed) self.cBoxElectrode.currentTextChanged.connect(self.electrode_changed) self.BtnGlobal.clicked.connect(self.global_explained) self.BtnLocal.clicked.connect(self.local_explained) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Group Comparison")) self.txtGlobalComp.setText( _translate("Form", "Comparation of Global Parameters Of The Graph:")) __sortingEnabled = self.listWidget.isSortingEnabled() self.listWidget.setSortingEnabled(False) item = self.listWidget.item(0) item.setText(_translate("Form", "Avarage Shortest Path Length:")) item = self.listWidget.item(1) item.setText(_translate("Form", "Density:")) self.listWidget.setSortingEnabled(__sortingEnabled) self.txtLocal.setText( _translate("Form", "Comparation of Local Parameters Of The Graph:")) self.txtEloctrode.setText(_translate("Form", "Choose Electrode:")) __sortingEnabled = self.listWidget_2.isSortingEnabled() self.listWidget_2.setSortingEnabled(False) item = self.listWidget_2.item(0) item.setText(_translate("Form", "Degree:")) item = self.listWidget_2.item(1) item.setText(_translate("Form", "Local Efficiency:")) self.listWidget_2.setSortingEnabled(__sortingEnabled) self.BtnGlobal.setText( _translate("Form", "Global Parameters Explaining")) self.TxtDes.setText(_translate("Form", "Txt")) self.TxtAvg.setText(_translate("Form", "Txt")) self.BtnLocal.setText(_translate("Form", "Local Parameters Explaining")) self.txtGlobHeaSub.setText( _translate("Form", "Group1 Group2 Diff")) self.TxtDes1.setText(_translate("Form", "Txt")) self.TxtAvg1.setText(_translate("Form", "Txt")) self.TxtAvg2.setText(_translate("Form", "Txt")) self.TxtDes3.setText(_translate("Form", "Txt")) __sortingEnabled = self.listWidget_5.isSortingEnabled() self.listWidget_5.setSortingEnabled(False) item = self.listWidget_5.item(0) item.setText(_translate("Form", "Min Degree:")) item = self.listWidget_5.item(1) item.setText(_translate("Form", "Max Degree:")) self.listWidget_5.setSortingEnabled(__sortingEnabled) self.txtGlobHeaSub_2.setText( _translate("Form", "Group1 Group2")) self.TxtHelMaxD.setText(_translate("Form", "Txt")) self.TxtSubMinD.setText(_translate("Form", "Txt")) self.TxtSubMaxD.setText(_translate("Form", "Txt")) self.txtGlobHeaSub_3.setText( _translate("Form", "Group1 Group2 Diff")) self.TxtDes_2.setText(_translate("Form", "Txt")) self.TxtDes3_2.setText(_translate("Form", "Txt")) self.TxtAvg2_2.setText(_translate("Form", "Txt")) self.TxtAvg_2.setText(_translate("Form", "Txt")) self.TxtAvg1_2.setText(_translate("Form", "Txt")) self.TxtDes1_2.setText(_translate("Form", "Txt")) self.txtCompare_3.setText( _translate("Form", "Select Groups to compare:")) self.txtCompare1.setText(_translate("Form", "Group 1")) self.txtResearch.setText(_translate("Form", "Choose Research:")) self.txtCompare2.setText(_translate("Form", "Group 2")) self.TxtHelMinD.setText(_translate("Form", "Txt")) # -------------------------------- Functions --------------------------------------- # def research_changed(self, value): if (value == ""): self.cBoxGrp1.clear() self.cBoxGrp2.clear() self.cBoxElectrode.setCurrentIndex(0) self.cBoxGrp1.setEnabled(False) self.cBoxGrp2.setEnabled(False) self.cBoxElectrode.setEnabled(False) else: self.cBoxGrp1.clear() self.cBoxGrp2.clear() self.cBoxGrp1.setEnabled(True) self.cBoxGrp2.setEnabled(True) patient = Patient("", "", "", "", "") comoboBox_data = list( dict.fromkeys( patient.get_treshold_Dsection_from_JSON( self.cBoxCond.currentText(), 'groups')) ) # Remove duplicates from list - dictionary cannot have duplicates. self.cBoxGrp1.addItems(comoboBox_data) self.cBoxGrp2.addItems(comoboBox_data) def group1_changed(self, value): research = Research("", "", "", "", "", "", "") if (value == ""): print("") else: density, shortest_path, min_degree, max_degree, degrees, local_efficiency = research.get_group_data( self.cBoxCond.currentText(), self.cBoxGrp1.currentText()) self.TxtAvg.setText(str(round( shortest_path, 3))) # Group 1 - Average Shortest Path self.TxtDes.setText(str(round(density, 3))) # Group 1 - Density self.TxtHelMinD.setText(str(round(min_degree, 3))) # Group 1 - Min Degree self.TxtHelMaxD.setText(str(round(max_degree, 3))) # Group 1 - Max Degree self.check_patients() def group2_changed(self, value): research = Research("", "", "", "", "", "", "") if (value == ""): print("") else: density, shortest_path, min_degree, max_degree, degrees, local_efficiency = research.get_group_data( self.cBoxCond.currentText(), self.cBoxGrp2.currentText()) self.TxtAvg1.setText(str(round( shortest_path, 3))) # Group 2 - Average Shortest Path self.TxtDes1.setText(str(round(density, 3))) # Group 2 - Density self.TxtSubMinD.setText(str(round(min_degree, 3))) # Group 2 - Min Degree self.TxtSubMaxD.setText(str(round(max_degree, 3))) # Group 2 - Max Degree self.check_patients() def check_patients(self): if ((self.cBoxGrp1.currentText() != '') and (self.cBoxGrp2.currentText() != '')): self.TxtAvg2.setText( str( round( abs( float(self.TxtAvg.text()) - float(self.TxtAvg1.text())), 3))) self.TxtDes3.setText( str( round( abs( float(self.TxtDes.text()) - float(self.TxtDes1.text())), 3))) self.cBoxElectrode.setEnabled(True) # else: # self.TxtDesGloDif.clear() # self.TxtAvgGlobDif.clear() # self.TxtModGloDif.clear() def electrode_changed(self, value): if (value == ""): print("") else: research = Research("", "", "", "", "", "", "") density1, shortest_path1, min_degree1, max_degree1, degrees1, local_efficiency1 = research.get_group_data( self.cBoxCond.currentText(), self.cBoxGrp1.currentText()) density2, shortest_path2, min_degree2, max_degree2, degrees2, local_efficiency2 = research.get_group_data( self.cBoxCond.currentText(), self.cBoxGrp2.currentText()) # ---- For the COMOBO BOX -------- # self.TxtAvg_2.setText( str( round(degrees1[int(self.cBoxElectrode.currentText()) - 1], 3))) # Group 1 - Electrode Degree self.TxtDes_2.setText( str( round( local_efficiency1[int(self.cBoxElectrode.currentText()) - 1], 3))) # Group 1 - Electrode Local Efficiency self.TxtAvg1_2.setText( str( round(degrees2[int(self.cBoxElectrode.currentText()) - 1], 3))) # Group 2 - Electrode Degree self.TxtDes1_2.setText( str( round( local_efficiency2[int(self.cBoxElectrode.currentText()) - 1], 3))) # Group 2 - Electrode Local Efficiency self.TxtAvg2_2.setText( str( round( abs( float(self.TxtAvg_2.text()) - float(self.TxtAvg1_2.text())), 3))) self.TxtDes3_2.setText( str( round( abs( float(self.TxtDes_2.text()) - float(self.TxtDes1_2.text())), 3))) def global_explained(self): from GlobalExplaning import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show() # MainWindow.hide() def local_explained(self): from LocalExplaining import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show()
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(986, 611) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("brainPic.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) Form.setWindowIcon(icon) self.txtPatient = QtWidgets.QLabel(Form) self.txtPatient.setGeometry(QtCore.QRect(110, 30, 61, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtPatient.setFont(font) self.txtPatient.setObjectName("txtPatient") self.line = QtWidgets.QFrame(Form) self.line.setGeometry(QtCore.QRect(110, 50, 211, 16)) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.BrainPic = QtWidgets.QLabel(Form) self.BrainPic.setGeometry(QtCore.QRect(50, 20, 41, 41)) self.BrainPic.setText("") self.BrainPic.setPixmap(QtGui.QPixmap("user3.png")) self.BrainPic.setObjectName("BrainPic") self.txtGlobal = QtWidgets.QLabel(Form) self.txtGlobal.setGeometry(QtCore.QRect(40, 450, 301, 20)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtGlobal.setFont(font) self.txtGlobal.setObjectName("txtGlobal") self.listWidgetGlob = QtWidgets.QListWidget(Form) self.listWidgetGlob.setGeometry(QtCore.QRect(50, 490, 351, 51)) self.listWidgetGlob.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidgetGlob.setLineWidth(3) self.listWidgetGlob.setMidLineWidth(3) self.listWidgetGlob.setObjectName("listWidgetGlob") item = QtWidgets.QListWidgetItem() self.listWidgetGlob.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidgetGlob.addItem(item) self.txtLocal = QtWidgets.QLabel(Form) self.txtLocal.setGeometry(QtCore.QRect(490, 450, 311, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtLocal.setFont(font) self.txtLocal.setObjectName("txtLocal") self.txtEloctrode = QtWidgets.QLabel(Form) self.txtEloctrode.setGeometry(QtCore.QRect(490, 470, 101, 16)) font = QtGui.QFont() font.setPointSize(8) font.setBold(False) font.setItalic(False) font.setWeight(50) self.txtEloctrode.setFont(font) self.txtEloctrode.setObjectName("txtEloctrode") self.listWidgetLoc = QtWidgets.QListWidget(Form) self.listWidgetLoc.setGeometry(QtCore.QRect(570, 500, 311, 41)) self.listWidgetLoc.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidgetLoc.setLineWidth(3) self.listWidgetLoc.setMidLineWidth(3) self.listWidgetLoc.setObjectName("listWidgetLoc") item = QtWidgets.QListWidgetItem() self.listWidgetLoc.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidgetLoc.addItem(item) self.btnClose = QtWidgets.QDialogButtonBox(Form) self.btnClose.setGeometry(QtCore.QRect(920, 540, 41, 23)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.btnClose.setFont(font) self.btnClose.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.btnClose.setStandardButtons(QtWidgets.QDialogButtonBox.Close) self.btnClose.setObjectName("btnClose") self.BtnGlobal = QtWidgets.QPushButton(Form) self.BtnGlobal.setGeometry(QtCore.QRect(130, 560, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnGlobal.sizePolicy().hasHeightForWidth()) self.BtnGlobal.setSizePolicy(sizePolicy) self.BtnGlobal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnGlobal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnGlobal.setFont(font) self.BtnGlobal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnGlobal.setAutoDefault(True) self.BtnGlobal.setDefault(True) self.BtnGlobal.setObjectName("BtnGlobal") self.txtBrain2 = QtWidgets.QLabel(Form) self.txtBrain2.setGeometry(QtCore.QRect(660, 60, 171, 31)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.txtBrain2.setFont(font) self.txtBrain2.setObjectName("txtBrain2") self.BrainPic_3 = QtWidgets.QLabel(Form) self.BrainPic_3.setGeometry(QtCore.QRect(910, 10, 61, 61)) self.BrainPic_3.setText("") self.BrainPic_3.setPixmap(QtGui.QPixmap("logo3.png")) self.BrainPic_3.setObjectName("BrainPic_3") self.TxtDesGlob1 = QtWidgets.QLabel(Form) self.TxtDesGlob1.setGeometry(QtCore.QRect(220, 510, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDesGlob1.setFont(font) self.TxtDesGlob1.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDesGlob1.setObjectName("TxtDesGlob1") self.TxtAvgGlob1 = QtWidgets.QLabel(Form) self.TxtAvgGlob1.setGeometry(QtCore.QRect(220, 490, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvgGlob1.setFont(font) self.TxtAvgGlob1.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtAvgGlob1.setObjectName("TxtAvgGlob1") self.txtPatient_2 = QtWidgets.QLabel(Form) self.txtPatient_2.setGeometry(QtCore.QRect(630, 30, 61, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtPatient_2.setFont(font) self.txtPatient_2.setObjectName("txtPatient_2") self.BrainPic_2 = QtWidgets.QLabel(Form) self.BrainPic_2.setGeometry(QtCore.QRect(570, 20, 41, 41)) self.BrainPic_2.setText("") self.BrainPic_2.setPixmap(QtGui.QPixmap("user3.png")) self.BrainPic_2.setObjectName("BrainPic_2") self.line_2 = QtWidgets.QFrame(Form) self.line_2.setGeometry(QtCore.QRect(630, 50, 201, 16)) self.line_2.setFrameShape(QtWidgets.QFrame.HLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.txtBrain1 = QtWidgets.QLabel(Form) self.txtBrain1.setGeometry(QtCore.QRect(150, 60, 171, 31)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.txtBrain1.setFont(font) self.txtBrain1.setObjectName("txtBrain1") self.TxtDesGlo2 = QtWidgets.QLabel(Form) self.TxtDesGlo2.setGeometry(QtCore.QRect(290, 510, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDesGlo2.setFont(font) self.TxtDesGlo2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDesGlo2.setObjectName("TxtDesGlo2") self.TxtAvgGlob2 = QtWidgets.QLabel(Form) self.TxtAvgGlob2.setGeometry(QtCore.QRect(290, 490, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvgGlob2.setFont(font) self.TxtAvgGlob2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtAvgGlob2.setObjectName("TxtAvgGlob2") self.TxtAvgGlobDif = QtWidgets.QLabel(Form) self.TxtAvgGlobDif.setGeometry(QtCore.QRect(360, 490, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvgGlobDif.setFont(font) self.TxtAvgGlobDif.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtAvgGlobDif.setObjectName("TxtAvgGlobDif") self.TxtDesGloDif = QtWidgets.QLabel(Form) self.TxtDesGloDif.setGeometry(QtCore.QRect(360, 510, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDesGloDif.setFont(font) self.TxtDesGloDif.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtDesGloDif.setObjectName("TxtDesGloDif") self.txtGlobPat1Pat2 = QtWidgets.QLabel(Form) self.txtGlobPat1Pat2.setGeometry(QtCore.QRect(210, 470, 181, 21)) font = QtGui.QFont() font.setPointSize(7) font.setBold(True) font.setWeight(75) self.txtGlobPat1Pat2.setFont(font) self.txtGlobPat1Pat2.setObjectName("txtGlobPat1Pat2") self.BtnLocal = QtWidgets.QPushButton(Form) self.BtnLocal.setGeometry(QtCore.QRect(610, 560, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnLocal.sizePolicy().hasHeightForWidth()) self.BtnLocal.setSizePolicy(sizePolicy) self.BtnLocal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnLocal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnLocal.setFont(font) self.BtnLocal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnLocal.setAutoDefault(True) self.BtnLocal.setDefault(True) self.BtnLocal.setObjectName("BtnLocal") self.txtLocPat1Pat2 = QtWidgets.QLabel(Form) self.txtLocPat1Pat2.setGeometry(QtCore.QRect(670, 480, 201, 21)) font = QtGui.QFont() font.setPointSize(7) font.setBold(True) font.setWeight(75) self.txtLocPat1Pat2.setFont(font) self.txtLocPat1Pat2.setObjectName("txtLocPat1Pat2") self.TxtEffLoc1 = QtWidgets.QLabel(Form) self.TxtEffLoc1.setGeometry(QtCore.QRect(680, 520, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtEffLoc1.setFont(font) self.TxtEffLoc1.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtEffLoc1.setObjectName("TxtEffLoc1") self.TxtDegLoc1_2 = QtWidgets.QLabel(Form) self.TxtDegLoc1_2.setGeometry(QtCore.QRect(760, 500, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDegLoc1_2.setFont(font) self.TxtDegLoc1_2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDegLoc1_2.setObjectName("TxtDegLoc1_2") self.TxtEffLocDif = QtWidgets.QLabel(Form) self.TxtEffLocDif.setGeometry(QtCore.QRect(840, 520, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtEffLocDif.setFont(font) self.TxtEffLocDif.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtEffLocDif.setObjectName("TxtEffLocDif") self.TxtEffLoc2 = QtWidgets.QLabel(Form) self.TxtEffLoc2.setGeometry(QtCore.QRect(760, 520, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtEffLoc2.setFont(font) self.TxtEffLoc2.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtEffLoc2.setObjectName("TxtEffLoc2") self.TxtDegLocDif = QtWidgets.QLabel(Form) self.TxtDegLocDif.setGeometry(QtCore.QRect(840, 500, 31, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDegLocDif.setFont(font) self.TxtDegLocDif.setStyleSheet("color:rgb(0, 0, 0)\n" "") self.TxtDegLocDif.setObjectName("TxtDegLocDif") self.TxtDegLoc1 = QtWidgets.QLabel(Form) self.TxtDegLoc1.setGeometry(QtCore.QRect(680, 500, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDegLoc1.setFont(font) self.TxtDegLoc1.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDegLoc1.setObjectName("TxtDegLoc1") self.cBoxElectrode1 = QtWidgets.QComboBox(Form) self.cBoxElectrode1.setGeometry(QtCore.QRect(580, 470, 69, 22)) self.cBoxElectrode1.setObjectName("cBoxElectrode1") self.cBoxPatient1 = QtWidgets.QComboBox(Form) self.cBoxPatient1.setGeometry(QtCore.QRect(180, 30, 141, 22)) self.cBoxPatient1.setObjectName("cBoxPatient1") self.cBoxPatient2 = QtWidgets.QComboBox(Form) self.cBoxPatient2.setGeometry(QtCore.QRect(690, 30, 141, 22)) self.cBoxPatient2.setObjectName("cBoxPatient2") self.BrainGraph = QtWidgets.QLabel(Form) self.BrainGraph.setGeometry(QtCore.QRect(520, 100, 391, 341)) self.BrainGraph.setText("") self.BrainGraph.setObjectName("BrainGraph") self.BrainGraph_2 = QtWidgets.QLabel(Form) self.BrainGraph_2.setGeometry(QtCore.QRect(30, 100, 391, 341)) self.BrainGraph_2.setText("") self.BrainGraph_2.setObjectName("BrainGraph_2") self.cBoxCond = QtWidgets.QComboBox(Form) self.cBoxCond.setGeometry(QtCore.QRect(380, 80, 141, 22)) self.cBoxCond.setObjectName("cBoxCond") self.txtCond = QtWidgets.QLabel(Form) self.txtCond.setGeometry(QtCore.QRect(390, 60, 121, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtCond.setFont(font) self.txtCond.setStyleSheet("color: rgb(199, 107, 152);\n" "\n" "") self.txtCond.setObjectName("txtCond") self.txtRes = QtWidgets.QLabel(Form) self.txtRes.setGeometry(QtCore.QRect(390, 10, 121, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtRes.setFont(font) self.txtRes.setStyleSheet("color: rgb(199, 107, 152);\n" "\n" "") self.txtRes.setObjectName("txtRes") self.cBoxRes = QtWidgets.QComboBox(Form) self.cBoxRes.setGeometry(QtCore.QRect(380, 30, 141, 22)) self.cBoxRes.setObjectName("cBoxRes") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) # ---------------------- Added Code ------------------------ # self.cBoxPatient1.setEnabled(False) self.cBoxPatient2.setEnabled(False) self.cBoxCond.addItem("") self.cBoxCond.addItems(['Alone', 'Spontaneous', 'Synchronized']) self.cBoxCond.setEnabled(False) self.cBoxRes.addItem("") patient = Patient("id", "full_name", "group", 'research', "file_path") comoboBox_data = list( dict.fromkeys(patient.get_data_from_JSON('research_name')) ) # Remove duplicates from list - dictionary cannot have duplicates. self.cBoxRes.addItems(comoboBox_data) self.cBoxElectrode1.addItem('') self.cBoxElectrode1.setEnabled(False) self.cBoxElectrode1.addItems(str(x) for x in range(1, 24)) # ---------------- Call to Functions ------------- # self.cBoxRes.currentTextChanged.connect(self.resName_changed) self.cBoxCond.currentTextChanged.connect(self.cond_changed) self.cBoxPatient1.currentTextChanged.connect(self.patient1_changed) self.cBoxPatient2.currentTextChanged.connect(self.patient2_changed) self.cBoxElectrode1.currentTextChanged.connect(self.electrode_changed) self.BtnGlobal.clicked.connect(self.global_explained) self.BtnLocal.clicked.connect(self.local_explained) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Patients Comparison")) self.txtPatient.setText(_translate("Form", "Patient1:")) self.txtGlobal.setText( _translate("Form", "Comparation of Global Parameters Of The Graph:")) __sortingEnabled = self.listWidgetGlob.isSortingEnabled() self.listWidgetGlob.setSortingEnabled(False) item = self.listWidgetGlob.item(0) item.setText(_translate("Form", "Avarage Shortest Path Length:")) item = self.listWidgetGlob.item(1) item.setText(_translate("Form", "Density:")) self.listWidgetGlob.setSortingEnabled(__sortingEnabled) self.txtLocal.setText( _translate("Form", "Comparation of Local Parameters Of The Graph:")) self.txtEloctrode.setText(_translate("Form", "Choose Electrode:")) __sortingEnabled = self.listWidgetLoc.isSortingEnabled() self.listWidgetLoc.setSortingEnabled(False) item = self.listWidgetLoc.item(0) item.setText(_translate("Form", "Degree:")) item = self.listWidgetLoc.item(1) item.setText(_translate("Form", "Local Efficiency:")) self.listWidgetLoc.setSortingEnabled(__sortingEnabled) self.BtnGlobal.setText( _translate("Form", "Global Parameters Explaining")) self.txtBrain2.setText(_translate("Form", "Brain Connectivity Graph")) self.TxtDesGlob1.setText(_translate("Form", "Txt")) self.TxtAvgGlob1.setText(_translate("Form", "Txt")) self.txtPatient_2.setText(_translate("Form", "Patient2:")) self.txtBrain1.setText(_translate("Form", "Brain Connectivity Graph")) self.TxtDesGlo2.setText(_translate("Form", "Txt")) self.TxtAvgGlob2.setText(_translate("Form", "Txt")) self.TxtAvgGlobDif.setText(_translate("Form", "Txt")) self.TxtDesGloDif.setText(_translate("Form", "Txt")) self.txtGlobPat1Pat2.setText( _translate("Form", "Patient1 Patient2 Diff")) self.BtnLocal.setText(_translate("Form", "Local Parameters Explaining")) self.txtLocPat1Pat2.setText( _translate("Form", "Patient1 Patient2 Diff")) self.TxtEffLoc1.setText(_translate("Form", "Txt")) self.TxtDegLoc1_2.setText(_translate("Form", "Txt")) self.TxtEffLocDif.setText(_translate("Form", "Txt")) self.TxtEffLoc2.setText(_translate("Form", "Txt")) self.TxtDegLocDif.setText(_translate("Form", "Txt")) self.TxtDegLoc1.setText(_translate("Form", "Txt")) self.txtCond.setText(_translate("Form", "Choose Condition:")) self.txtRes.setText(_translate("Form", "Choose Research:")) # -------------------------------------- Functions ----------------------------------------- # def resName_changed(self, value): if (value == ''): self.cBoxCond.clear() else: self.cBoxCond.setEnabled(True) patient = Patient("id", "full_name", "group", 'research', "file_path") # comoboBox_data = list(dict.fromkeys(patient.get_treshold_Dsection_from_JSON(self.cBoxRes.currentText(),'conditions'))) # Remove duplicates from list - dictionary cannot have duplicates. self.cBoxPatient1.clear() self.cBoxPatient2.clear() self.BrainGraph.clear() self.BrainGraph_2.clear() # self.cBoxCond.addItems(comoboBox_data) def cond_changed(self): self.cBoxPatient1.clear() self.cBoxPatient2.clear() self.cBoxPatient1.setEnabled(True) self.cBoxPatient2.setEnabled(True) patient = Patient("id", "full_name", "group", 'research', "file_path") comoboBox_patients = list( dict.fromkeys( patient.get_specific_patients_JSON( self.cBoxRes.currentText()))) self.cBoxPatient1.addItem("") self.cBoxPatient1.addItems(comoboBox_patients) self.cBoxPatient2.addItem("") self.cBoxPatient2.addItems(comoboBox_patients) global cond cond = '' if (self.cBoxCond.currentText() == 'Alone'): cond = 'B' elif (self.cBoxCond.currentText() == 'Spontaneous'): cond = 'C' else: cond = 'D' def patient1_changed(self, value): print(value) condVal = self.cBoxCond.currentText() if (value == ''): self.TxtDesGlob1.clear() self.TxtAvgGlob1.clear() self.BrainGraph_2.clear() else: from undirectedGraph import Graph g = Graph() g.create_nodes(g.create_edges(value + '-' + cond)) # Global Parameters self.TxtDesGlob1.setText(str(round(g.density, 3))) self.TxtAvgGlob1.setText(str(round(g.shortest_paths, 3))) self.BrainGraph_2.setPixmap( QtGui.QPixmap(value + '-' + cond + ".png")) self.BrainGraph_2.setScaledContents(True) self.check_patients() def patient2_changed(self, value): print(value) conddVal = self.cBoxCond.currentText() if (value == ''): self.TxtDesGlo2.clear() self.TxtAvgGlob2.clear() self.BrainGraph.clear() else: from undirectedGraph import Graph g = Graph() g.create_nodes(g.create_edges(value + '-' + cond)) self.TxtDesGlo2.setText(str(round(g.density, 3))) self.TxtAvgGlob2.setText(str(round(g.shortest_paths, 3))) self.BrainGraph.setPixmap( QtGui.QPixmap(value + '-' + cond + ".png")) self.BrainGraph.setScaledContents(True) # self.TxtDeg.setText(str(g.degrees[int(self.cBoxElectrode.currentText()) - 1])) # self.TxtEff.setText(str(g.locals_efficiency[int(self.cBoxElectrode.currentText()) - 1])) self.check_patients() def check_patients(self): if ((self.cBoxPatient1.currentText() != '') and (self.cBoxPatient2.currentText() != '')): self.TxtDesGloDif.setText( str( round( abs( float(self.TxtDesGlob1.text()) - float(self.TxtDesGlo2.text())), 3))) self.TxtAvgGlobDif.setText( str( round( abs( float(self.TxtAvgGlob1.text()) - float(self.TxtAvgGlob2.text())), 3))) self.cBoxElectrode1.setEnabled(True) else: self.TxtDesGloDif.clear() self.TxtAvgGlobDif.clear() def electrode_changed(self): value = self.cBoxCond.currentText() if (self.cBoxElectrode1.currentText() == ''): self.TxtDegLoc1.clear() self.TxtDegLoc1_2.clear() self.TxtDegLocDif.clear() self.TxtEffLoc1.clear() self.TxtEffLoc2.clear() self.TxtEffLocDif.clear() else: if (value == 'Alone'): cond = 'B' elif (value == 'Spontaneous'): cond = 'C' else: cond = 'D' from undirectedGraph import Graph g1 = Graph() g1.create_nodes( g1.create_edges(self.cBoxPatient1.currentText() + '-' + cond)) self.TxtDegLoc1.setText( str( round( g1.degrees[int(self.cBoxElectrode1.currentText()) - 1], 3))) self.TxtEffLoc1.setText( str( round( g1.locals_efficiency[ int(self.cBoxElectrode1.currentText()) - 1], 3))) g2 = Graph() g2.create_nodes( g2.create_edges(self.cBoxPatient2.currentText() + '-' + cond)) self.TxtDegLoc1_2.setText( str( round( g2.degrees[int(self.cBoxElectrode1.currentText()) - 1], 3))) self.TxtEffLoc2.setText( str( round( g2.locals_efficiency[ int(self.cBoxElectrode1.currentText()) - 1], 3))) self.TxtDegLocDif.setText( str( round( abs( float(self.TxtDegLoc1.text()) - float(self.TxtDegLoc1_2.text())), 3))) self.TxtEffLocDif.setText( str( round( abs( float(self.TxtEffLoc1.text()) - float(self.TxtEffLoc2.text())), 3))) def global_explained(self): from GlobalExplaning import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show() # MainWindow.hide() def local_explained(self): from LocalExplaining import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show()
round( abs( float(self.TxtDes_2.text()) - float(self.TxtDes1_2.text())), 3))) def global_explained(self): from GlobalExplaning import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show() # MainWindow.hide() def local_explained(self): from LocalExplaining import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show() # MainWindow.hide() 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_())
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(836, 569) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("brainPic.png"), QtGui.QIcon.Normal, QtGui.QIcon.On) Form.setWindowIcon(icon) self.txtPatient = QtWidgets.QLabel(Form) self.txtPatient.setGeometry(QtCore.QRect(70, 30, 51, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtPatient.setFont(font) self.txtPatient.setObjectName("txtPatient") self.line = QtWidgets.QFrame(Form) self.line.setGeometry(QtCore.QRect(70, 50, 241, 16)) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.BrainPic = QtWidgets.QLabel(Form) self.BrainPic.setGeometry(QtCore.QRect(10, 20, 41, 41)) self.BrainPic.setText("") self.BrainPic.setPixmap(QtGui.QPixmap("user3.png")) self.BrainPic.setObjectName("BrainPic") self.txtGlobal = QtWidgets.QLabel(Form) self.txtGlobal.setGeometry(QtCore.QRect(60, 120, 211, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtGlobal.setFont(font) self.txtGlobal.setObjectName("txtGlobal") self.listWidget = QtWidgets.QListWidget(Form) self.listWidget.setGeometry(QtCore.QRect(40, 150, 281, 51)) self.listWidget.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidget.setLineWidth(3) self.listWidget.setMidLineWidth(3) self.listWidget.setObjectName("listWidget") item = QtWidgets.QListWidgetItem() self.listWidget.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidget.addItem(item) self.txtLocal = QtWidgets.QLabel(Form) self.txtLocal.setGeometry(QtCore.QRect(60, 300, 211, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setItalic(True) font.setWeight(75) self.txtLocal.setFont(font) self.txtLocal.setObjectName("txtLocal") self.txtEloctrode = QtWidgets.QLabel(Form) self.txtEloctrode.setGeometry(QtCore.QRect(70, 330, 101, 16)) font = QtGui.QFont() font.setPointSize(9) font.setBold(False) font.setItalic(False) font.setWeight(50) self.txtEloctrode.setFont(font) self.txtEloctrode.setObjectName("txtEloctrode") self.listWidget_2 = QtWidgets.QListWidget(Form) self.listWidget_2.setGeometry(QtCore.QRect(40, 370, 281, 51)) self.listWidget_2.setFrameShape(QtWidgets.QFrame.WinPanel) self.listWidget_2.setLineWidth(3) self.listWidget_2.setMidLineWidth(3) self.listWidget_2.setObjectName("listWidget_2") item = QtWidgets.QListWidgetItem() self.listWidget_2.addItem(item) item = QtWidgets.QListWidgetItem() self.listWidget_2.addItem(item) self.buttonBox = QtWidgets.QDialogButtonBox(Form) self.buttonBox.setGeometry(QtCore.QRect(50, 500, 41, 23)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.buttonBox.setFont(font) self.buttonBox.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close) self.buttonBox.setObjectName("buttonBox") self.BtnGlobal = QtWidgets.QPushButton(Form) self.BtnGlobal.setGeometry(QtCore.QRect(80, 210, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnGlobal.sizePolicy().hasHeightForWidth()) self.BtnGlobal.setSizePolicy(sizePolicy) self.BtnGlobal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnGlobal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnGlobal.setFont(font) self.BtnGlobal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnGlobal.setAutoDefault(True) self.BtnGlobal.setDefault(True) self.BtnGlobal.setObjectName("BtnGlobal") self.txtBrain = QtWidgets.QLabel(Form) self.txtBrain.setGeometry(QtCore.QRect(480, 70, 211, 31)) font = QtGui.QFont() font.setPointSize(12) font.setBold(True) font.setWeight(75) self.txtBrain.setFont(font) self.txtBrain.setObjectName("txtBrain") self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(270, 170, 41, 20)) font = QtGui.QFont() font.setPointSize(7) self.label.setFont(font) self.label.setStyleSheet("\n" "color: rgb(0, 0, 0);") self.label.setObjectName("label") self.label_3 = QtWidgets.QLabel(Form) self.label_3.setGeometry(QtCore.QRect(260, 370, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.label_3.setFont(font) self.label_3.setStyleSheet("color: rgb(0, 0, 0);\n" "color: rgb(0, 0, 0);") self.label_3.setObjectName("label_3") self.label_4 = QtWidgets.QLabel(Form) self.label_4.setGeometry(QtCore.QRect(260, 380, 51, 31)) font = QtGui.QFont() font.setPointSize(7) self.label_4.setFont(font) self.label_4.setStyleSheet("color: rgb(0, 0, 0);\n" "color: rgb(0, 0, 0);") self.label_4.setObjectName("label_4") self.BrainPic_3 = QtWidgets.QLabel(Form) self.BrainPic_3.setGeometry(QtCore.QRect(740, 10, 81, 81)) self.BrainPic_3.setText("") self.BrainPic_3.setPixmap(QtGui.QPixmap("logo2.png")) self.BrainPic_3.setObjectName("BrainPic_3") self.TxtDes = QtWidgets.QLabel(Form) self.TxtDes.setGeometry(QtCore.QRect(210, 170, 51, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDes.setFont(font) self.TxtDes.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDes.setObjectName("TxtDes") self.TxtAvg = QtWidgets.QLabel(Form) self.TxtAvg.setGeometry(QtCore.QRect(210, 150, 61, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtAvg.setFont(font) self.TxtAvg.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtAvg.setObjectName("TxtAvg") self.TxtEff = QtWidgets.QLabel(Form) self.TxtEff.setGeometry(QtCore.QRect(150, 380, 71, 31)) font = QtGui.QFont() font.setPointSize(7) self.TxtEff.setFont(font) self.TxtEff.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtEff.setObjectName("TxtEff") self.TxtDeg = QtWidgets.QLabel(Form) self.TxtDeg.setGeometry(QtCore.QRect(150, 370, 71, 20)) font = QtGui.QFont() font.setPointSize(7) self.TxtDeg.setFont(font) self.TxtDeg.setStyleSheet("color:rgb(255, 0, 0)\n" "") self.TxtDeg.setObjectName("TxtDeg") self.BtnLocal = QtWidgets.QPushButton(Form) self.BtnLocal.setGeometry(QtCore.QRect(80, 430, 191, 31)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.BtnLocal.sizePolicy().hasHeightForWidth()) self.BtnLocal.setSizePolicy(sizePolicy) self.BtnLocal.setSizeIncrement(QtCore.QSize(0, 0)) self.BtnLocal.setBaseSize(QtCore.QSize(10, 0)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.BtnLocal.setFont(font) self.BtnLocal.setStyleSheet( "QPushButton {\n" " color: #333;\n" " border: 2px solid #555;\n" " border-radius: 50px;\n" " border-style: outset;\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.55, stop: 0 #fff, stop: 1 #888\n" " );\n" " padding: 5px;\n" " }\n" "\n" "QPushButton:hover {\n" " background: qradialgradient(\n" " cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4,\n" " radius: 1.50, stop: 0 #fff, stop: 1 #bbb\n" " );\n" " }\n" "\n" "QPushButton:pressed {\n" " border-style: inset;\n" " background: qradialgradient(\n" " cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1,\n" " radius: 1.35, stop: 0 #fff, stop: 1 #ddd\n" " );\n" " }") self.BtnLocal.setAutoDefault(True) self.BtnLocal.setDefault(True) self.BtnLocal.setObjectName("BtnLocal") self.cBoxElectrode = QtWidgets.QComboBox(Form) self.cBoxElectrode.setGeometry(QtCore.QRect(180, 330, 69, 22)) self.cBoxElectrode.setObjectName("cBoxElectrode") self.cBoxPname = QtWidgets.QComboBox(Form) self.cBoxPname.setGeometry(QtCore.QRect(140, 30, 151, 22)) self.cBoxPname.setObjectName("cBoxPname") self.BrainGraph = QtWidgets.QLabel(Form) self.BrainGraph.setGeometry(QtCore.QRect(380, 120, 411, 361)) self.BrainGraph.setText("") self.BrainGraph.setObjectName("BrainGraph") self.CboxCond = QtWidgets.QComboBox(Form) self.CboxCond.setGeometry(QtCore.QRect(140, 70, 151, 22)) self.CboxCond.setObjectName("CboxCond") self.txtPatient_2 = QtWidgets.QLabel(Form) self.txtPatient_2.setGeometry(QtCore.QRect(70, 70, 71, 20)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.txtPatient_2.setFont(font) self.txtPatient_2.setObjectName("txtPatient_2") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) # ---------------------------------Added Code -------------------------------------------- # self.cBoxPname.addItem('') patient = Patient('id', 'full_name', 'group', 'research', 'file_path') comoboBox_patients = list( dict.fromkeys(patient.get_data_from_JSON('full_name'))) self.cBoxPname.addItems(comoboBox_patients) self.cBoxElectrode.addItems(str(x) for x in range(1, 24)) self.CboxCond.addItem('') self.CboxCond.addItems(['Alone', 'Spontaneous', 'Synchronized']) # ------------------------------- Call to Functions -------------------------------------- # from functools import partial # self.BtnGlobal.clicked.connect(self.show_results) self.cBoxPname.currentTextChanged.connect(self.show_results) self.CboxCond.currentTextChanged.connect(self.condition_changed) self.cBoxElectrode.currentTextChanged.connect(self.show_res_electrode) self.BtnGlobal.clicked.connect(self.global_explained) self.BtnLocal.clicked.connect(self.local_explained) def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "Patient Result")) self.txtPatient.setText(_translate("Form", "Patient:")) self.txtGlobal.setText( _translate("Form", "Global Parameters Of The Graph:")) __sortingEnabled = self.listWidget.isSortingEnabled() self.listWidget.setSortingEnabled(False) item = self.listWidget.item(0) item.setText(_translate("Form", "Avarage Shortest Path Length:")) item = self.listWidget.item(1) item.setText(_translate("Form", "Density:")) self.listWidget.setSortingEnabled(__sortingEnabled) self.txtLocal.setText( _translate("Form", "Local Parameters Of The Graph:")) self.txtEloctrode.setText(_translate("Form", "Choose Electrode:")) __sortingEnabled = self.listWidget_2.isSortingEnabled() self.listWidget_2.setSortingEnabled(False) item = self.listWidget_2.item(0) item.setText(_translate("Form", "Degree:")) item = self.listWidget_2.item(1) item.setText(_translate("Form", "Local Efficiency:")) self.listWidget_2.setSortingEnabled(__sortingEnabled) self.BtnGlobal.setText( _translate("Form", "Global Parameters Explaining")) self.txtBrain.setText(_translate("Form", "Brain Connectivity Graph")) self.label.setText(_translate("Form", "of 1.000")) self.label_3.setText(_translate("Form", "of 22")) self.label_4.setText(_translate("Form", "of 1.000")) self.TxtDes.setText(_translate("Form", "Txt")) self.TxtAvg.setText(_translate("Form", "Txt")) self.TxtEff.setText(_translate("Form", "Txt")) self.TxtDeg.setText(_translate("Form", "Txt")) self.BtnLocal.setText(_translate("Form", "Local Parameters Explaining")) self.txtPatient_2.setText(_translate("Form", "Condition:")) # -------------------------------------- Functions ----------------------------------------- # def show_results(self, value): if (value == ''): self.CboxCond.clear() def condition_changed(self, value): global cond cond = '' if not (value == ''): if (value == 'Alone'): cond = 'B' elif (value == 'Spontaneous'): cond = 'C' else: cond = 'D' from undirectedGraph import Graph g = Graph() g.create_nodes( g.create_edges(self.cBoxPname.currentText() + '-' + cond)) self.TxtDes.setText(str(round(g.density, 3))) self.TxtAvg.setText(str(round(g.shortest_paths, 3))) self.BrainGraph.setPixmap( QtGui.QPixmap(self.cBoxPname.currentText() + '-' + cond + ".png")) self.BrainGraph.setScaledContents(True) self.TxtDeg.setText( str( round(g.degrees[int(self.cBoxElectrode.currentText()) - 1], 3))) self.TxtEff.setText( str( round( g.locals_efficiency[ int(self.cBoxElectrode.currentText()) - 1], 3))) else: self.TxtDes.clear() self.TxtAvg.clear() self.TxtMod.clear() self.BrainGraph.clear() self.TxtDeg.clear() self.TxtEff.clear() def show_res_electrode(self): from undirectedGraph import Graph print(self.cBoxPname.currentText()) g = Graph() g.create_nodes( g.create_edges(self.cBoxPname.currentText() + '-' + cond)) # ---- For the COMOBO BOX -------- # self.TxtDeg.setText( str(round(g.degrees[int(self.cBoxElectrode.currentText()) - 1], 3))) self.TxtEff.setText( str( round( g.locals_efficiency[int(self.cBoxElectrode.currentText()) - 1], 3))) def global_explained(self): from GlobalExplaning import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show() # MainWindow.hide() def local_explained(self): from LocalExplaining import Ui_Form self.window = QtWidgets.QMainWindow() self.ui = Ui_Form() self.ui.setupUi(self.window) self.window.show()