class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(824, 745) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.eegWaveLineChart = QChartView(self.centralwidget) self.eegWaveLineChart.setMinimumSize(QtCore.QSize(800, 600)) self.eegWaveLineChart.setObjectName("eegWaveLineChart") self.verticalLayout.addWidget(self.eegWaveLineChart) self.inputTextEdit = QtWidgets.QTextEdit(self.centralwidget) self.inputTextEdit.setObjectName("inputTextEdit") self.verticalLayout.addWidget(self.inputTextEdit) self.startBtn = QtWidgets.QPushButton(self.centralwidget) self.startBtn.setObjectName("startBtn") self.verticalLayout.addWidget(self.startBtn) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.startBtn.setText(_translate("MainWindow", "开始"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(500, 200) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setBaseSize(QtCore.QSize(500, 200)) MainWindow.setContextMenuPolicy(QtCore.Qt.NoContextMenu) MainWindow.setWindowTitle("ConnTester") MainWindow.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.chartWidget = QChartView(self.centralwidget) self.chartWidget.setObjectName("chartWidget") self.verticalLayout.addWidget(self.chartWidget) self.labelsLayout = QtWidgets.QHBoxLayout() self.labelsLayout.setObjectName("labelsLayout") self.lossLabel = QtWidgets.QLabel(self.centralwidget) self.lossLabel.setObjectName("lossLabel") self.lossLabel.setAlignment(QtCore.Qt.AlignCenter) self.labelsLayout.addWidget(self.lossLabel) self.currLabel = QtWidgets.QLabel(self.centralwidget) self.currLabel.setObjectName("currLabel") self.currLabel.setAlignment(QtCore.Qt.AlignCenter) self.labelsLayout.addWidget(self.currLabel) self.meanLabel = QtWidgets.QLabel(self.centralwidget) self.meanLabel.setObjectName("meanLabel") self.meanLabel.setAlignment(QtCore.Qt.AlignCenter) self.labelsLayout.addWidget(self.meanLabel) self.verticalLayout.addLayout(self.labelsLayout) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate self.lossLabel.setText(_translate("MainWindow", "TextLabel")) self.currLabel.setText(_translate("MainWindow", "TextLabel")) self.meanLabel.setText(_translate("MainWindow", "TextLabel"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1409, 1146) MainWindow.setStyleSheet("") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_3.setObjectName("verticalLayout_3") self.author_label_2 = QtWidgets.QLabel(self.centralwidget) self.author_label_2.setMaximumSize(QtCore.QSize(16777215, 50)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(20) self.author_label_2.setFont(font) self.author_label_2.setAlignment(QtCore.Qt.AlignCenter) self.author_label_2.setObjectName("author_label_2") self.verticalLayout_3.addWidget(self.author_label_2) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem) self.author_label = QtWidgets.QLabel(self.centralwidget) self.author_label.setMinimumSize(QtCore.QSize(200, 30)) self.author_label.setMaximumSize(QtCore.QSize(16777215, 30)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(-1) font.setBold(True) font.setWeight(75) self.author_label.setFont(font) self.author_label.setStyleSheet( "QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, \n" "QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog {\n" " background-color: #222222;\n" " color: #BBBBBB;\n" " font-family: \"Calibri\";\n" " font-size:13px;\n" " font-weight:bold;\n" "}") self.author_label.setAlignment(QtCore.Qt.AlignCenter) self.author_label.setObjectName("author_label") self.horizontalLayout_7.addWidget(self.author_label) self.verticalLayout_3.addLayout(self.horizontalLayout_7) self.splitter = QtWidgets.QSplitter(self.centralwidget) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.groupBox = QtWidgets.QGroupBox(self.splitter) self.groupBox.setMinimumSize(QtCore.QSize(350, 0)) self.groupBox.setMaximumSize(QtCore.QSize(1300, 16777215)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox.setFont(font) self.groupBox.setAlignment(QtCore.Qt.AlignCenter) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.input_media_tabWidget = QtWidgets.QTabWidget(self.groupBox) self.input_media_tabWidget.setObjectName("input_media_tabWidget") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.tab) self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.input_video_widget = QVideoWidget(self.tab) self.input_video_widget.setMinimumSize(QtCore.QSize(100, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.input_video_widget.setFont(font) self.input_video_widget.setObjectName("input_video_widget") self.horizontalLayout_8.addWidget(self.input_video_widget) self.input_media_tabWidget.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.tab_2) self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.input_real_time_label = QtWidgets.QLabel(self.tab_2) self.input_real_time_label.setObjectName("input_real_time_label") self.horizontalLayout_9.addWidget(self.input_real_time_label) self.input_media_tabWidget.addTab(self.tab_2, "") self.verticalLayout.addWidget(self.input_media_tabWidget) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(-1) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setStyleSheet("QLabel {\n" " background-color: #543044;\n" " color: #BBBBBB;\n" " font-family: \"Calibri\";\n" " font-size:13px;\n" " font-weight:bold;\n" "}") self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.predict_progressBar = QtWidgets.QProgressBar(self.groupBox) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.predict_progressBar.setFont(font) self.predict_progressBar.setStyleSheet("QProgressBar{\n" "border:2px solid grey;\n" "border-radius:5px;\n" "text-align: center;\n" "}\n" "\n" "\n" "QProgressBar::chunk {\n" "background-color:#CD96CD;\n" "width:10px;\n" "margin:0.5px;\n" "}") self.predict_progressBar.setMinimum(0) self.predict_progressBar.setProperty("value", 19) self.predict_progressBar.setObjectName("predict_progressBar") self.horizontalLayout_2.addWidget(self.predict_progressBar) self.fps_label = QtWidgets.QLabel(self.groupBox) self.fps_label.setMinimumSize(QtCore.QSize(0, 0)) self.fps_label.setMaximumSize(QtCore.QSize(16777215, 20)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.fps_label.setFont(font) self.fps_label.setObjectName("fps_label") self.horizontalLayout_2.addWidget(self.fps_label) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_13 = QtWidgets.QHBoxLayout() self.horizontalLayout_13.setObjectName("horizontalLayout_13") spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem1) self.weight_label = QtWidgets.QLabel(self.groupBox) self.weight_label.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setBold(True) font.setWeight(75) self.weight_label.setFont(font) self.weight_label.setLayoutDirection(QtCore.Qt.LeftToRight) self.weight_label.setStyleSheet("") self.weight_label.setAlignment(QtCore.Qt.AlignCenter) self.weight_label.setObjectName("weight_label") self.horizontalLayout_13.addWidget(self.weight_label) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem2) self.real_time_checkBox = QtWidgets.QCheckBox(self.groupBox) self.real_time_checkBox.setMinimumSize(QtCore.QSize(0, 25)) self.real_time_checkBox.setMaximumSize(QtCore.QSize(130, 16777215)) self.real_time_checkBox.setObjectName("real_time_checkBox") self.horizontalLayout_13.addWidget(self.real_time_checkBox) spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem3) self.verticalLayout.addLayout(self.horizontalLayout_13) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem4) self.import_media_pushButton = QtWidgets.QPushButton(self.groupBox) self.import_media_pushButton.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.import_media_pushButton.setFont(font) self.import_media_pushButton.setStyleSheet( "QPushButton{\n" " background-color:#2828FF;\n" " color:#ffffff;\n" " border-radius: 5px;\n" "}\n" "\n" "QPushButton:hover{\n" " color:#FFFFFF;\n" " background:#9393FF;\n" "}\n" "") self.import_media_pushButton.setObjectName("import_media_pushButton") self.horizontalLayout.addWidget(self.import_media_pushButton) spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem5) self.start_predict_pushButton = QtWidgets.QPushButton(self.groupBox) self.start_predict_pushButton.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.start_predict_pushButton.setFont(font) self.start_predict_pushButton.setStyleSheet( "QPushButton{\n" " background-color:#16A085;\n" " color:#ffffff;\n" " border-radius: 5px;\n" "}\n" "\n" "QPushButton:hover{\n" " color:#FFFFFF;\n" " background:#2EE1C1;\n" "}\n" "") self.start_predict_pushButton.setObjectName("start_predict_pushButton") self.horizontalLayout.addWidget(self.start_predict_pushButton) spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem6) self.verticalLayout.addLayout(self.horizontalLayout) self.groupBox_2 = QtWidgets.QGroupBox(self.splitter) self.groupBox_2.setMinimumSize(QtCore.QSize(500, 0)) self.groupBox_2.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox_2.setFont(font) self.groupBox_2.setAlignment(QtCore.Qt.AlignCenter) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2) self.verticalLayout_2.setObjectName("verticalLayout_2") self.output_media_tabWidget = QtWidgets.QTabWidget(self.groupBox_2) self.output_media_tabWidget.setObjectName("output_media_tabWidget") self.tab_3 = QtWidgets.QWidget() self.tab_3.setObjectName("tab_3") self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.tab_3) self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.output_video_widget = QVideoWidget(self.tab_3) self.output_video_widget.setMinimumSize(QtCore.QSize(100, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.output_video_widget.setFont(font) self.output_video_widget.setObjectName("output_video_widget") self.horizontalLayout_10.addWidget(self.output_video_widget) self.output_media_tabWidget.addTab(self.tab_3, "") self.tab_4 = QtWidgets.QWidget() self.tab_4.setObjectName("tab_4") self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.tab_4) self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.output_real_time_label = QtWidgets.QLabel(self.tab_4) self.output_real_time_label.setObjectName("output_real_time_label") self.horizontalLayout_11.addWidget(self.output_real_time_label) self.output_media_tabWidget.addTab(self.tab_4, "") self.verticalLayout_2.addWidget(self.output_media_tabWidget) self.horizontalLayout_12 = QtWidgets.QHBoxLayout() self.horizontalLayout_12.setObjectName("horizontalLayout_12") spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem7) self.open_predict_file_pushButton = QtWidgets.QPushButton( self.groupBox_2) self.open_predict_file_pushButton.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.open_predict_file_pushButton.setFont(font) self.open_predict_file_pushButton.setStyleSheet( "QPushButton{\n" " background-color:#d71345;\n" " color:#ffffff;\n" " border-radius: 5px;\n" "}\n" "\n" "QPushButton:hover{\n" " color:#FFFFFF;\n" " background:#c76968;\n" "}\n" "") self.open_predict_file_pushButton.setObjectName( "open_predict_file_pushButton") self.horizontalLayout_12.addWidget(self.open_predict_file_pushButton) spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem8) self.verticalLayout_2.addLayout(self.horizontalLayout_12) self.verticalLayout_3.addWidget(self.splitter) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem9) self.video_horizontalSlider = QtWidgets.QSlider(self.centralwidget) self.video_horizontalSlider.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.video_horizontalSlider.setFont(font) self.video_horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.video_horizontalSlider.setObjectName("video_horizontalSlider") self.horizontalLayout_4.addWidget(self.video_horizontalSlider) self.video_percent_label = QtWidgets.QLabel(self.centralwidget) self.video_percent_label.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.video_percent_label.setFont(font) self.video_percent_label.setObjectName("video_percent_label") self.horizontalLayout_4.addWidget(self.video_percent_label) spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem10) self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem11 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem11) self.play_pushButton = QtWidgets.QPushButton(self.centralwidget) self.play_pushButton.setMinimumSize(QtCore.QSize(0, 25)) self.play_pushButton.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.play_pushButton.setFont(font) icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap("C:/Users/PeterH/.designer/backup/icon/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.play_pushButton.setIcon(icon) self.play_pushButton.setObjectName("play_pushButton") self.horizontalLayout_3.addWidget(self.play_pushButton) self.pause_pushButton = QtWidgets.QPushButton(self.centralwidget) self.pause_pushButton.setMinimumSize(QtCore.QSize(0, 25)) self.pause_pushButton.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.pause_pushButton.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap( QtGui.QPixmap("C:/Users/PeterH/.designer/backup/icon/pause.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pause_pushButton.setIcon(icon1) self.pause_pushButton.setObjectName("pause_pushButton") self.horizontalLayout_3.addWidget(self.pause_pushButton) spacerItem12 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem12) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setMaximumSize(QtCore.QSize(16777215, 150)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox_3.setFont(font) self.groupBox_3.setObjectName("groupBox_3") self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.groupBox_3) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.predict_info_plainTextEdit = QtWidgets.QPlainTextEdit( self.groupBox_3) self.predict_info_plainTextEdit.setMaximumSize( QtCore.QSize(16777215, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.predict_info_plainTextEdit.setFont(font) self.predict_info_plainTextEdit.setStyleSheet( "\n" "QPlainTextEdit {\n" " background-color: cornsilk;\n" " selection-color: #0a214c; \n" " selection-background-color: #C19A6B;\n" "}\n" "") self.predict_info_plainTextEdit.setObjectName( "predict_info_plainTextEdit") self.horizontalLayout_6.addWidget(self.predict_info_plainTextEdit) self.horizontalLayout_5.addWidget(self.groupBox_3) self.verticalLayout_3.addLayout(self.horizontalLayout_5) self.gpu_info_chart = QChartView(self.centralwidget) self.gpu_info_chart.setMaximumSize(QtCore.QSize(16777215, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.gpu_info_chart.setFont(font) self.gpu_info_chart.setObjectName("gpu_info_chart") self.verticalLayout_3.addWidget(self.gpu_info_chart) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1409, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) self.input_media_tabWidget.setCurrentIndex(0) self.output_media_tabWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.author_label_2.setText( _translate("MainWindow", "Intelligent Monitoring System of Construction Site")) self.author_label.setText( _translate("MainWindow", "Product by: HinGwenWoong")) self.groupBox.setTitle(_translate("MainWindow", "Input Media")) self.input_media_tabWidget.setTabText( self.input_media_tabWidget.indexOf(self.tab), _translate("MainWindow", "结果")) self.input_real_time_label.setText( _translate("MainWindow", "HinGwenWoong")) self.input_media_tabWidget.setTabText( self.input_media_tabWidget.indexOf(self.tab_2), _translate("MainWindow", "实时推理")) self.label.setText(_translate("MainWindow", " Processing: ")) self.fps_label.setText(_translate("MainWindow", "(FPS)")) self.weight_label.setText(_translate("MainWindow", "weight path:")) self.real_time_checkBox.setText( _translate("MainWindow", "Real Time Predict")) self.import_media_pushButton.setStatusTip( _translate("MainWindow", "Import video to predict")) self.import_media_pushButton.setText(_translate( "MainWindow", "Import")) self.start_predict_pushButton.setStatusTip( _translate("MainWindow", "Predict the vedio")) self.start_predict_pushButton.setText( _translate("MainWindow", "Predict")) self.groupBox_2.setTitle(_translate("MainWindow", "Output Media")) self.output_media_tabWidget.setTabText( self.output_media_tabWidget.indexOf(self.tab_3), _translate("MainWindow", "结果")) self.output_real_time_label.setText( _translate("MainWindow", "HinGwenWoong")) self.output_media_tabWidget.setTabText( self.output_media_tabWidget.indexOf(self.tab_4), _translate("MainWindow", "实时推理")) self.open_predict_file_pushButton.setText( _translate("MainWindow", "Open in Browser")) self.video_percent_label.setText(_translate("MainWindow", "0 %")) self.play_pushButton.setText(_translate("MainWindow", "Play")) self.pause_pushButton.setText(_translate("MainWindow", "Pause")) self.groupBox_3.setTitle(_translate("MainWindow", "Predict Info:"))
class Ui_MainWindow(QtWidgets.QMainWindow): def setupUi(self): self.setObjectName("MainWindow") self.resize(850, 550) self.setWindowTitle("Rastrigin") self.centralwidget = QtWidgets.QWidget(self) self.centralwidget.setObjectName("centralwidget") self.frameChart = QChartView(self.centralwidget) self.frameChart.setGeometry(QtCore.QRect(10, 10, 620, 500)) self.frameChart.setFrameShape(QtWidgets.QFrame.Box) self.frameChart.setFrameShadow(QtWidgets.QFrame.Sunken) self.frameChart.setRenderHint(QPainter.Antialiasing) self.frameChart.setObjectName("frameChart") self.genParams = QtWidgets.QGroupBox(self.centralwidget) self.genParams.setGeometry(QtCore.QRect(650, 10, 161, 110)) self.genParams.setObjectName("genParams") self.genParams.setTitle("General parameters") self.label1 = QtWidgets.QLabel(self.genParams) self.label1.setGeometry(QtCore.QRect(10, 20, 61, 16)) self.label1.setObjectName("label1") self.label1.setText("Population:") self.label2 = QtWidgets.QLabel(self.genParams) self.label2.setGeometry(QtCore.QRect(10, 50, 91, 16)) self.label2.setObjectName("label2") self.label2.setText("No. generations:") self.label3 = QtWidgets.QLabel(self.genParams) self.label3.setGeometry(QtCore.QRect(10, 80, 81, 16)) self.label3.setObjectName("label3") self.label3.setText("No. dimensions:") self.tbxPopulation = QtWidgets.QLineEdit(self.genParams) self.tbxPopulation.setGeometry(QtCore.QRect(100, 20, 51, 20)) self.tbxPopulation.setObjectName("tbxPopulation") self.tbxGenerations = QtWidgets.QLineEdit(self.genParams) self.tbxGenerations.setGeometry(QtCore.QRect(100, 50, 51, 20)) self.tbxGenerations.setObjectName("tbxGenerations") self.tbxDimensions = QtWidgets.QLineEdit(self.genParams) self.tbxDimensions.setGeometry(QtCore.QRect(100, 80, 51, 20)) self.tbxDimensions.setObjectName("tbxDimensions") self.gaParams = QtWidgets.QGroupBox(self.centralwidget) self.gaParams.setGeometry(QtCore.QRect(650, 130, 191, 105)) self.gaParams.setObjectName("gaParams") self.gaParams.setTitle("GA parameters") self.label4 = QtWidgets.QLabel(self.gaParams) self.label4.setGeometry(QtCore.QRect(10, 20, 61, 16)) self.label4.setObjectName("label4") self.label4.setText("Mutation:") self.label5 = QtWidgets.QLabel(self.gaParams) self.label5.setGeometry(QtCore.QRect(10, 50, 91, 16)) self.label5.setObjectName("label5") self.label5.setText("Elite members:") self.label9 = QtWidgets.QLabel(self.gaParams) self.label9.setGeometry(QtCore.QRect(10, 80, 61, 16)) self.label9.setObjectName("label9") self.label9.setText("Max abs.:") self.tbxMutation = QtWidgets.QLineEdit(self.gaParams) self.tbxMutation.setGeometry(QtCore.QRect(100, 20, 51, 20)) self.tbxMutation.setObjectName("tbxMutation") self.tbxElite = QtWidgets.QLineEdit(self.gaParams) self.tbxElite.setGeometry(QtCore.QRect(100, 50, 51, 20)) self.tbxElite.setObjectName("tbxElite") self.tbxMaxAbs = QtWidgets.QLineEdit(self.gaParams) self.tbxMaxAbs.setGeometry(QtCore.QRect(100, 80, 51, 20)) self.tbxMaxAbs.setObjectName("tbxMAxAbs") self.psoParams = QtWidgets.QGroupBox(self.centralwidget) self.psoParams.setGeometry(QtCore.QRect(650, 240, 161, 110)) self.psoParams.setObjectName("psoParams") self.psoParams.setTitle("PSO parameters") self.label6 = QtWidgets.QLabel(self.psoParams) self.label6.setGeometry(QtCore.QRect(10, 20, 61, 16)) self.label6.setObjectName("label6") self.label6.setText("Inertia factor:") self.label7 = QtWidgets.QLabel(self.psoParams) self.label7.setGeometry(QtCore.QRect(10, 50, 91, 16)) self.label7.setObjectName("label7") self.label7.setText("Personal factor:") self.label8 = QtWidgets.QLabel(self.psoParams) self.label8.setGeometry(QtCore.QRect(10, 80, 81, 16)) self.label8.setObjectName("label8") self.label8.setText("Social factor:") self.tbxInertia = QtWidgets.QLineEdit(self.psoParams) self.tbxInertia.setGeometry(QtCore.QRect(100, 20, 51, 20)) self.tbxInertia.setObjectName("tbxInertia") self.tbxPersonal = QtWidgets.QLineEdit(self.psoParams) self.tbxPersonal.setGeometry(QtCore.QRect(100, 50, 51, 20)) self.tbxPersonal.setObjectName("tbxPersonal") self.tbxSocial = QtWidgets.QLineEdit(self.psoParams) self.tbxSocial.setGeometry(QtCore.QRect(100, 80, 51, 20)) self.tbxSocial.setObjectName("tbxSocial") self.cbxNoVis = QtWidgets.QCheckBox(self.centralwidget) self.cbxNoVis.setGeometry(QtCore.QRect(650, 350, 170, 17)) self.cbxNoVis.setObjectName("cbxNoVis") self.cbxNoVis.setText("No visualization per generation") self.btnStartGA = QtWidgets.QPushButton(self.centralwidget) self.btnStartGA.setGeometry(QtCore.QRect(650, 370, 75, 23)) self.btnStartGA.setObjectName("btnStartGA") self.btnStartGA.setText("Start GA") self.btnStartPSO = QtWidgets.QPushButton(self.centralwidget) self.btnStartPSO.setGeometry(QtCore.QRect(650, 400, 75, 23)) self.btnStartPSO.setObjectName("btnStartPSO") self.btnStartPSO.setText("Start PSO") self.btnStop = QtWidgets.QPushButton(self.centralwidget) self.btnStop.setEnabled(False) self.btnStop.setGeometry(QtCore.QRect(740, 370, 75, 53)) self.btnStop.setObjectName("btnStop") self.btnStop.setText("Stop") self.btnSaveChart = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChart.setGeometry(QtCore.QRect(650, 450, 121, 41)) self.btnSaveChart.setObjectName("btnSaveChart") self.btnSaveChart.setText("Save chart as image") self.btnSaveChartSeries = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChartSeries.setGeometry(QtCore.QRect(650, 500, 121, 41)) self.btnSaveChartSeries.setObjectName("btnSaveChartSeries") self.btnSaveChartSeries.setText("Save chart as series") self.setCentralWidget(self.centralwidget) QtCore.QMetaObject.connectSlotsByName(self) #Connect events self.btnStartGA.clicked.connect(self.btnStartGA_Click) self.btnStartPSO.clicked.connect(self.btnStartPSO_Click) self.btnStop.clicked.connect(self.btnStop_Click) self.btnSaveChart.clicked.connect(self.btnSaveChart_CLick) self.btnSaveChartSeries.clicked.connect(self.btnSaveChartSeries_Click) #Set default variables self.tbxGenerations.insert(str(NGEN)) self.tbxPopulation.insert(str(POP_SIZE)) self.tbxDimensions.insert(str(NO_DIMS)) self.tbxMutation.insert(str(GA_MUTPB)) self.tbxElite.insert(str(GA_NELT)) self.tbxMaxAbs.insert(str(GA_MAX_ABS)) self.tbxInertia.insert(str(PSO_INERTIA)) self.tbxPersonal.insert(str(PSO_PERSONAL)) self.tbxSocial.insert(str(PSO_SOCIAL)) def btnStartGA_Click(self): global combination_series # List of lists containing min_series of 5 results -- Added by Denis Lazor global parameter_name # Name of parameter used for writing its data to .csv file -- Added by Denis Lazor global best_fit_values # List containing best fitness values for every of 5 experiments per combination -- Added by Denis Lazor global DIM_SIZES global ELITE_SIZES global MAX_ABS_SIZES global MUTATION_SIZES # Checking if files are empty or not -- Added by Denis Lazor csv_contains_ga = os.stat("graphs_csv/original_ga.csv").st_size != 0 # Clearing non empty files if we are trying to write to them -- Added by Denis Lazor if csv_contains_ga: clear_all_csv("ga") parameter_name = "original" n = 5000 print("GA:\n") # Automation for all necessary combinations -- Added by Denis Lazor for d in DIM_SIZES: MUTATION_SIZES = [0.05, 0.1, 0.2] ELITE_SIZES = [4, 8, 16] MAX_ABS_SIZES = [0.4] for m in MUTATION_SIZES: for e in ELITE_SIZES: for ma in MAX_ABS_SIZES: for i in range(5): # Set global variables global stop_evolution global q_min_series global q_max_series global q_avg_series stop_evolution = False q_min_series.clear() q_max_series.clear() q_avg_series.clear() # Set global variables from information on UI global NGEN global POP_SIZE global GA_MUTPB global GA_NELT global GA_MAX_ABS NGEN = int(self.tbxGenerations.text()) POP_SIZE = int(self.tbxPopulation.text()) GA_MUTPB = m GA_NELT = e GA_MAX_ABS = ma ####Initialize deap GA objects#### # Make creator that minimize. If it would be 1.0 instead od -1.0 than it would be maxmize self.creator = creator self.creator.create("FitnessMin", base.Fitness, weights=(-1.0, )) # Create an individual (a blueprint for cromosomes) as a list with a specified fitness type self.creator.create( "Individual", list, fitness=self.creator.FitnessMin) # Create base toolbox for finishing creation of a individual (cromosome) self.toolbox = base.Toolbox() # Define what type of data (number, gene) will it be in the cromosome self.toolbox.register("attr_float", random.uniform, F_MIN, F_MAX) # Initialization procedure (initRepeat) for the cromosome. For the individual to be completed we need to run initRepeat for the amaout of genes the cromosome includes self.toolbox.register("individual", tools.initRepeat, self.creator.Individual, self.toolbox.attr_float, n=NO_DIMS) # Create a population of individuals (cromosomes). The population is then created by toolbox.population(n=300) where 'n' is the number of cromosomes in population self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) # Register evaluation function self.toolbox.register("evaluate", evaluateInd) # Register what genetic operators to use # Standard coding self.toolbox.register( "mate", tools.cxTwoPoint ) # Use two point recombination self.toolbox.register("mutate", tools.mutGaussian, mu=0, sigma=GA_MAX_ABS, indpb=0.5) self.toolbox.register( "select", tools.selTournament, tournsize=3) # Use tournament selection ################################## # Generate initial poplation. Will be a member variable so we can easely pass everything to new thread self.pop = self.toolbox.population(n=POP_SIZE) # Evaluate initial population, we map() the evaluation function to every individual and then assign their respective fitness, map runs evaluate function for each individual in pop fitnesses = list( map(self.toolbox.evaluate, self.pop)) for ind, fit in zip(self.pop, fitnesses): ind.fitness.values = fit # Assign calcualted fitness value to individuals # Extracting all the fitnesses of all individuals in a population so we can monitor and evovlve the algorithm until it reaches 0 or max number of generation is reached self.fits = [ ind.fitness.values[0] for ind in self.pop ] # Disable start and enable stop self.btnStartGA.setEnabled(False) self.btnStartPSO.setEnabled(False) self.btnStop.setEnabled(False) self.genParams.setEnabled(False) self.gaParams.setEnabled(False) self.psoParams.setEnabled(False) self.cbxNoVis.setEnabled(False) # Start evolution self.evolveGA() # Best fitness value -- Added by Denis Lazor best_fit = np.array(min(best_fit_values))[0] mean_fit = np.array( min(best_fit_values, key=lambda x: abs(x - statistics.mean( np.asarray(best_fit_values).flatten()))) )[0] # Index of best fitness value -- Added by Denis Lazor mean_fit_idx = best_fit_values.index(mean_fit) write_to_file(combination_series[mean_fit_idx], parameter_name, "ga") # First name will be "original", second one "max_abs" -- Added by Denis Lazor parameter_name = "max_abs" print_results_GA(POP_SIZE, m, e, ma, mean_fit, best_fit, NGEN, d) # Clearing past lists -- Added by Denis Lazor combination_series = [] best_fit_values = [] # Reducing number of combinations and changing .csv file for writing -- Added by Denis Lazor MAX_ABS_SIZES = MAX_ABS_SIZES[0:1] parameter_name = "elites" ELITE_SIZES = ELITE_SIZES[0:1] parameter_name = "mutation" MUTATION_SIZES = MUTATION_SIZES[0:1] parameter_name = "original" def btnStartPSO_Click(self): global combination_series # List of lists containing min_series of 5 results -- Added by Denis Lazor global parameter_name # Name of parameter used for writing its data to .csv file -- Added by Denis Lazor global best_fit_values # List containing best fitness values for every of 5 experiments per combination -- Added by Denis Lazor global DIM_SIZES global INERTIA_SIZES global PERSONAL_F_SIZES global SOCIAL_F_SIZES # Checking if files are empty or not -- Added by Denis Lazor csv_contains_pso = os.stat("graphs_csv/original_pso.csv").st_size != 0 # Clearing non empty files if we are trying to write to them -- Added by Denis Lazor if csv_contains_pso: clear_all_csv("pso") n = 5000 parameter_name = "original" print("PSO:\n") # Automation for all necessary combinations -- Added by Denis Lazor for d in DIM_SIZES: INERTIA_SIZES = [0.0, 0.37, 0.74] PERSONAL_F_SIZES = [0.5, 1.0, 1.5] SOCIAL_F_SIZES = [0.5, 1.0, 1.5] for in_f in INERTIA_SIZES: for pers_f in PERSONAL_F_SIZES: for soc_f in SOCIAL_F_SIZES: for i in range(5): # Set global variables global stop_evolution global q_min_series global q_max_series global q_avg_series stop_evolution = False q_min_series.clear() q_max_series.clear() q_avg_series.clear() # Set global variables from information on UI global NGEN global POP_SIZE global PSO_INERTIA global PSO_PERSONAL global PSO_SOCIAL NGEN = int(self.tbxGenerations.text()) POP_SIZE = int(self.tbxPopulation.text()) PSO_INERTIA = in_f PSO_PERSONAL = pers_f PSO_SOCIAL = soc_f ####Initialize deap PSO objects#### # Make creator that minimize. If it would be 1.0 instead od -1.0 than it would be maxmize self.creator = creator self.creator.create("FitnessMin", base.Fitness, weights=(-1.0, )) # Create an individual (a blueprint for cromosomes) as a list with a specified fitness type self.creator.create( "Particle", list, fitness=self.creator.FitnessMin, speed=list, best=None) # Create base toolbox for finishing creation of a individual (particle) and population self.toolbox = base.Toolbox() # Particle initialization self.toolbox.register("particle", generateParticle, cr=self.creator, size=NO_DIMS, min_val=F_MIN, max_val=F_MAX) # Create a population of individuals (particles). The population is then created by e.g. toolbox.population(n=300) where 'n' is the number of particles in population self.toolbox.register("population", tools.initRepeat, list, self.toolbox.particle) # Update function for each particle self.toolbox.register("update", updateParticle) # Evaluation function for each particle self.toolbox.register("evaluate", evaluateInd) ################################## # Create population self.pop = self.toolbox.population(n=POP_SIZE) # Evaluate initial population, we map() the evaluation function to every individual and then assign their respective fitness, map runs emaluet function for each individual in pop fitnesses = list( map(self.toolbox.evaluate, self.pop)) for ind, fit in zip(self.pop, fitnesses): ind.fitness.values = fit # Extracting all the fitnesses of all individuals in a population so we can monitor and evovlve the algorithm until it reaches 0 or max number of generation is reached self.fits = [ ind.fitness.values[0] for ind in self.pop ] # Extraction current best position self.global_best_position = tools.selBest( self.pop, 1)[0][:] # Disable start and enable stop self.btnStartGA.setEnabled(False) self.btnStartPSO.setEnabled(False) self.btnStop.setEnabled(False) self.genParams.setEnabled(False) self.gaParams.setEnabled(False) self.psoParams.setEnabled(False) self.cbxNoVis.setEnabled(False) # Start evolution self.evolvePSO() # Best fitness value -- Added by Denis Lazor best_fit = np.array(min(best_fit_values))[0] mean_fit = np.array( min(best_fit_values, key=lambda x: abs(x - statistics.mean( np.asarray(best_fit_values).flatten()))) )[0] # Index of best fitness value -- Added by Denis Lazor mean_fit_idx = best_fit_values.index(mean_fit) write_to_file(combination_series[mean_fit_idx], parameter_name, "pso") # First name will be "original", second one "social_factor" -- Added by Denis Lazor parameter_name = "social_factor" print_results_PSO(POP_SIZE, in_f, pers_f, soc_f, mean_fit, best_fit, NGEN, d) # Clearing past lists -- Added by Denis Lazor print(best_fit_values) combination_series = [] best_fit_values = [] # Reducing number of combinations and changing .csv file for writing -- Added by Denis Lazor SOCIAL_F_SIZES = SOCIAL_F_SIZES[0:1] parameter_name = "personal_factor" PERSONAL_F_SIZES = PERSONAL_F_SIZES[0:1] parameter_name = "inertia" INERTIA_SIZES = INERTIA_SIZES[0:1] parameter_name = "original" def btnStop_Click(self): global stop_evolution stop_evolution = True #Disable stop and enable start self.btnStartGA.setEnabled(True) self.btnStartPSO.setEnabled(True) self.btnStop.setEnabled(False) self.genParams.setEnabled(True) self.gaParams.setEnabled(True) self.psoParams.setEnabled(True) self.cbxNoVis.setEnabled(True) #Function for GA evolution def evolveGA(self): global q_min_series global q_max_series global q_avg_series global combination_series global best_fit_values combination_current_series = [ ] # Clearing fitness values series -- Added by Denis Lazor # Variable for keeping track of the number of generations curr_g = 0 # Begin the evolution till goal is reached or max number of generation is reached while min(self.fits) != 0 and curr_g < NGEN: #Check if evolution and thread need to stop if stop_evolution: break #Break the evolution loop # A new generation curr_g = curr_g + 1 # print("-- Generation %i --" % curr_g) # Select the next generation individuals #Select POP_SIZE - NELT number of individuals. Since recombination is between neigbours, not two naighbours should be the clone of the same individual offspring = [] offspring.append(self.toolbox.select( self.pop, 1)[0]) #add first selected individual for i in range( POP_SIZE - GA_NELT - 1 ): # -1 because the first seleceted individual is already added while True: new_o = self.toolbox.select(self.pop, 1)[0] if new_o != offspring[len( offspring ) - 1]: #if it is different than the last inserted then add to offspring and break offspring.append(new_o) break # Clone the selected individuals because all of the changes are inplace offspring = list(map(self.toolbox.clone, offspring)) # Apply crossover on the selected offspring for child1, child2 in zip(offspring[::2], offspring[1::2]): self.toolbox.mate(child1, child2) #inplace recombination #Invalidate new children fitness values del child1.fitness.values del child2.fitness.values #Apply mutation on the offspring for mutant in offspring: if random.random() < GA_MUTPB: self.toolbox.mutate(mutant) del mutant.fitness.values #Add elite individuals #Is clonning needed? offspring.extend( list(map(self.toolbox.clone, tools.selBest(self.pop, GA_NELT)))) # Evaluate the individuals with an invalid fitness invalid_ind = [ind for ind in offspring if not ind.fitness.valid] fitnesses = map(self.toolbox.evaluate, invalid_ind) for ind, fit in zip(invalid_ind, fitnesses): ind.fitness.values = fit # print(" Evaluated %i individuals" % len(invalid_ind)) #Replace population with offspring self.pop[:] = offspring # Gather all the fitnesses in one list and print the stats self.fits = [ind.fitness.values[0] for ind in self.pop] length = len(self.pop) mean = sum(self.fits) / length sum2 = sum(x * x for x in self.fits) std = abs(sum2 / length - mean**2)**0.5 q_min_series.append(curr_g, min(self.fits)) q_max_series.append(curr_g, max(self.fits)) q_avg_series.append(curr_g, mean) combination_current_series.append( min(self.fits) ) # Saving min_series fitness values of an experiment -- Added by Denis Lazor # print(" Min %s" % q_min_series.at(q_min_series.count()-1).y()) # print(" Max %s" % q_max_series.at(q_max_series.count()-1).y()) # print(" Avg %s" % mean) # print(" Std %s" % std) # if self.cbxNoVis.isChecked(): app.processEvents() else: self.chart = QChart() self.chart.addSeries(q_min_series) self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("Fitness value over time") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) self.frameChart.repaint() app.processEvents() #Printing best individual best_ind = tools.selBest(self.pop, 1)[0] # print("Best individual is %s, %s" % (best_ind, best_ind.fitness.values)) #Visulaize final solution if self.cbxNoVis.isChecked(): self.chart = QChart() self.chart.addSeries(q_min_series) self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("Fitness value over time") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) self.frameChart.repaint() #Disable stop and enable start self.btnStartGA.setEnabled(True) self.btnStartPSO.setEnabled(True) self.btnStop.setEnabled(False) self.genParams.setEnabled(True) self.gaParams.setEnabled(True) self.psoParams.setEnabled(True) self.cbxNoVis.setEnabled(True) app.processEvents() combination_series.append(combination_current_series ) # Saving 5 results -- Added by Denis Lazor best_fit_values.append( best_ind.fitness.values ) # Adding best fitness value of experiment -- Added by Denis Lazor #Function for GA evolution def evolvePSO(self): global q_min_series global q_max_series global q_avg_series global combination_series global best_fit_values combination_current_series = [ ] # Clearing fitness values series -- Added by Denis Lazor # Variable for keeping track of the number of generations curr_g = 0 while min(self.fits) != 0.0 and curr_g < NGEN: #Check if evolution and thread need to stop if stop_evolution: break #Break the evolution loop # A new generation curr_g = curr_g + 1 # print("-- Generation %i --" % curr_g) #Update particle position and evaluate particle for particle in self.pop: #Update self.toolbox.update(particle, self.global_best_position, PSO_INERTIA, PSO_PERSONAL, PSO_SOCIAL) #Evaluate fit = self.toolbox.evaluate(particle) #Update best position if fit[0] < particle.fitness.values[0]: particle.best = particle[:] #Update fitness particle.fitness.values = fit #Extracting all the fitnesses of all individuals in a population so we can monitor and evovlve the algorithm until it reaches 0 or max number of generation is reached self.fits = [ind.fitness.values[0] for ind in self.pop] #Extraction current best position self.global_best_position = tools.selBest(self.pop, 1)[0][:] #Stats length = len(self.pop) mean = sum(self.fits) / length sum2 = sum(x * x for x in self.fits) std = abs(sum2 / length - mean**2)**0.5 q_min_series.append(curr_g, min(self.fits)) q_max_series.append(curr_g, max(self.fits)) q_avg_series.append(curr_g, mean) combination_current_series.append( min(self.fits) ) # Saving min_series fitness values of an experiment -- Added by Denis Lazor # print(" Min %s" % q_min_series.at(q_min_series.count()-1).y()) # print(" Max %s" % q_max_series.at(q_max_series.count()-1).y()) # print(" Avg %s" % mean) # print(" Std %s" % std) # if self.cbxNoVis.isChecked(): app.processEvents() else: self.chart = QChart() self.chart.addSeries(q_min_series) self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("Fitness value over time") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) self.frameChart.repaint() app.processEvents() #Printing best individual best_ind = tools.selBest(self.pop, 1)[0] # print("Best individual is %s, %s" % (best_ind, best_ind.fitness.values)) #Visulaize final solution if self.cbxNoVis.isChecked(): self.chart = QChart() self.chart.addSeries(q_min_series) self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("Fitness value over time") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) self.frameChart.repaint() #Disable stop and enable start self.btnStartGA.setEnabled(True) self.btnStartPSO.setEnabled(True) self.btnStop.setEnabled(False) self.genParams.setEnabled(True) self.gaParams.setEnabled(True) self.psoParams.setEnabled(True) self.cbxNoVis.setEnabled(True) app.processEvents() combination_series.append(combination_current_series ) # Saving 5 results -- Added by Denis Lazor best_fit_values.append( best_ind.fitness.values ) # Adding best fitness value of experiment -- Added by Denis Lazor def btnSaveChart_CLick(self): p = self.frameChart.grab() filename, _ = QFileDialog.getSaveFileName( None, "Save series chart as a image", "", "Image Files (*.png)") p.save(filename, "PNG") print("Chart series image saved to: ", filename) def btnSaveChartSeries_Click(self): global q_min_series global q_max_series global q_avg_series filename, _ = QFileDialog.getSaveFileName(None, "Save series to text file", "", "Text Files (*.txt, *.csv)") with open(filename, 'w') as dat: for i in range(q_min_series.count()): dat.write('%f,%f,%f\n' % (q_min_series.at(i).y(), q_avg_series.at(i).y(), q_max_series.at(i).y())) print("Chart series saved to: ", filename)
class Ui_MainWindow(QtWidgets.QMainWindow): def setupUi(self): self.setObjectName("MainWindow") self.resize(850, 1080) self.setWindowTitle("GA - Queens") self.centralwidget = QtWidgets.QWidget(self) self.centralwidget.setObjectName("centralwidget") self.frameWorld = MyQFrame(self.centralwidget) self.frameWorld.img = QPixmap(1000, 1000) self.frameWorld.setGeometry(QtCore.QRect(10, 10, 620, 600)) self.frameWorld.setFrameShape(QtWidgets.QFrame.Box) self.frameWorld.setFrameShadow(QtWidgets.QFrame.Sunken) self.frameWorld.setObjectName("frameWorld") self.frameChart = QChartView(self.centralwidget) self.frameChart.setGeometry(QtCore.QRect(10, 620, 620, 400)) self.frameChart.setFrameShape(QtWidgets.QFrame.Box) self.frameChart.setFrameShadow(QtWidgets.QFrame.Sunken) self.frameChart.setRenderHint(QPainter.Antialiasing) self.frameChart.setObjectName("frameChart") self.gaParams = QtWidgets.QGroupBox(self.centralwidget) self.gaParams.setGeometry(QtCore.QRect(650, 10, 161, 145)) self.gaParams.setObjectName("gaParams") self.gaParams.setTitle("GA parameters") self.label1 = QtWidgets.QLabel(self.gaParams) self.label1.setGeometry(QtCore.QRect(10, 20, 61, 16)) self.label1.setObjectName("label1") self.label1.setText("Population:") self.label2 = QtWidgets.QLabel(self.gaParams) self.label2.setGeometry(QtCore.QRect(10, 50, 47, 16)) self.label2.setObjectName("label2") self.label2.setText("Mutation:") self.label3 = QtWidgets.QLabel(self.gaParams) self.label3.setGeometry(QtCore.QRect(10, 80, 81, 16)) self.label3.setObjectName("label3") self.label3.setText("Elite members:") self.label4 = QtWidgets.QLabel(self.gaParams) self.label4.setGeometry(QtCore.QRect(10, 110, 91, 16)) self.label4.setObjectName("label4") self.label4.setText("No. generations:") self.tbxPopulation = QtWidgets.QLineEdit(self.gaParams) self.tbxPopulation.setGeometry(QtCore.QRect(100, 20, 51, 20)) self.tbxPopulation.setObjectName("tbxPopulation") self.tbxMutation = QtWidgets.QLineEdit(self.gaParams) self.tbxMutation.setGeometry(QtCore.QRect(100, 50, 51, 20)) self.tbxMutation.setObjectName("tbxMutation") self.tbxElite = QtWidgets.QLineEdit(self.gaParams) self.tbxElite.setGeometry(QtCore.QRect(100, 80, 51, 20)) self.tbxElite.setObjectName("tbxElite") self.tbxGenerations = QtWidgets.QLineEdit(self.gaParams) self.tbxGenerations.setGeometry(QtCore.QRect(100, 110, 51, 20)) self.tbxGenerations.setObjectName("tbxGenerations") self.cbxNoVis = QtWidgets.QCheckBox(self.centralwidget) self.cbxNoVis.setGeometry(QtCore.QRect(650, 170, 170, 17)) self.cbxNoVis.setObjectName("cbxNoVis") self.cbxNoVis.setText("No visualization per generation") self.cbxBorder = QtWidgets.QCheckBox(self.centralwidget) self.cbxBorder.setGeometry(QtCore.QRect(650, 200, 100, 17)) self.cbxBorder.setObjectName("cbxBorder") self.cbxBorder.setText("Border patrol") self.btnStart = QtWidgets.QPushButton(self.centralwidget) self.btnStart.setGeometry(QtCore.QRect(650, 230, 75, 23)) self.btnStart.setObjectName("btnStart") self.btnStart.setText("Start") self.btnStop = QtWidgets.QPushButton(self.centralwidget) self.btnStop.setEnabled(False) self.btnStop.setGeometry(QtCore.QRect(730, 230, 75, 23)) self.btnStop.setObjectName("btnStop") self.btnStop.setText("Stop") self.btnSaveWorld = QtWidgets.QPushButton(self.centralwidget) self.btnSaveWorld.setGeometry(QtCore.QRect(650, 570, 121, 41)) self.btnSaveWorld.setObjectName("btnSaveWorld") self.btnSaveWorld.setText("Save world as image") self.btnSaveChart = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChart.setGeometry(QtCore.QRect(650, 930, 121, 41)) self.btnSaveChart.setObjectName("btnSaveChart") self.btnSaveChart.setText("Save chart as image") self.btnSaveChartSeries = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChartSeries.setGeometry(QtCore.QRect(650, 980, 121, 41)) self.btnSaveChartSeries.setObjectName("btnSaveChartSeries") self.btnSaveChartSeries.setText("Save chart as series") self.setCentralWidget(self.centralwidget) QtCore.QMetaObject.connectSlotsByName(self) #Connect events self.btnStart.clicked.connect(self.btnStart_Click) self.btnStop.clicked.connect(self.btnStop_Click) self.btnSaveWorld.clicked.connect(self.btnSaveWorld_Click) self.btnSaveChart.clicked.connect(self.btnSaveChart_CLick) self.btnSaveChartSeries.clicked.connect(self.btnSaveChartSeries_Click) #Set default GA variables self.tbxGenerations.insert(str(NGEN)) self.tbxPopulation.insert(str(POP_SIZE)) self.tbxMutation.insert(str(MUTPB)) self.tbxElite.insert(str(NELT)) self.new_image = QPixmap(1000, 1000) def btnStart_Click(self): global combination_series # List of lists containing min_series of 5 correct results -- Added by Denis Lazor global parameter_name # Name of parameter used for writing its data to .csv file -- Added by Denis Lazor global best_fit_values # List containing best fitness values for every of 5 experiments per combination -- Added by Denis Lazor global best_individual # Saving best individuals for drawing the best solution -- Added by Denis Lazor global ELITE_SIZES global POPULATION_SIZES global MUTATION_SIZES # Checking if files are empty or not -- Added by Denis Lazor csv_contains = os.stat("graphs_csv/original.csv").st_size != 0 if csv_contains: clear_all_csv() n = 5000 # Automation for all necessary combinations -- Added by Denis Lazor for p in POPULATION_SIZES: for m in MUTATION_SIZES: for e in ELITE_SIZES: for i in range(5): # Set global variables global stop_evolution global q_min_series global q_max_series global q_avg_series stop_evolution = False q_min_series.clear() q_max_series.clear() q_avg_series.clear() # Set global variables from information on UI global NGEN global POP_SIZE global MUTPB global NELT NGEN = n POP_SIZE = p MUTPB = m NELT = e global border_check border_check = self.cbxBorder.isChecked() # Loading Croatia map self.img = QPixmap(620, 600) self.img.load('Croatia620.png') self.frameWorld.img = self.img # Drawing towns painter = QPainter(self.img) painter.setPen(QPen(Qt.black, 10, Qt.SolidLine)) painter.setFont(QFont('Arial', 12)) for i in range(len(gradovi)): x, y = GlobToImgCoords(sirine[i], duzine[i]) painter.drawPoint(x, y) painter.drawText(x + 5, y + 5, gradovi[i]) painter.end() # Redrawing frames self.frameWorld.repaint() app.processEvents() ####Initialize deap GA objects#### # Make creator that minimize. If it would be 1.0 instead od -1.0 than it would be maxmize creator.create("FitnessMin", base.Fitness, weights=(-1.0, )) # Create an individual (a blueprint for cromosomes) as a list with a specified fitness type creator.create("Individual", list, fitness=creator.FitnessMin) # Create base toolbox for finishing creation of a individual (cromosome) self.toolbox = base.Toolbox() # This is if we want a permutation coding of genes in the cromosome self.toolbox.register("indices", random.sample, range(IND_SIZE), IND_SIZE) # initIterate requires that the generator of genes (such as random.sample) generates an iterable (a list) variable self.toolbox.register("individual", tools.initIterate, creator.Individual, self.toolbox.indices) # Create a population of individuals (cromosomes). The population is then created by toolbox.population(n=300) where 'n' is the number of cromosomes in population self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) # Register evaluation function self.toolbox.register("evaluate", evaluateInd) # Register what genetic operators to use self.toolbox.register( "mate", tools.cxUniformPartialyMatched, indpb=0.2 ) # Use uniform recombination for permutation coding # Permutation coding self.toolbox.register("mutate", tools.mutShuffleIndexes, indpb=0.2) self.toolbox.register( "select", tools.selTournament, tournsize=3) # Use tournament selection ################################## # Generate initial poplation. Will be a member variable so we can easely pass everything to new thread self.pop = self.toolbox.population(n=POP_SIZE) # Evaluate initial population, we map() the evaluation function to every individual and then assign their respective fitness, map runs evaluate function for each individual in pop fitnesses = list(map(self.toolbox.evaluate, self.pop)) for ind, fit in zip(self.pop, fitnesses): ind.fitness.values = fit # Assign calcualted fitness value to individuals # Extracting all the fitnesses of all individuals in a population so we can monitor and evovlve the algorithm until it reaches 0 or max number of generation is reached self.fits = [ind.fitness.values[0] for ind in self.pop] # Disable start and enable stop self.btnStart.setEnabled(False) self.btnStop.setEnabled(True) self.gaParams.setEnabled(False) self.cbxBorder.setEnabled(False) self.cbxNoVis.setEnabled(False) # Start evolution self.evolve() # Best fitness value -- Added by Denis Lazor best_fit = np.array(min(best_fit_values))[0] mean_fit = min( best_fit_values, key=lambda x: abs(x - statistics.mean( (np.asarray(best_fit_values)).flatten())))[0] # Index of best fitness value -- Added by Denis Lazor best_fit_idx = best_fit_values.index(best_fit) write_to_file(combination_series[best_fit_idx], parameter_name) # First name will be "original", second one "elites" -- Added by Denis Lazor parameter_name = "elites" print_results(p, m, e, best_fit, mean_fit, NGEN) # Clearing past lists -- Added by Denis Lazor combination_series = [] best_fit_values = [] # Reducing number of combinations and changing .csv file for writing -- Added by Denis Lazor ELITE_SIZES = ELITE_SIZES[0:1] parameter_name = "mutation" MUTATION_SIZES = MUTATION_SIZES[0:1] parameter_name = "population" print("Best individual: " + str(best_individual)) self.updateWorldFrame(generateWorldImage( best_individual)) # Drawing best solution -- Added by Denis Lazor def btnStop_Click(self): global stop_evolution stop_evolution = True #Disable stop and enable start self.btnStop.setEnabled(False) self.btnStart.setEnabled(True) self.gaParams.setEnabled(True) self.cbxBorder.setEnabled(True) self.cbxNoVis.setEnabled(True) #Function for GA evolution def evolve(self): global q_min_series global q_max_series global q_avg_series global best_fit_values global combination_series global best_individual combination_current_series = [ ] # Clearing fitness values series -- Added by Denis Lazor # Variable for keeping track of the number of generations curr_g = 0 # Begin the evolution till goal is reached or max number of generation is reached while min(self.fits) != 0 and curr_g < NGEN: #Check if evolution and thread need to stop if stop_evolution: break #Break the evolution loop # A new generation curr_g = curr_g + 1 #print("-- Generation %i --" % curr_g) # Select the next generation individuals #Select POP_SIZE - NELT number of individuals. Since recombination is between neigbours, not two naighbours should be the clone of the same individual offspring = [] offspring.append(self.toolbox.select( self.pop, 1)[0]) #add first selected individual for i in range( POP_SIZE - NELT - 1 ): # -1 because the first seleceted individual is already added while True: new_o = self.toolbox.select(self.pop, 1)[0] if new_o != offspring[len( offspring ) - 1]: #if it is different than the last inserted then add to offspring and break offspring.append(new_o) break # Clone the selected individuals because all of the changes are inplace offspring = list(map(self.toolbox.clone, offspring)) # Apply crossover on the selected offspring for child1, child2 in zip(offspring[::2], offspring[1::2]): self.toolbox.mate(child1, child2) #inplace recombination #Invalidate new children fitness values del child1.fitness.values del child2.fitness.values #Apply mutation on the offspring for mutant in offspring: if random.random() < MUTPB: self.toolbox.mutate(mutant) del mutant.fitness.values #Add elite individuals #Is clonning needed? offspring.extend( list(map(self.toolbox.clone, tools.selBest(self.pop, NELT)))) # Evaluate the individuals with an invalid fitness invalid_ind = [ind for ind in offspring if not ind.fitness.valid] fitnesses = map(self.toolbox.evaluate, invalid_ind) for ind, fit in zip(invalid_ind, fitnesses): ind.fitness.values = fit #print(" Evaluated %i individuals" % len(invalid_ind)) #Replace population with offspring self.pop[:] = offspring # Gather all the fitnesses in one list and print the stats self.fits = [ind.fitness.values[0] for ind in self.pop] length = len(self.pop) mean = sum(self.fits) / length sum2 = sum(x * x for x in self.fits) std = abs(sum2 / length - mean**2)**0.5 q_min_series.append(curr_g, min(self.fits)) q_max_series.append(curr_g, max(self.fits)) q_avg_series.append(curr_g, mean) combination_current_series.append( min(self.fits) ) # Saving min_series fitness values of an experiment -- Added by Denis Lazor #print(" Min %s" % q_min_series.at(q_min_series.count()-1).y()) #print(" Max %s" % q_max_series.at(q_max_series.count()-1).y()) #print(" Avg %s" % mean) #print(" Std %s" % std) if self.cbxNoVis.isChecked(): app.processEvents() else: self.chart = QChart() self.chart.addSeries(q_min_series) self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("Fitness value over time") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) #Draw queen positions of best individual on a image best_ind = tools.selBest(self.pop, 1)[0] self.updateWorldFrame(generateWorldImage(best_ind)) #Printing best individual best_ind = tools.selBest(self.pop, 1)[0] #print("Best individual is %s, %s" % (best_ind, best_ind.fitness.values)) combination_series.append( combination_current_series ) # Saving best 5 results -- Added by Denis Lazor if not best_individual: best_individual = best_ind elif best_ind.fitness.values < best_individual.fitness.values: # Saving best individual in all combinations -- Added by Denis Lazor best_individual = best_ind best_fit_values.append( best_ind.fitness.values ) # Adding best fitness value of experiment -- Added by Denis Lazor # #Visulaize final solution # if self.cbxNoVis.isChecked(): # self.chart = QChart() # self.chart.addSeries(q_min_series) # self.chart.addSeries(q_max_series) # self.chart.addSeries(q_avg_series) # self.chart.setTitle("Fitness value over time") # self.chart.setAnimationOptions(QChart.NoAnimation) # self.chart.createDefaultAxes() # self.frameChart.setChart(self.chart) # # #Draw queen positions of best individual on a image # best_ind = tools.selBest(self.pop, 1)[0] # self.updateWorldFrame(generateWorldImage(best_ind)) #Disable stop and enable start self.btnStop.setEnabled(False) self.btnStart.setEnabled(True) self.gaParams.setEnabled(True) self.cbxBorder.setEnabled(True) self.cbxNoVis.setEnabled(True) def updateWorldFrame(self, best_individual_img): #new_image = QPixmap(1000,1000) self.new_image.fill() #White color is default painter = QPainter(self.new_image) #First draw the map with towns painter.drawPixmap(self.new_image.rect(), self.img) #Then draw the best individual painter.drawImage(self.new_image.rect(), best_individual_img) painter.end() #Set new image to the frame self.frameWorld.img = self.new_image #Redrawing frames self.frameWorld.repaint() self.frameChart.repaint() app.processEvents() def btnSaveWorld_Click(self): filename, _ = QFileDialog.getSaveFileName(None, "Save world as a image", "", "Image Files (*.png)") self.frameWorld.img.save(filename, "PNG") print("World image saved to: ", filename) def btnSaveChart_CLick(self): p = self.frameChart.grab() filename, _ = QFileDialog.getSaveFileName( None, "Save series chart as a image", "", "Image Files (*.png)") p.save(filename, "PNG") print("Chart series image saved to: ", filename) def btnSaveChartSeries_Click(self): global q_min_series global q_max_series global q_avg_series filename, _ = QFileDialog.getSaveFileName(None, "Save series to text file", "", "Text Files (*.txt, *.csv)") with open(filename, 'w') as dat: for i in range(q_min_series.count()): dat.write('%f,%f,%f\n' % (q_min_series.at(i).y(), q_avg_series.at(i).y(), q_max_series.at(i).y())) print("Chart series saved to: ", filename)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1409, 1146) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_3.setObjectName("verticalLayout_3") self.author_label_2 = QtWidgets.QLabel(self.centralwidget) self.author_label_2.setMaximumSize(QtCore.QSize(16777215, 50)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(20) self.author_label_2.setFont(font) self.author_label_2.setAlignment(QtCore.Qt.AlignCenter) self.author_label_2.setObjectName("author_label_2") self.verticalLayout_3.addWidget(self.author_label_2) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem) self.author_label = QtWidgets.QLabel(self.centralwidget) self.author_label.setMinimumSize(QtCore.QSize(200, 30)) self.author_label.setMaximumSize(QtCore.QSize(16777215, 30)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(-1) font.setBold(True) font.setWeight(75) self.author_label.setFont(font) self.author_label.setStyleSheet( "QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, \n" "QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog {\n" " background-color: #222222;\n" " color: #BBBBBB;\n" " font-family: \"Calibri\";\n" " font-size:13px;\n" " font-weight:bold;\n" "}") self.author_label.setAlignment(QtCore.Qt.AlignCenter) self.author_label.setObjectName("author_label") self.horizontalLayout_7.addWidget(self.author_label) self.verticalLayout_3.addLayout(self.horizontalLayout_7) self.splitter = QtWidgets.QSplitter(self.centralwidget) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.groupBox = QtWidgets.QGroupBox(self.splitter) self.groupBox.setMinimumSize(QtCore.QSize(500, 0)) self.groupBox.setMaximumSize(QtCore.QSize(1300, 16777215)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox.setFont(font) self.groupBox.setAlignment(QtCore.Qt.AlignCenter) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.input_video_widget = QVideoWidget(self.groupBox) self.input_video_widget.setMinimumSize(QtCore.QSize(100, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.input_video_widget.setFont(font) self.input_video_widget.setObjectName("input_video_widget") self.verticalLayout.addWidget(self.input_video_widget) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.label.setFont(font) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.predict_progressBar = QtWidgets.QProgressBar(self.groupBox) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.predict_progressBar.setFont(font) self.predict_progressBar.setProperty("value", 0) self.predict_progressBar.setObjectName("predict_progressBar") self.horizontalLayout_2.addWidget(self.predict_progressBar) self.fps_label = QtWidgets.QLabel(self.groupBox) self.fps_label.setMinimumSize(QtCore.QSize(0, 0)) self.fps_label.setMaximumSize(QtCore.QSize(16777215, 20)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.fps_label.setFont(font) self.fps_label.setObjectName("fps_label") self.horizontalLayout_2.addWidget(self.fps_label) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.import_media_pushButton = QtWidgets.QPushButton(self.groupBox) self.import_media_pushButton.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.import_media_pushButton.setFont(font) self.import_media_pushButton.setStyleSheet( "QPushButton{\n" " background-color:#2828FF;\n" " color:#ffffff;\n" " border-radius: 5px;\n" "}\n" "\n" "QPushButton:hover{\n" " color:#FFFFFF;\n" " background:#9393FF;\n" "}\n" "") self.import_media_pushButton.setObjectName("import_media_pushButton") self.horizontalLayout.addWidget(self.import_media_pushButton) self.start_predict_pushButton = QtWidgets.QPushButton(self.groupBox) self.start_predict_pushButton.setMinimumSize(QtCore.QSize(0, 25)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.start_predict_pushButton.setFont(font) self.start_predict_pushButton.setStyleSheet( "QPushButton{\n" " background-color:#16A085;\n" " color:#ffffff;\n" " border-radius: 5px;\n" "}\n" "\n" "QPushButton:hover{\n" " color:#FFFFFF;\n" " background:#2EE1C1;\n" "}\n" "") self.start_predict_pushButton.setObjectName("start_predict_pushButton") self.horizontalLayout.addWidget(self.start_predict_pushButton) self.verticalLayout.addLayout(self.horizontalLayout) self.groupBox_2 = QtWidgets.QGroupBox(self.splitter) self.groupBox_2.setMinimumSize(QtCore.QSize(500, 0)) self.groupBox_2.setMaximumSize(QtCore.QSize(16777215, 16777215)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox_2.setFont(font) self.groupBox_2.setAlignment(QtCore.Qt.AlignCenter) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2) self.verticalLayout_2.setObjectName("verticalLayout_2") self.output_video_widget = QVideoWidget(self.groupBox_2) self.output_video_widget.setMinimumSize(QtCore.QSize(100, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.output_video_widget.setFont(font) self.output_video_widget.setObjectName("output_video_widget") self.verticalLayout_2.addWidget(self.output_video_widget) self.open_predict_file_pushButton = QtWidgets.QPushButton( self.groupBox_2) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.open_predict_file_pushButton.setFont(font) self.open_predict_file_pushButton.setObjectName( "open_predict_file_pushButton") self.verticalLayout_2.addWidget(self.open_predict_file_pushButton) self.verticalLayout_3.addWidget(self.splitter) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem1) self.video_horizontalSlider = QtWidgets.QSlider(self.centralwidget) self.video_horizontalSlider.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.video_horizontalSlider.setFont(font) self.video_horizontalSlider.setOrientation(QtCore.Qt.Horizontal) self.video_horizontalSlider.setObjectName("video_horizontalSlider") self.horizontalLayout_4.addWidget(self.video_horizontalSlider) self.video_percent_label = QtWidgets.QLabel(self.centralwidget) self.video_percent_label.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.video_percent_label.setFont(font) self.video_percent_label.setObjectName("video_percent_label") self.horizontalLayout_4.addWidget(self.video_percent_label) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.verticalLayout_3.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") spacerItem3 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem3) self.play_pushButton = QtWidgets.QPushButton(self.centralwidget) self.play_pushButton.setMinimumSize(QtCore.QSize(0, 25)) self.play_pushButton.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.play_pushButton.setFont(font) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("icon/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.play_pushButton.setIcon(icon) self.play_pushButton.setObjectName("play_pushButton") self.horizontalLayout_3.addWidget(self.play_pushButton) self.pause_pushButton = QtWidgets.QPushButton(self.centralwidget) self.pause_pushButton.setMinimumSize(QtCore.QSize(0, 25)) self.pause_pushButton.setMaximumSize(QtCore.QSize(16777215, 35)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.pause_pushButton.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("icon/pause.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pause_pushButton.setIcon(icon1) self.pause_pushButton.setObjectName("pause_pushButton") self.horizontalLayout_3.addWidget(self.pause_pushButton) spacerItem4 = QtWidgets.QSpacerItem(40, 25, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_3.addItem(spacerItem4) self.verticalLayout_3.addLayout(self.horizontalLayout_3) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setMaximumSize(QtCore.QSize(16777215, 150)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.groupBox_3.setFont(font) self.groupBox_3.setObjectName("groupBox_3") self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.groupBox_3) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.predict_info_plainTextEdit = QtWidgets.QPlainTextEdit( self.groupBox_3) self.predict_info_plainTextEdit.setMaximumSize( QtCore.QSize(16777215, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.predict_info_plainTextEdit.setFont(font) self.predict_info_plainTextEdit.setObjectName( "predict_info_plainTextEdit") self.horizontalLayout_6.addWidget(self.predict_info_plainTextEdit) self.horizontalLayout_5.addWidget(self.groupBox_3) self.verticalLayout_3.addLayout(self.horizontalLayout_5) self.gpu_info_chart = QChartView(self.centralwidget) self.gpu_info_chart.setMaximumSize(QtCore.QSize(16777215, 100)) font = QtGui.QFont() font.setFamily("微软雅黑") font.setPointSize(10) self.gpu_info_chart.setFont(font) self.gpu_info_chart.setObjectName("gpu_info_chart") self.verticalLayout_3.addWidget(self.gpu_info_chart) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1409, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.author_label_2.setText( _translate("MainWindow", "Intelligent Monitoring System of Construction Site")) self.author_label.setText( _translate("MainWindow", "Product by: HinGwenWoong")) self.groupBox.setTitle(_translate("MainWindow", "Input Media")) self.label.setText(_translate("MainWindow", "Processing:")) self.fps_label.setText(_translate("MainWindow", "(FPS)")) self.import_media_pushButton.setStatusTip( _translate("MainWindow", "Import video to predict")) self.import_media_pushButton.setText(_translate( "MainWindow", "Import")) self.start_predict_pushButton.setStatusTip( _translate("MainWindow", "Predict the vedio")) self.start_predict_pushButton.setText( _translate("MainWindow", "Predict")) self.groupBox_2.setTitle(_translate("MainWindow", "Output Media")) self.open_predict_file_pushButton.setText( _translate("MainWindow", "Open in Browser")) self.video_percent_label.setText(_translate("MainWindow", "0 %")) self.play_pushButton.setText(_translate("MainWindow", "Play")) self.pause_pushButton.setText(_translate("MainWindow", "Pause")) self.groupBox_3.setTitle(_translate("MainWindow", "Predict Info:"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1061, 683) font = QtGui.QFont() font.setFamily("宋体") font.setPointSize(10) MainWindow.setFont(font) MainWindow.setStyleSheet("QPushButton,QComboBox{\n" " min-height:22px \n" "}\n" "\n" "QSpinBox, QDoubleSpinBox{\n" " min-height:20px \n" "}\n" "") self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.splitter = QtWidgets.QSplitter(self.centralWidget) self.splitter.setGeometry(QtCore.QRect(5, 5, 1031, 596)) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.toolBox = QtWidgets.QToolBox(self.splitter) self.toolBox.setMaximumSize(QtCore.QSize(400, 16777215)) self.toolBox.setFrameShape(QtWidgets.QFrame.NoFrame) self.toolBox.setObjectName("toolBox") self.page = QtWidgets.QWidget() self.page.setGeometry(QtCore.QRect(0, 0, 400, 506)) self.page.setObjectName("page") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.page) self.verticalLayout_5.setContentsMargins(3, 3, 3, 3) self.verticalLayout_5.setSpacing(3) self.verticalLayout_5.setObjectName("verticalLayout_5") self.scrollArea_2 = QtWidgets.QScrollArea(self.page) self.scrollArea_2.setWidgetResizable(True) self.scrollArea_2.setObjectName("scrollArea_2") self.scrollAreaWidgetContents_2 = QtWidgets.QWidget() self.scrollAreaWidgetContents_2.setGeometry( QtCore.QRect(0, 0, 392, 498)) self.scrollAreaWidgetContents_2.setObjectName( "scrollAreaWidgetContents_2") self.verticalLayout_4 = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents_2) self.verticalLayout_4.setContentsMargins(11, 11, 11, 11) self.verticalLayout_4.setSpacing(6) self.verticalLayout_4.setObjectName("verticalLayout_4") self.groupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2) self.groupBox.setObjectName("groupBox") self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_9.setContentsMargins(11, 11, 11, 11) self.gridLayout_9.setSpacing(6) self.gridLayout_9.setObjectName("gridLayout_9") self.btnTitleSetText = QtWidgets.QPushButton(self.groupBox) self.btnTitleSetText.setObjectName("btnTitleSetText") self.gridLayout_9.addWidget(self.btnTitleSetText, 0, 0, 1, 1) self.editTitle = QtWidgets.QLineEdit(self.groupBox) self.editTitle.setObjectName("editTitle") self.gridLayout_9.addWidget(self.editTitle, 0, 1, 1, 1) self.btnTitleColor = QtWidgets.QPushButton(self.groupBox) self.btnTitleColor.setObjectName("btnTitleColor") self.gridLayout_9.addWidget(self.btnTitleColor, 1, 0, 1, 1) self.btnTitleFont = QtWidgets.QPushButton(self.groupBox) self.btnTitleFont.setObjectName("btnTitleFont") self.gridLayout_9.addWidget(self.btnTitleFont, 1, 1, 1, 1) self.verticalLayout_4.addWidget(self.groupBox) self.groupBox_Legend = QtWidgets.QGroupBox( self.scrollAreaWidgetContents_2) self.groupBox_Legend.setCheckable(True) self.groupBox_Legend.setChecked(True) self.groupBox_Legend.setObjectName("groupBox_Legend") self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox_Legend) self.gridLayout_7.setContentsMargins(11, 11, 11, 11) self.gridLayout_7.setSpacing(6) self.gridLayout_7.setObjectName("gridLayout_7") self.radioButton = QtWidgets.QRadioButton(self.groupBox_Legend) self.radioButton.setChecked(True) self.radioButton.setObjectName("radioButton") self.gridLayout_7.addWidget(self.radioButton, 0, 0, 1, 1) self.radioButton_2 = QtWidgets.QRadioButton(self.groupBox_Legend) self.radioButton_2.setObjectName("radioButton_2") self.gridLayout_7.addWidget(self.radioButton_2, 0, 1, 1, 1) self.radioButton_3 = QtWidgets.QRadioButton(self.groupBox_Legend) self.radioButton_3.setObjectName("radioButton_3") self.gridLayout_7.addWidget(self.radioButton_3, 1, 0, 1, 1) self.radioButton_4 = QtWidgets.QRadioButton(self.groupBox_Legend) self.radioButton_4.setObjectName("radioButton_4") self.gridLayout_7.addWidget(self.radioButton_4, 1, 1, 1, 1) self.btnLegendlabelColor = QtWidgets.QPushButton(self.groupBox_Legend) self.btnLegendlabelColor.setObjectName("btnLegendlabelColor") self.gridLayout_7.addWidget(self.btnLegendlabelColor, 2, 0, 1, 1) self.btnLegendFont = QtWidgets.QPushButton(self.groupBox_Legend) self.btnLegendFont.setObjectName("btnLegendFont") self.gridLayout_7.addWidget(self.btnLegendFont, 2, 1, 1, 1) self.verticalLayout_4.addWidget(self.groupBox_Legend) self.groupBox_2 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout.setContentsMargins(11, 11, 11, 11) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.groupBox_2) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.spinMarginLeft = QtWidgets.QSpinBox(self.groupBox_2) self.spinMarginLeft.setMinimum(10) self.spinMarginLeft.setMaximum(500) self.spinMarginLeft.setObjectName("spinMarginLeft") self.gridLayout.addWidget(self.spinMarginLeft, 0, 1, 1, 1) self.label_2 = QtWidgets.QLabel(self.groupBox_2) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.spinMarginRight = QtWidgets.QSpinBox(self.groupBox_2) self.spinMarginRight.setMinimum(10) self.spinMarginRight.setMaximum(500) self.spinMarginRight.setObjectName("spinMarginRight") self.gridLayout.addWidget(self.spinMarginRight, 1, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.groupBox_2) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1) self.spinMarginTop = QtWidgets.QSpinBox(self.groupBox_2) self.spinMarginTop.setMinimum(10) self.spinMarginTop.setMaximum(500) self.spinMarginTop.setObjectName("spinMarginTop") self.gridLayout.addWidget(self.spinMarginTop, 2, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setAlignment(QtCore.Qt.AlignCenter) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1) self.spinMarginBottom = QtWidgets.QSpinBox(self.groupBox_2) self.spinMarginBottom.setMinimum(10) self.spinMarginBottom.setMaximum(500) self.spinMarginBottom.setObjectName("spinMarginBottom") self.gridLayout.addWidget(self.spinMarginBottom, 3, 1, 1, 1) self.btnSetMargin = QtWidgets.QPushButton(self.groupBox_2) self.btnSetMargin.setObjectName("btnSetMargin") self.gridLayout.addWidget(self.btnSetMargin, 4, 0, 1, 2) self.verticalLayout_4.addWidget(self.groupBox_2) self.groupBox_15 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_2) self.groupBox_15.setObjectName("groupBox_15") self.gridLayout_10 = QtWidgets.QGridLayout(self.groupBox_15) self.gridLayout_10.setContentsMargins(11, 11, 11, 11) self.gridLayout_10.setSpacing(6) self.gridLayout_10.setObjectName("gridLayout_10") self.label_6 = QtWidgets.QLabel(self.groupBox_15) self.label_6.setAlignment(QtCore.Qt.AlignCenter) self.label_6.setObjectName("label_6") self.gridLayout_10.addWidget(self.label_6, 0, 0, 1, 1) self.comboAnimation = QtWidgets.QComboBox(self.groupBox_15) self.comboAnimation.setObjectName("comboAnimation") self.comboAnimation.addItem("") self.comboAnimation.addItem("") self.comboAnimation.addItem("") self.comboAnimation.addItem("") self.gridLayout_10.addWidget(self.comboAnimation, 0, 1, 1, 1) self.label_8 = QtWidgets.QLabel(self.groupBox_15) self.label_8.setAlignment(QtCore.Qt.AlignCenter) self.label_8.setObjectName("label_8") self.gridLayout_10.addWidget(self.label_8, 1, 0, 1, 1) self.comboTheme = QtWidgets.QComboBox(self.groupBox_15) self.comboTheme.setObjectName("comboTheme") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.gridLayout_10.addWidget(self.comboTheme, 1, 1, 1, 1) self.verticalLayout_4.addWidget(self.groupBox_15) self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_2) self.verticalLayout_5.addWidget(self.scrollArea_2) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/images/3.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolBox.addItem(self.page, icon, "") self.page_2 = QtWidgets.QWidget() self.page_2.setGeometry(QtCore.QRect(0, 0, 400, 506)) self.page_2.setObjectName("page_2") self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.page_2) self.verticalLayout_10.setContentsMargins(3, 3, 3, 3) self.verticalLayout_10.setSpacing(3) self.verticalLayout_10.setObjectName("verticalLayout_10") self.scrollArea_3 = QtWidgets.QScrollArea(self.page_2) self.scrollArea_3.setWidgetResizable(True) self.scrollArea_3.setObjectName("scrollArea_3") self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() self.scrollAreaWidgetContents_3.setGeometry( QtCore.QRect(0, 0, 392, 498)) self.scrollAreaWidgetContents_3.setObjectName( "scrollAreaWidgetContents_3") self.verticalLayout_9 = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents_3) self.verticalLayout_9.setContentsMargins(11, 11, 11, 11) self.verticalLayout_9.setSpacing(6) self.verticalLayout_9.setObjectName("verticalLayout_9") self.groupBox_12 = QtWidgets.QGroupBox(self.scrollAreaWidgetContents_3) self.groupBox_12.setMaximumSize(QtCore.QSize(16777215, 60)) self.groupBox_12.setObjectName("groupBox_12") self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.groupBox_12) self.horizontalLayout_3.setContentsMargins(11, 11, 11, 11) self.horizontalLayout_3.setSpacing(6) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.radioSeries0 = QtWidgets.QRadioButton(self.groupBox_12) self.radioSeries0.setChecked(True) self.radioSeries0.setObjectName("radioSeries0") self.horizontalLayout_3.addWidget(self.radioSeries0) self.radioSeries1 = QtWidgets.QRadioButton(self.groupBox_12) self.radioSeries1.setObjectName("radioSeries1") self.horizontalLayout_3.addWidget(self.radioSeries1) self.verticalLayout_9.addWidget(self.groupBox_12) self.groupBox_Series = QtWidgets.QGroupBox( self.scrollAreaWidgetContents_3) self.groupBox_Series.setCheckable(True) self.groupBox_Series.setChecked(True) self.groupBox_Series.setObjectName("groupBox_Series") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_Series) self.gridLayout_3.setContentsMargins(11, 11, 11, 11) self.gridLayout_3.setSpacing(6) self.gridLayout_3.setObjectName("gridLayout_3") self.btnSeriesName = QtWidgets.QPushButton(self.groupBox_Series) self.btnSeriesName.setObjectName("btnSeriesName") self.gridLayout_3.addWidget(self.btnSeriesName, 0, 0, 1, 1) self.editSeriesName = QtWidgets.QLineEdit(self.groupBox_Series) self.editSeriesName.setObjectName("editSeriesName") self.gridLayout_3.addWidget(self.editSeriesName, 0, 1, 1, 1) self.btnSeriesColor = QtWidgets.QPushButton(self.groupBox_Series) self.btnSeriesColor.setObjectName("btnSeriesColor") self.gridLayout_3.addWidget(self.btnSeriesColor, 1, 0, 1, 1) self.btnSeriesPen = QtWidgets.QPushButton(self.groupBox_Series) self.btnSeriesPen.setObjectName("btnSeriesPen") self.gridLayout_3.addWidget(self.btnSeriesPen, 1, 1, 1, 1) self.chkkBoxUseOpenGL = QtWidgets.QCheckBox(self.groupBox_Series) self.chkkBoxUseOpenGL.setObjectName("chkkBoxUseOpenGL") self.gridLayout_3.addWidget(self.chkkBoxUseOpenGL, 2, 0, 1, 1) self.chkBoxPointVisible = QtWidgets.QCheckBox(self.groupBox_Series) self.chkBoxPointVisible.setObjectName("chkBoxPointVisible") self.gridLayout_3.addWidget(self.chkBoxPointVisible, 2, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.groupBox_Series) self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setObjectName("label_5") self.gridLayout_3.addWidget(self.label_5, 3, 0, 1, 1) self.sliderOpacity = QtWidgets.QSlider(self.groupBox_Series) self.sliderOpacity.setMaximum(10) self.sliderOpacity.setPageStep(2) self.sliderOpacity.setProperty("value", 10) self.sliderOpacity.setOrientation(QtCore.Qt.Horizontal) self.sliderOpacity.setObjectName("sliderOpacity") self.gridLayout_3.addWidget(self.sliderOpacity, 3, 1, 1, 1) self.verticalLayout_9.addWidget(self.groupBox_Series) self.groupBox_PointLabel = QtWidgets.QGroupBox( self.scrollAreaWidgetContents_3) self.groupBox_PointLabel.setCheckable(True) self.groupBox_PointLabel.setChecked(False) self.groupBox_PointLabel.setObjectName("groupBox_PointLabel") self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.groupBox_PointLabel) self.verticalLayout_7.setContentsMargins(11, 11, 11, 11) self.verticalLayout_7.setSpacing(6) self.verticalLayout_7.setObjectName("verticalLayout_7") self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setSpacing(6) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.btnSeriesLabColor = QtWidgets.QPushButton( self.groupBox_PointLabel) self.btnSeriesLabColor.setObjectName("btnSeriesLabColor") self.horizontalLayout_4.addWidget(self.btnSeriesLabColor) self.btnSeriesLabFont = QtWidgets.QPushButton(self.groupBox_PointLabel) self.btnSeriesLabFont.setObjectName("btnSeriesLabFont") self.horizontalLayout_4.addWidget(self.btnSeriesLabFont) self.verticalLayout_7.addLayout(self.horizontalLayout_4) self.groupBox_14 = QtWidgets.QGroupBox(self.groupBox_PointLabel) self.groupBox_14.setObjectName("groupBox_14") self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.groupBox_14) self.verticalLayout_6.setContentsMargins(11, 11, 11, 11) self.verticalLayout_6.setSpacing(6) self.verticalLayout_6.setObjectName("verticalLayout_6") self.radioSeriesLabFormat0 = QtWidgets.QRadioButton(self.groupBox_14) self.radioSeriesLabFormat0.setChecked(True) self.radioSeriesLabFormat0.setObjectName("radioSeriesLabFormat0") self.verticalLayout_6.addWidget(self.radioSeriesLabFormat0) self.radioSeriesLabFormat1 = QtWidgets.QRadioButton(self.groupBox_14) self.radioSeriesLabFormat1.setObjectName("radioSeriesLabFormat1") self.verticalLayout_6.addWidget(self.radioSeriesLabFormat1) self.verticalLayout_7.addWidget(self.groupBox_14) self.verticalLayout_9.addWidget(self.groupBox_PointLabel) self.scrollArea_3.setWidget(self.scrollAreaWidgetContents_3) self.verticalLayout_10.addWidget(self.scrollArea_3) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/icons/images/dis3.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolBox.addItem(self.page_2, icon1, "") self.page_3 = QtWidgets.QWidget() self.page_3.setGeometry(QtCore.QRect(0, 0, 400, 506)) self.page_3.setObjectName("page_3") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.page_3) self.verticalLayout_3.setContentsMargins(3, 3, 3, 3) self.verticalLayout_3.setSpacing(3) self.verticalLayout_3.setObjectName("verticalLayout_3") self.scrollArea = QtWidgets.QScrollArea(self.page_3) self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents = QtWidgets.QWidget() self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 375, 600)) self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.verticalLayout_8 = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents) self.verticalLayout_8.setContentsMargins(11, 11, 11, 11) self.verticalLayout_8.setSpacing(6) self.verticalLayout_8.setObjectName("verticalLayout_8") self.groupBox_SelectAxis = QtWidgets.QGroupBox( self.scrollAreaWidgetContents) self.groupBox_SelectAxis.setMaximumSize(QtCore.QSize(16777215, 50)) self.groupBox_SelectAxis.setObjectName("groupBox_SelectAxis") self.horizontalLayout_2 = QtWidgets.QHBoxLayout( self.groupBox_SelectAxis) self.horizontalLayout_2.setContentsMargins(11, 11, 11, 11) self.horizontalLayout_2.setSpacing(6) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.radioAxisX = QtWidgets.QRadioButton(self.groupBox_SelectAxis) self.radioAxisX.setChecked(True) self.radioAxisX.setObjectName("radioAxisX") self.horizontalLayout_2.addWidget(self.radioAxisX) self.radioAxisY = QtWidgets.QRadioButton(self.groupBox_SelectAxis) self.radioAxisY.setChecked(False) self.radioAxisY.setObjectName("radioAxisY") self.horizontalLayout_2.addWidget(self.radioAxisY) self.verticalLayout_8.addWidget(self.groupBox_SelectAxis) self.groupBox_Axis = QtWidgets.QGroupBox(self.scrollAreaWidgetContents) self.groupBox_Axis.setFlat(True) self.groupBox_Axis.setCheckable(True) self.groupBox_Axis.setObjectName("groupBox_Axis") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_Axis) self.verticalLayout_2.setContentsMargins(0, 11, 0, 11) self.verticalLayout_2.setSpacing(6) self.verticalLayout_2.setObjectName("verticalLayout_2") self.frame = QtWidgets.QFrame(self.groupBox_Axis) self.frame.setFrameShape(QtWidgets.QFrame.Panel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.gridLayout_4 = QtWidgets.QGridLayout(self.frame) self.gridLayout_4.setContentsMargins(11, 11, 11, 11) self.gridLayout_4.setSpacing(6) self.gridLayout_4.setObjectName("gridLayout_4") self.label_7 = QtWidgets.QLabel(self.frame) self.label_7.setObjectName("label_7") self.gridLayout_4.addWidget(self.label_7, 0, 0, 1, 1) self.spinAxisMin = QtWidgets.QDoubleSpinBox(self.frame) self.spinAxisMin.setMinimum(-1000.0) self.spinAxisMin.setMaximum(1000.0) self.spinAxisMin.setObjectName("spinAxisMin") self.gridLayout_4.addWidget(self.spinAxisMin, 0, 1, 1, 1) self.label_11 = QtWidgets.QLabel(self.frame) self.label_11.setObjectName("label_11") self.gridLayout_4.addWidget(self.label_11, 1, 0, 1, 1) self.spinAxisMax = QtWidgets.QDoubleSpinBox(self.frame) self.spinAxisMax.setMinimum(-1000.0) self.spinAxisMax.setMaximum(1000.0) self.spinAxisMax.setProperty("value", 10.0) self.spinAxisMax.setObjectName("spinAxisMax") self.gridLayout_4.addWidget(self.spinAxisMax, 1, 1, 1, 1) self.btnSetAxisRange = QtWidgets.QPushButton(self.frame) self.btnSetAxisRange.setObjectName("btnSetAxisRange") self.gridLayout_4.addWidget(self.btnSetAxisRange, 1, 2, 1, 1) self.chkBoxAxisReverse = QtWidgets.QCheckBox(self.frame) self.chkBoxAxisReverse.setObjectName("chkBoxAxisReverse") self.gridLayout_4.addWidget(self.chkBoxAxisReverse, 0, 2, 1, 1) self.verticalLayout_2.addWidget(self.frame) self.groupBox_AxisTitle = QtWidgets.QGroupBox(self.groupBox_Axis) self.groupBox_AxisTitle.setCheckable(True) self.groupBox_AxisTitle.setObjectName("groupBox_AxisTitle") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_AxisTitle) self.gridLayout_2.setContentsMargins(11, 11, 11, 11) self.gridLayout_2.setSpacing(6) self.gridLayout_2.setObjectName("gridLayout_2") self.btnAxisSetTitle = QtWidgets.QPushButton(self.groupBox_AxisTitle) self.btnAxisSetTitle.setObjectName("btnAxisSetTitle") self.gridLayout_2.addWidget(self.btnAxisSetTitle, 0, 0, 1, 1) self.editAxisTitle = QtWidgets.QLineEdit(self.groupBox_AxisTitle) self.editAxisTitle.setObjectName("editAxisTitle") self.gridLayout_2.addWidget(self.editAxisTitle, 0, 1, 1, 1) self.btnAxisTitleColor = QtWidgets.QPushButton(self.groupBox_AxisTitle) self.btnAxisTitleColor.setObjectName("btnAxisTitleColor") self.gridLayout_2.addWidget(self.btnAxisTitleColor, 1, 0, 1, 1) self.btnAxisTitleFont = QtWidgets.QPushButton(self.groupBox_AxisTitle) self.btnAxisTitleFont.setObjectName("btnAxisTitleFont") self.gridLayout_2.addWidget(self.btnAxisTitleFont, 1, 1, 1, 1) self.verticalLayout_2.addWidget(self.groupBox_AxisTitle) self.groupBox_AxisLabel = QtWidgets.QGroupBox(self.groupBox_Axis) self.groupBox_AxisLabel.setCheckable(True) self.groupBox_AxisLabel.setObjectName("groupBox_AxisLabel") self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_AxisLabel) self.gridLayout_6.setContentsMargins(11, 11, 11, 11) self.gridLayout_6.setSpacing(6) self.gridLayout_6.setObjectName("gridLayout_6") self.btnAxisLabelFormat = QtWidgets.QPushButton( self.groupBox_AxisLabel) self.btnAxisLabelFormat.setObjectName("btnAxisLabelFormat") self.gridLayout_6.addWidget(self.btnAxisLabelFormat, 0, 0, 1, 1) self.editAxisLabelFormat = QtWidgets.QLineEdit(self.groupBox_AxisLabel) self.editAxisLabelFormat.setObjectName("editAxisLabelFormat") self.gridLayout_6.addWidget(self.editAxisLabelFormat, 0, 1, 1, 1) self.btnAxisLabelColor = QtWidgets.QPushButton(self.groupBox_AxisLabel) self.btnAxisLabelColor.setObjectName("btnAxisLabelColor") self.gridLayout_6.addWidget(self.btnAxisLabelColor, 1, 0, 1, 1) self.btnAxisLabelFont = QtWidgets.QPushButton(self.groupBox_AxisLabel) self.btnAxisLabelFont.setMinimumSize(QtCore.QSize(0, 24)) self.btnAxisLabelFont.setObjectName("btnAxisLabelFont") self.gridLayout_6.addWidget(self.btnAxisLabelFont, 1, 1, 1, 1) self.verticalLayout_2.addWidget(self.groupBox_AxisLabel) self.groupBox_Ticks = QtWidgets.QGroupBox(self.groupBox_Axis) self.groupBox_Ticks.setCheckable(True) self.groupBox_Ticks.setObjectName("groupBox_Ticks") self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Ticks) self.gridLayout_5.setContentsMargins(11, 11, 11, 11) self.gridLayout_5.setSpacing(6) self.gridLayout_5.setObjectName("gridLayout_5") self.label_9 = QtWidgets.QLabel(self.groupBox_Ticks) self.label_9.setAlignment(QtCore.Qt.AlignCenter) self.label_9.setObjectName("label_9") self.gridLayout_5.addWidget(self.label_9, 0, 0, 1, 1) self.spinTickCount = QtWidgets.QSpinBox(self.groupBox_Ticks) self.spinTickCount.setMinimum(1) self.spinTickCount.setMaximum(1000) self.spinTickCount.setProperty("value", 10) self.spinTickCount.setObjectName("spinTickCount") self.gridLayout_5.addWidget(self.spinTickCount, 0, 1, 1, 1) self.btnAxisLinePen = QtWidgets.QPushButton(self.groupBox_Ticks) self.btnAxisLinePen.setObjectName("btnAxisLinePen") self.gridLayout_5.addWidget(self.btnAxisLinePen, 1, 0, 1, 1) self.btnAxisLinePenColor = QtWidgets.QPushButton(self.groupBox_Ticks) self.btnAxisLinePenColor.setObjectName("btnAxisLinePenColor") self.gridLayout_5.addWidget(self.btnAxisLinePenColor, 1, 1, 1, 1) self.verticalLayout_2.addWidget(self.groupBox_Ticks) self.groupBox_GridLine = QtWidgets.QGroupBox(self.groupBox_Axis) self.groupBox_GridLine.setCheckable(True) self.groupBox_GridLine.setObjectName("groupBox_GridLine") self.horizontalLayout_5 = QtWidgets.QHBoxLayout(self.groupBox_GridLine) self.horizontalLayout_5.setContentsMargins(11, 11, 11, 11) self.horizontalLayout_5.setSpacing(6) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.btnGridLinePen = QtWidgets.QPushButton(self.groupBox_GridLine) self.btnGridLinePen.setObjectName("btnGridLinePen") self.horizontalLayout_5.addWidget(self.btnGridLinePen) self.btnGridLineColor = QtWidgets.QPushButton(self.groupBox_GridLine) self.btnGridLineColor.setObjectName("btnGridLineColor") self.horizontalLayout_5.addWidget(self.btnGridLineColor) self.verticalLayout_2.addWidget(self.groupBox_GridLine) self.groupBox_MinorGrid = QtWidgets.QGroupBox(self.groupBox_Axis) self.groupBox_MinorGrid.setCheckable(True) self.groupBox_MinorGrid.setObjectName("groupBox_MinorGrid") self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_MinorGrid) self.gridLayout_8.setContentsMargins(11, 11, 11, 11) self.gridLayout_8.setSpacing(6) self.gridLayout_8.setObjectName("gridLayout_8") self.label_10 = QtWidgets.QLabel(self.groupBox_MinorGrid) self.label_10.setAlignment(QtCore.Qt.AlignCenter) self.label_10.setObjectName("label_10") self.gridLayout_8.addWidget(self.label_10, 0, 0, 1, 1) self.spinMinorTickCount = QtWidgets.QSpinBox(self.groupBox_MinorGrid) self.spinMinorTickCount.setProperty("value", 4) self.spinMinorTickCount.setObjectName("spinMinorTickCount") self.gridLayout_8.addWidget(self.spinMinorTickCount, 0, 1, 1, 1) self.btnMinorPen = QtWidgets.QPushButton(self.groupBox_MinorGrid) self.btnMinorPen.setObjectName("btnMinorPen") self.gridLayout_8.addWidget(self.btnMinorPen, 1, 0, 1, 1) self.btnMinorColor = QtWidgets.QPushButton(self.groupBox_MinorGrid) self.btnMinorColor.setObjectName("btnMinorColor") self.gridLayout_8.addWidget(self.btnMinorColor, 1, 1, 1, 1) self.verticalLayout_2.addWidget(self.groupBox_MinorGrid) self.verticalLayout_8.addWidget(self.groupBox_Axis) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.verticalLayout_3.addWidget(self.scrollArea) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/icons/images/39.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolBox.addItem(self.page_3, icon2, "") self.frame_chart = QtWidgets.QFrame(self.splitter) self.frame_chart.setFrameShape(QtWidgets.QFrame.Panel) self.frame_chart.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_chart.setObjectName("frame_chart") self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_chart) self.verticalLayout.setContentsMargins(2, 2, 2, 2) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName("verticalLayout") self.chartView = QChartView(self.frame_chart) self.chartView.setObjectName("chartView") self.verticalLayout.addWidget(self.chartView) MainWindow.setCentralWidget(self.centralWidget) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.actDraw = QtWidgets.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/icons/images/828.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actDraw.setIcon(icon3) self.actDraw.setObjectName("actDraw") self.actQuit = QtWidgets.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/icons/images/132.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actQuit.setIcon(icon4) self.actQuit.setObjectName("actQuit") self.actZoomIn = QtWidgets.QAction(MainWindow) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/icons/images/418.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomIn.setIcon(icon5) self.actZoomIn.setObjectName("actZoomIn") self.actZoomOut = QtWidgets.QAction(MainWindow) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap(":/icons/images/416.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomOut.setIcon(icon6) self.actZoomOut.setObjectName("actZoomOut") self.actZoomReset = QtWidgets.QAction(MainWindow) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap(":/icons/images/414.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomReset.setIcon(icon7) self.actZoomReset.setObjectName("actZoomReset") self.mainToolBar.addAction(self.actDraw) self.mainToolBar.addAction(self.actQuit) self.retranslateUi(MainWindow) self.toolBox.setCurrentIndex(2) self.actQuit.triggered.connect(MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "QChart绘图详细功能")) self.groupBox.setTitle(_translate("MainWindow", "标题")) self.btnTitleSetText.setToolTip(_translate("MainWindow", "设置标题文字")) self.btnTitleSetText.setText(_translate("MainWindow", "设置标题")) self.editTitle.setText(_translate("MainWindow", "简单函数曲线")) self.btnTitleColor.setText(_translate("MainWindow", "标题文字颜色")) self.btnTitleFont.setText(_translate("MainWindow", "标题字体")) self.groupBox_Legend.setTitle(_translate("MainWindow", "图例")) self.radioButton.setText(_translate("MainWindow", "上方")) self.radioButton_2.setText(_translate("MainWindow", "下方")) self.radioButton_3.setText(_translate("MainWindow", "左侧")) self.radioButton_4.setText(_translate("MainWindow", "右侧")) self.btnLegendlabelColor.setText(_translate("MainWindow", "文字颜色")) self.btnLegendFont.setText(_translate("MainWindow", "图例字体")) self.groupBox_2.setTitle(_translate("MainWindow", "边距")) self.label.setText(_translate("MainWindow", "左边距")) self.label_2.setText(_translate("MainWindow", "右边距")) self.label_3.setText(_translate("MainWindow", "上边距")) self.label_4.setText(_translate("MainWindow", "下边距")) self.btnSetMargin.setText(_translate("MainWindow", "设置边距")) self.groupBox_15.setTitle(_translate("MainWindow", "动画效果")) self.label_6.setText(_translate("MainWindow", "动画效果")) self.comboAnimation.setItemText( 0, _translate("MainWindow", "NoAnimation")) self.comboAnimation.setItemText( 1, _translate("MainWindow", "GridAxisAnimations")) self.comboAnimation.setItemText( 2, _translate("MainWindow", "SeriesAnimations")) self.comboAnimation.setItemText( 3, _translate("MainWindow", "AllAnimations")) self.label_8.setText(_translate("MainWindow", "主 题")) self.comboTheme.setItemText(0, _translate("MainWindow", "Light")) self.comboTheme.setItemText(1, _translate("MainWindow", "BlueCerulean")) self.comboTheme.setItemText(2, _translate("MainWindow", "Dark")) self.comboTheme.setItemText(3, _translate("MainWindow", "BrownSand")) self.comboTheme.setItemText(4, _translate("MainWindow", "BlueNcs")) self.comboTheme.setItemText(5, _translate("MainWindow", "HighContrast")) self.comboTheme.setItemText(6, _translate("MainWindow", "BlueIcy")) self.comboTheme.setItemText(7, _translate("MainWindow", "Qt")) self.toolBox.setItemText(self.toolBox.indexOf(self.page), _translate("MainWindow", "图表设置")) self.groupBox_12.setTitle(_translate("MainWindow", "选择操作序列")) self.radioSeries0.setText(_translate("MainWindow", "Sin曲线")) self.radioSeries1.setText(_translate("MainWindow", "Cos曲线")) self.groupBox_Series.setTitle(_translate("MainWindow", "序列曲线")) self.btnSeriesName.setText(_translate("MainWindow", "序列名称")) self.editSeriesName.setText(_translate("MainWindow", "Sin曲线")) self.btnSeriesColor.setText(_translate("MainWindow", "曲线颜色")) self.btnSeriesPen.setText(_translate("MainWindow", "曲线Pen")) self.chkkBoxUseOpenGL.setToolTip( _translate("MainWindow", "使用openGL后不能设置线型,不能显示数据点")) self.chkkBoxUseOpenGL.setText(_translate("MainWindow", "使用openGL")) self.chkBoxPointVisible.setText(_translate("MainWindow", "数据点可见")) self.label_5.setText(_translate("MainWindow", "透明度")) self.groupBox_PointLabel.setTitle(_translate("MainWindow", "数据点标签")) self.btnSeriesLabColor.setText(_translate("MainWindow", "标签颜色")) self.btnSeriesLabFont.setText(_translate("MainWindow", "标签字体")) self.groupBox_14.setTitle(_translate("MainWindow", "标签格式")) self.radioSeriesLabFormat0.setText(_translate("MainWindow", "@yPoint")) self.radioSeriesLabFormat1.setText( _translate("MainWindow", "(@xPoint, @yPoint)")) self.toolBox.setItemText(self.toolBox.indexOf(self.page_2), _translate("MainWindow", "曲线设置")) self.groupBox_SelectAxis.setTitle( _translate("MainWindow", "选择操作的坐标轴对象")) self.radioAxisX.setText(_translate("MainWindow", "X轴")) self.radioAxisY.setText(_translate("MainWindow", "Y轴")) self.groupBox_Axis.setTitle( _translate("MainWindow", "坐标轴(setVisible())")) self.label_7.setText(_translate("MainWindow", "最小值")) self.label_11.setText(_translate("MainWindow", "最大值")) self.btnSetAxisRange.setText(_translate("MainWindow", "设置坐标范围")) self.chkBoxAxisReverse.setText(_translate("MainWindow", "坐标反向")) self.groupBox_AxisTitle.setTitle( _translate("MainWindow", "轴标题(setTitleVisible())")) self.btnAxisSetTitle.setText(_translate("MainWindow", "设置轴标题")) self.editAxisTitle.setText(_translate("MainWindow", "time(secs)")) self.btnAxisTitleColor.setText(_translate("MainWindow", "文字颜色")) self.btnAxisTitleFont.setText(_translate("MainWindow", "设置字体")) self.groupBox_AxisLabel.setTitle( _translate("MainWindow", "轴刻度标签(setLabelsVisible())")) self.btnAxisLabelFormat.setText(_translate("MainWindow", "设置标签格式")) self.editAxisLabelFormat.setText(_translate("MainWindow", "%.1f")) self.btnAxisLabelColor.setText(_translate("MainWindow", "文字颜色")) self.btnAxisLabelFont.setText(_translate("MainWindow", "设置字体")) self.groupBox_Ticks.setTitle( _translate("MainWindow", "轴线和主刻度(setLineVisible())")) self.label_9.setText(_translate("MainWindow", "Tick个数")) self.btnAxisLinePen.setText(_translate("MainWindow", "线条Pen")) self.btnAxisLinePenColor.setText(_translate("MainWindow", "线条颜色")) self.groupBox_GridLine.setTitle( _translate("MainWindow", "主网格线(setGridLineVisible())")) self.btnGridLinePen.setText(_translate("MainWindow", "线条Pen")) self.btnGridLineColor.setText(_translate("MainWindow", "线条颜色")) self.groupBox_MinorGrid.setTitle( _translate("MainWindow", "次网格线(setMinorGridLineVisible())")) self.label_10.setText(_translate("MainWindow", "MinorTick个数")) self.btnMinorPen.setText(_translate("MainWindow", "线条Pen")) self.btnMinorColor.setText(_translate("MainWindow", "线条颜色")) self.toolBox.setItemText(self.toolBox.indexOf(self.page_3), _translate("MainWindow", "坐标轴设置")) self.actDraw.setText(_translate("MainWindow", "刷新绘图")) self.actDraw.setToolTip(_translate("MainWindow", "刷新绘图")) self.actQuit.setText(_translate("MainWindow", "退出")) self.actQuit.setToolTip(_translate("MainWindow", "退出")) self.actZoomIn.setText(_translate("MainWindow", "放大")) self.actZoomIn.setToolTip(_translate("MainWindow", "放大")) self.actZoomOut.setText(_translate("MainWindow", "缩小")) self.actZoomOut.setToolTip(_translate("MainWindow", "缩小")) self.actZoomReset.setText(_translate("MainWindow", "原始大小")) self.actZoomReset.setToolTip(_translate("MainWindow", "还原为原始大小"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 880) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(0, 640)) MainWindow.setAutoFillBackground(True) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.main_frame = QtWidgets.QFrame(self.centralwidget) self.main_frame.setObjectName("main_frame") self.gridLayout_7 = QtWidgets.QGridLayout(self.main_frame) self.gridLayout_7.setObjectName("gridLayout_7") self.data_display_group = QtWidgets.QGroupBox(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.data_display_group.sizePolicy().hasHeightForWidth()) self.data_display_group.setSizePolicy(sizePolicy) self.data_display_group.setObjectName("data_display_group") self.gridLayout_2 = QtWidgets.QGridLayout(self.data_display_group) self.gridLayout_2.setObjectName("gridLayout_2") self.sweep_value = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.sweep_value.setFont(font) self.sweep_value.setScaledContents(False) self.sweep_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.sweep_value.setObjectName("sweep_value") self.gridLayout_2.addWidget(self.sweep_value, 5, 2, 1, 1) self.channelA_value = QtWidgets.QLabel(self.data_display_group) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) self.channelA_value.setPalette(palette) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.channelA_value.setFont(font) self.channelA_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.channelA_value.setObjectName("channelA_value") self.gridLayout_2.addWidget(self.channelA_value, 3, 1, 1, 2) self.channelB_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setPointSize(20) self.channelB_label.setFont(font) self.channelB_label.setObjectName("channelB_label") self.gridLayout_2.addWidget(self.channelB_label, 4, 0, 1, 1) self.channelB_value = QtWidgets.QLabel(self.data_display_group) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) self.channelB_value.setPalette(palette) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.channelB_value.setFont(font) self.channelB_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.channelB_value.setObjectName("channelB_value") self.gridLayout_2.addWidget(self.channelB_value, 4, 1, 1, 2) self.dec_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setPointSize(20) self.dec_label.setFont(font) self.dec_label.setObjectName("dec_label") self.gridLayout_2.addWidget(self.dec_label, 2, 0, 1, 1) self.dec_value = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.dec_value.setFont(font) self.dec_value.setScaledContents(False) self.dec_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.dec_value.setObjectName("dec_value") self.gridLayout_2.addWidget(self.dec_value, 2, 1, 1, 2) self.ra_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setPointSize(20) self.ra_label.setFont(font) self.ra_label.setObjectName("ra_label") self.gridLayout_2.addWidget(self.ra_label, 1, 0, 1, 1) self.ra_value = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.ra_value.setFont(font) self.ra_value.setScaledContents(False) self.ra_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.ra_value.setObjectName("ra_value") self.gridLayout_2.addWidget(self.ra_value, 1, 1, 1, 2) self.sweep_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setPointSize(20) self.sweep_label.setFont(font) self.sweep_label.setObjectName("sweep_label") self.gridLayout_2.addWidget(self.sweep_label, 5, 0, 1, 1) self.channelA_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setPointSize(20) self.channelA_label.setFont(font) self.channelA_label.setObjectName("channelA_label") self.gridLayout_2.addWidget(self.channelA_label, 3, 0, 1, 1) self.gridLayout_7.addWidget(self.data_display_group, 1, 0, 1, 1) self.stripchart_control_group = QtWidgets.QGroupBox(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.stripchart_control_group.sizePolicy().hasHeightForWidth()) self.stripchart_control_group.setSizePolicy(sizePolicy) self.stripchart_control_group.setObjectName("stripchart_control_group") self.gridLayout_4 = QtWidgets.QGridLayout( self.stripchart_control_group) self.gridLayout_4.setObjectName("gridLayout_4") self.frame_2 = QtWidgets.QFrame(self.stripchart_control_group) self.frame_2.setObjectName("frame_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.frame_2) self.gridLayout_3.setContentsMargins(-1, 0, -1, 0) self.gridLayout_3.setObjectName("gridLayout_3") self.stripchart_faster_label = QtWidgets.QLabel(self.frame_2) self.stripchart_faster_label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.stripchart_faster_label.setObjectName("stripchart_faster_label") self.gridLayout_3.addWidget(self.stripchart_faster_label, 0, 2, 1, 1) self.stripchart_speed_slider = QtWidgets.QSlider(self.frame_2) self.stripchart_speed_slider.setMaximum(6) self.stripchart_speed_slider.setProperty("value", 3) self.stripchart_speed_slider.setOrientation(QtCore.Qt.Horizontal) self.stripchart_speed_slider.setTickPosition( QtWidgets.QSlider.TicksBothSides) self.stripchart_speed_slider.setTickInterval(1) self.stripchart_speed_slider.setObjectName("stripchart_speed_slider") self.gridLayout_3.addWidget(self.stripchart_speed_slider, 0, 1, 1, 1) self.stripchart_slower_label = QtWidgets.QLabel(self.frame_2) self.stripchart_slower_label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.stripchart_slower_label.setObjectName("stripchart_slower_label") self.gridLayout_3.addWidget(self.stripchart_slower_label, 0, 0, 1, 1) self.gridLayout_4.addWidget(self.frame_2, 0, 0, 1, 4) self.frame = QtWidgets.QFrame(self.stripchart_control_group) self.frame.setObjectName("frame") self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.toggle_channel_button = QtWidgets.QPushButton(self.frame) self.toggle_channel_button.setObjectName("toggle_channel_button") self.horizontalLayout.addWidget(self.toggle_channel_button) self.chart_clear_button = QtWidgets.QPushButton(self.frame) self.chart_clear_button.setObjectName("chart_clear_button") self.horizontalLayout.addWidget(self.chart_clear_button) self.gridLayout_4.addWidget(self.frame, 3, 0, 1, 4) self.gridLayout_7.addWidget(self.stripchart_control_group, 2, 0, 1, 1) self.message_group_box = QtWidgets.QGroupBox(self.main_frame) self.message_group_box.setObjectName("message_group_box") self.gridLayout_5 = QtWidgets.QGridLayout(self.message_group_box) self.gridLayout_5.setObjectName("gridLayout_5") self.refresh_label = QtWidgets.QLabel(self.message_group_box) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.refresh_label.sizePolicy().hasHeightForWidth()) self.refresh_label.setSizePolicy(sizePolicy) self.refresh_label.setStyleSheet("color: #7a7c7e") self.refresh_label.setObjectName("refresh_label") self.gridLayout_5.addWidget(self.refresh_label, 2, 0, 1, 1) self.refresh_value = QtWidgets.QLabel(self.message_group_box) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.refresh_value.sizePolicy().hasHeightForWidth()) self.refresh_value.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setBold(True) font.setWeight(75) self.refresh_value.setFont(font) self.refresh_value.setStyleSheet("color: #7a7c7e") self.refresh_value.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.refresh_value.setObjectName("refresh_value") self.gridLayout_5.addWidget(self.refresh_value, 2, 1, 1, 1) self.progressBar = QtWidgets.QProgressBar(self.message_group_box) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.progressBar.sizePolicy().hasHeightForWidth()) self.progressBar.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(16) self.progressBar.setFont(font) self.progressBar.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.progressBar.setInvertedAppearance(False) self.progressBar.setObjectName("progressBar") self.gridLayout_5.addWidget(self.progressBar, 1, 0, 1, 2) self.message_label = QtWidgets.QLabel(self.message_group_box) font = QtGui.QFont() font.setPointSize(20) self.message_label.setFont(font) self.message_label.setObjectName("message_label") self.gridLayout_5.addWidget(self.message_label, 0, 0, 1, 2) self.gridLayout_7.addWidget(self.message_group_box, 0, 0, 1, 1) self.console_background = QtWidgets.QFrame(self.main_frame) self.console_background.setObjectName("console_background") self.gridLayout_11 = QtWidgets.QGridLayout(self.console_background) self.gridLayout_11.setContentsMargins(0, -1, 0, -1) self.gridLayout_11.setObjectName("gridLayout_11") self.console_inner_frame_2 = QtWidgets.QFrame(self.console_background) self.console_inner_frame_2.setStyleSheet( "background: black; border-radius: 5px") self.console_inner_frame_2.setObjectName("console_inner_frame_2") self.gridLayout_12 = QtWidgets.QGridLayout(self.console_inner_frame_2) self.gridLayout_12.setObjectName("gridLayout_12") self.console_label = QtWidgets.QLabel(self.console_inner_frame_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.console_label.sizePolicy().hasHeightForWidth()) self.console_label.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(10) font.setBold(True) font.setWeight(75) self.console_label.setFont(font) self.console_label.setStyleSheet("color: #0f0") self.console_label.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft) self.console_label.setObjectName("console_label") self.gridLayout_12.addWidget(self.console_label, 0, 0, 1, 1) self.dec_view = QtWidgets.QGraphicsView(self.console_inner_frame_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dec_view.sizePolicy().hasHeightForWidth()) self.dec_view.setSizePolicy(sizePolicy) self.dec_view.setStyleSheet("background: transparent") self.dec_view.setFrameShape(QtWidgets.QFrame.NoFrame) self.dec_view.setFrameShadow(QtWidgets.QFrame.Plain) self.dec_view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.dec_view.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.dec_view.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing) self.dec_view.setObjectName("dec_view") self.gridLayout_12.addWidget(self.dec_view, 0, 1, 1, 1) self.gridLayout_11.addWidget(self.console_inner_frame_2, 0, 0, 1, 1) self.gridLayout_7.addWidget(self.console_background, 3, 0, 1, 1) self.output_frame = QtWidgets.QFrame(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.output_frame.sizePolicy().hasHeightForWidth()) self.output_frame.setSizePolicy(sizePolicy) self.output_frame.setMinimumSize(QtCore.QSize(360, 0)) self.output_frame.setObjectName("output_frame") self.gridLayout_10 = QtWidgets.QGridLayout(self.output_frame) self.gridLayout_10.setContentsMargins(0, 0, 0, 0) self.gridLayout_10.setObjectName("gridLayout_10") self.stripchart = QChartView(self.output_frame) self.stripchart.setFrameShape(QtWidgets.QFrame.NoFrame) self.stripchart.setFrameShadow(QtWidgets.QFrame.Plain) self.stripchart.setObjectName("stripchart") self.gridLayout_10.addWidget(self.stripchart, 0, 0, 2, 2) self.gridLayout_7.addWidget(self.output_frame, 0, 1, 4, 1) self.gridLayout.addWidget(self.main_frame, 0, 0, 1, 1) self.testing_frame = QtWidgets.QFrame(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.testing_frame.sizePolicy().hasHeightForWidth()) self.testing_frame.setSizePolicy(sizePolicy) self.testing_frame.setMinimumSize(QtCore.QSize(0, 180)) self.testing_frame.setObjectName("testing_frame") self.gridLayout_8 = QtWidgets.QGridLayout(self.testing_frame) self.gridLayout_8.setContentsMargins(-1, 0, -1, -1) self.gridLayout_8.setObjectName("gridLayout_8") self.dec_group_box = QtWidgets.QGroupBox(self.testing_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.dec_group_box.sizePolicy().hasHeightForWidth()) self.dec_group_box.setSizePolicy(sizePolicy) self.dec_group_box.setObjectName("dec_group_box") self.gridLayout_9 = QtWidgets.QGridLayout(self.dec_group_box) self.gridLayout_9.setObjectName("gridLayout_9") self.north_label = QtWidgets.QLabel(self.dec_group_box) self.north_label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.north_label.setObjectName("north_label") self.gridLayout_9.addWidget(self.north_label, 0, 1, 1, 1) self.south_label = QtWidgets.QLabel(self.dec_group_box) self.south_label.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft) self.south_label.setObjectName("south_label") self.gridLayout_9.addWidget(self.south_label, 1, 1, 1, 1) self.declination_slider = QtWidgets.QSlider(self.dec_group_box) self.declination_slider.setMinimum(-99) self.declination_slider.setMaximum(99) self.declination_slider.setSingleStep(1) self.declination_slider.setProperty("value", 0) self.declination_slider.setTickInterval(20) self.declination_slider.setObjectName("declination_slider") self.gridLayout_9.addWidget(self.declination_slider, 0, 0, 2, 1) self.dec_auto_check_box = QtWidgets.QCheckBox(self.dec_group_box) self.dec_auto_check_box.setChecked(True) self.dec_auto_check_box.setObjectName("dec_auto_check_box") self.gridLayout_9.addWidget(self.dec_auto_check_box, 2, 0, 1, 2) self.gridLayout_8.addWidget(self.dec_group_box, 0, 1, 1, 1) self.signal_group_box = QtWidgets.QGroupBox(self.testing_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.signal_group_box.sizePolicy().hasHeightForWidth()) self.signal_group_box.setSizePolicy(sizePolicy) self.signal_group_box.setObjectName("signal_group_box") self.gridLayout_6 = QtWidgets.QGridLayout(self.signal_group_box) self.gridLayout_6.setObjectName("gridLayout_6") self.variance_dial = QtWidgets.QDial(self.signal_group_box) self.variance_dial.setMinimum(0) self.variance_dial.setMaximum(16) self.variance_dial.setPageStep(4) self.variance_dial.setProperty("value", 4) self.variance_dial.setWrapping(False) self.variance_dial.setNotchTarget(1.0) self.variance_dial.setNotchesVisible(True) self.variance_dial.setObjectName("variance_dial") self.gridLayout_6.addWidget(self.variance_dial, 1, 0, 1, 1) self.variance_label = QtWidgets.QLabel(self.signal_group_box) self.variance_label.setAlignment(QtCore.Qt.AlignCenter) self.variance_label.setObjectName("variance_label") self.gridLayout_6.addWidget(self.variance_label, 3, 0, 1, 1) self.noise_label = QtWidgets.QLabel(self.signal_group_box) self.noise_label.setAlignment(QtCore.Qt.AlignCenter) self.noise_label.setObjectName("noise_label") self.gridLayout_6.addWidget(self.noise_label, 3, 3, 1, 1) self.polarization_label = QtWidgets.QLabel(self.signal_group_box) self.polarization_label.setAlignment(QtCore.Qt.AlignCenter) self.polarization_label.setObjectName("polarization_label") self.gridLayout_6.addWidget(self.polarization_label, 3, 2, 1, 1) self.polarization_dial = QtWidgets.QDial(self.signal_group_box) self.polarization_dial.setMinimum(0) self.polarization_dial.setMaximum(16) self.polarization_dial.setPageStep(4) self.polarization_dial.setProperty("value", 4) self.polarization_dial.setWrapping(False) self.polarization_dial.setNotchTarget(1.0) self.polarization_dial.setNotchesVisible(True) self.polarization_dial.setObjectName("polarization_dial") self.gridLayout_6.addWidget(self.polarization_dial, 1, 2, 1, 1) self.noise_dial = QtWidgets.QDial(self.signal_group_box) self.noise_dial.setMinimum(0) self.noise_dial.setMaximum(16) self.noise_dial.setPageStep(4) self.noise_dial.setProperty("value", 4) self.noise_dial.setWrapping(False) self.noise_dial.setNotchTarget(1.0) self.noise_dial.setNotchesVisible(True) self.noise_dial.setObjectName("noise_dial") self.gridLayout_6.addWidget(self.noise_dial, 1, 3, 1, 1) self.calibration_check_box = QtWidgets.QCheckBox(self.signal_group_box) self.calibration_check_box.setObjectName("calibration_check_box") self.gridLayout_6.addWidget(self.calibration_check_box, 1, 4, 3, 1) self.gridLayout_8.addWidget(self.signal_group_box, 0, 0, 1, 1) self.gridLayout.addWidget(self.testing_frame, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 43)) self.menubar.setObjectName("menubar") self.menuCalibration = QtWidgets.QMenu(self.menubar) self.menuCalibration.setObjectName("menuCalibration") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuMode = QtWidgets.QMenu(self.menubar) self.menuMode.setObjectName("menuMode") self.menuObservation = QtWidgets.QMenu(self.menubar) self.menuObservation.setObjectName("menuObservation") MainWindow.setMenuBar(self.menubar) self.actionRA = QtWidgets.QAction(MainWindow) self.actionRA.setObjectName("actionRA") self.actionDec = QtWidgets.QAction(MainWindow) self.actionDec.setObjectName("actionDec") self.actionSurvey = QtWidgets.QAction(MainWindow) self.actionSurvey.setObjectName("actionSurvey") self.actionInfo = QtWidgets.QAction(MainWindow) self.actionInfo.setObjectName("actionInfo") self.actionQuit = QtWidgets.QAction(MainWindow) self.actionQuit.setObjectName("actionQuit") self.actionHelp = QtWidgets.QAction(MainWindow) self.actionHelp.setEnabled(False) self.actionHelp.setObjectName("actionHelp") self.actionScan = QtWidgets.QAction(MainWindow) self.actionScan.setObjectName("actionScan") self.actionSpectrum = QtWidgets.QAction(MainWindow) self.actionSpectrum.setObjectName("actionSpectrum") self.actionNormal = QtWidgets.QAction(MainWindow) self.actionNormal.setCheckable(True) self.actionNormal.setObjectName("actionNormal") self.actionTesting = QtWidgets.QAction(MainWindow) self.actionTesting.setCheckable(True) self.actionTesting.setObjectName("actionTesting") self.actionLegacy = QtWidgets.QAction(MainWindow) self.actionLegacy.setCheckable(True) self.actionLegacy.setObjectName("actionLegacy") self.actionGetInfo = QtWidgets.QAction(MainWindow) self.actionGetInfo.setEnabled(False) self.actionGetInfo.setObjectName("actionGetInfo") self.menuCalibration.addAction(self.actionRA) self.menuCalibration.addAction(self.actionDec) self.menuFile.addAction(self.actionHelp) self.menuFile.addAction(self.actionInfo) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuMode.addAction(self.actionNormal) self.menuMode.addAction(self.actionTesting) self.menuMode.addSeparator() self.menuMode.addAction(self.actionLegacy) self.menuObservation.addAction(self.actionScan) self.menuObservation.addAction(self.actionSurvey) self.menuObservation.addAction(self.actionSpectrum) self.menuObservation.addSeparator() self.menuObservation.addAction(self.actionGetInfo) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuObservation.menuAction()) self.menubar.addAction(self.menuCalibration.menuAction()) self.menubar.addAction(self.menuMode.menuAction()) self.retranslateUi(MainWindow) self.actionQuit.triggered.connect(MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.stripchart_speed_slider, self.chart_clear_button) MainWindow.setTabOrder(self.chart_clear_button, self.dec_view) MainWindow.setTabOrder(self.dec_view, self.stripchart) MainWindow.setTabOrder(self.stripchart, self.variance_dial) MainWindow.setTabOrder(self.variance_dial, self.polarization_dial) MainWindow.setTabOrder(self.polarization_dial, self.noise_dial) MainWindow.setTabOrder(self.noise_dial, self.calibration_check_box) MainWindow.setTabOrder(self.calibration_check_box, self.declination_slider) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.data_display_group.setTitle(_translate("MainWindow", "Data")) self.sweep_value.setText(_translate("MainWindow", "n/a")) self.channelA_value.setText(_translate("MainWindow", "0.0000V")) self.channelB_label.setText(_translate("MainWindow", "Channel B:")) self.channelB_value.setText(_translate("MainWindow", "0.0000V")) self.dec_label.setText(_translate("MainWindow", "Declination:")) self.dec_value.setText(_translate("MainWindow", "0.0000deg")) self.ra_label.setText(_translate("MainWindow", "Right Ascension:")) self.ra_value.setText(_translate("MainWindow", "00:00:00")) self.sweep_label.setText(_translate("MainWindow", "Sweep:")) self.channelA_label.setText(_translate("MainWindow", "Channel A:")) self.stripchart_control_group.setTitle( _translate("MainWindow", "Strip chart")) self.stripchart_faster_label.setText(_translate( "MainWindow", "Faster")) self.stripchart_slower_label.setText(_translate( "MainWindow", "Slower")) self.toggle_channel_button.setText( _translate("MainWindow", "Toggle Channels")) self.chart_clear_button.setText(_translate("MainWindow", "Clear Chart")) self.message_group_box.setTitle(_translate("MainWindow", "Message")) self.refresh_label.setText(_translate("MainWindow", "Refresh rate:")) self.refresh_value.setText(_translate("MainWindow", "0.00Hz")) self.message_label.setText(_translate("MainWindow", "...")) self.console_label.setText(_translate("MainWindow", ">>>")) self.dec_group_box.setTitle(_translate("MainWindow", "Declinometer")) self.north_label.setText(_translate("MainWindow", "+")) self.south_label.setText(_translate("MainWindow", "-")) self.dec_auto_check_box.setText(_translate("MainWindow", "Auto")) self.signal_group_box.setTitle(_translate("MainWindow", "Signal")) self.variance_label.setText(_translate("MainWindow", "Variance")) self.noise_label.setText(_translate("MainWindow", "Interference")) self.polarization_label.setText( _translate("MainWindow", "Polarization")) self.calibration_check_box.setText( _translate("MainWindow", "Calibration")) self.menuCalibration.setTitle(_translate("MainWindow", "Calibrate")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuMode.setTitle(_translate("MainWindow", "Mode")) self.menuObservation.setTitle(_translate("MainWindow", "Observation")) self.actionRA.setText(_translate("MainWindow", "RA...")) self.actionRA.setShortcut(_translate("MainWindow", "Ctrl+R")) self.actionDec.setText(_translate("MainWindow", "Dec...")) self.actionDec.setShortcut(_translate("MainWindow", "Ctrl+D")) self.actionSurvey.setText(_translate("MainWindow", "New Survey...")) self.actionSurvey.setShortcut(_translate("MainWindow", "Ctrl+2")) self.actionInfo.setText(_translate("MainWindow", "Credits...")) self.actionQuit.setText(_translate("MainWindow", "Exit")) self.actionHelp.setText(_translate("MainWindow", "Help...")) self.actionScan.setText(_translate("MainWindow", "New Scan...")) self.actionScan.setShortcut(_translate("MainWindow", "Ctrl+1")) self.actionSpectrum.setText(_translate("MainWindow", "New Spectrum...")) self.actionSpectrum.setShortcut(_translate("MainWindow", "Ctrl+3")) self.actionNormal.setText(_translate("MainWindow", "Normal")) self.actionNormal.setShortcut(_translate("MainWindow", "Ctrl+N")) self.actionTesting.setText(_translate("MainWindow", "Testing")) self.actionTesting.setShortcut(_translate("MainWindow", "Ctrl+T")) self.actionLegacy.setText(_translate("MainWindow", "Legacy")) self.actionGetInfo.setText(_translate("MainWindow", "Get Info...")) self.actionGetInfo.setShortcut(_translate("MainWindow", "Ctrl+I"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1046, 625) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout_3 = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout_3.setObjectName("gridLayout_3") self.addFilesButton = QtWidgets.QPushButton(self.centralwidget) self.addFilesButton.setObjectName("addFilesButton") self.gridLayout_3.addWidget(self.addFilesButton, 0, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(182, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem, 0, 1, 1, 1) self.clearTableButton = QtWidgets.QPushButton(self.centralwidget) self.clearTableButton.setObjectName("clearTableButton") self.gridLayout_3.addWidget(self.clearTableButton, 0, 2, 1, 1) spacerItem1 = QtWidgets.QSpacerItem(182, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_3.addItem(spacerItem1, 0, 3, 1, 1) self.closeAppButton = QtWidgets.QPushButton(self.centralwidget) self.closeAppButton.setObjectName("closeAppButton") self.gridLayout_3.addWidget(self.closeAppButton, 0, 4, 1, 1) self.simpleIVplotWidget = QtWidgets.QTabWidget(self.centralwidget) self.simpleIVplotWidget.setObjectName("simpleIVplotWidget") self.filesTab = QtWidgets.QWidget() self.filesTab.setObjectName("filesTab") self.gridLayout_2 = QtWidgets.QGridLayout(self.filesTab) self.gridLayout_2.setObjectName("gridLayout_2") self.tableWithFiles = QtWidgets.QTableWidget(self.filesTab) self.tableWithFiles.setColumnCount(10) self.tableWithFiles.setObjectName("tableWithFiles") self.tableWithFiles.setRowCount(0) self.tableWithFiles.horizontalHeader().setCascadingSectionResizes(True) self.tableWithFiles.horizontalHeader().setStretchLastSection(True) self.gridLayout_2.addWidget(self.tableWithFiles, 0, 0, 1, 1) self.groupBox = QtWidgets.QGroupBox(self.filesTab) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) self.groupBox.setSizePolicy(sizePolicy) self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.consoleOutput = QtWidgets.QPlainTextEdit(self.groupBox) self.consoleOutput.setObjectName("consoleOutput") self.gridLayout.addWidget(self.consoleOutput, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox, 1, 0, 1, 1) self.simpleIVplotWidget.addTab(self.filesTab, "") self.plotTab = QtWidgets.QWidget() self.plotTab.setObjectName("plotTab") self.gridLayout_5 = QtWidgets.QGridLayout(self.plotTab) self.gridLayout_5.setObjectName("gridLayout_5") self.gridLayout_4 = QtWidgets.QGridLayout() self.gridLayout_4.setObjectName("gridLayout_4") self.pushButton = QtWidgets.QPushButton(self.plotTab) self.pushButton.setObjectName("pushButton") self.gridLayout_4.addWidget(self.pushButton, 0, 0, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(self.plotTab) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout_4.addWidget(self.pushButton_2, 0, 1, 1, 1) self.pushButton_3 = QtWidgets.QPushButton(self.plotTab) self.pushButton_3.setObjectName("pushButton_3") self.gridLayout_4.addWidget(self.pushButton_3, 0, 3, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(288, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_4.addItem(spacerItem2, 0, 2, 1, 1) self.gridLayout_5.addLayout(self.gridLayout_4, 1, 0, 1, 1) self.splitter = QtWidgets.QSplitter(self.plotTab) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setObjectName("splitter") self.plotWidget = QChartView(self.splitter) self.plotWidget.setObjectName("plotWidget") self.simplePVplotWidget = QChartView(self.splitter) self.simplePVplotWidget.setObjectName("simplePVplotWidget") self.gridLayout_5.addWidget(self.splitter, 0, 0, 1, 1) self.simpleIVplotWidget.addTab(self.plotTab, "") self.mainSettingsTab = QtWidgets.QWidget() self.mainSettingsTab.setObjectName("mainSettingsTab") self.gridLayout_7 = QtWidgets.QGridLayout(self.mainSettingsTab) self.gridLayout_7.setObjectName("gridLayout_7") self.label = QtWidgets.QLabel(self.mainSettingsTab) self.label.setObjectName("label") self.gridLayout_7.addWidget(self.label, 0, 0, 1, 1) self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.mainSettingsTab) self.doubleSpinBox.setObjectName("doubleSpinBox") self.gridLayout_7.addWidget(self.doubleSpinBox, 0, 1, 1, 1) self.label_2 = QtWidgets.QLabel(self.mainSettingsTab) self.label_2.setObjectName("label_2") self.gridLayout_7.addWidget(self.label_2, 1, 0, 1, 1) self.doubleSpinBox_2 = QtWidgets.QDoubleSpinBox(self.mainSettingsTab) self.doubleSpinBox_2.setObjectName("doubleSpinBox_2") self.gridLayout_7.addWidget(self.doubleSpinBox_2, 1, 1, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(self.mainSettingsTab) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) self.groupBox_2.setSizePolicy(sizePolicy) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout_6.setObjectName("gridLayout_6") self.label_3 = QtWidgets.QLabel(self.groupBox_2) self.label_3.setObjectName("label_3") self.gridLayout_6.addWidget(self.label_3, 0, 0, 1, 1) self.csvDelimiterBox = QtWidgets.QComboBox(self.groupBox_2) self.csvDelimiterBox.setObjectName("csvDelimiterBox") self.gridLayout_6.addWidget(self.csvDelimiterBox, 0, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setObjectName("label_4") self.gridLayout_6.addWidget(self.label_4, 1, 0, 1, 1) self.csvFirstColumnDimensionBox = QtWidgets.QComboBox(self.groupBox_2) self.csvFirstColumnDimensionBox.setObjectName("csvFirstColumnDimensionBox") self.gridLayout_6.addWidget(self.csvFirstColumnDimensionBox, 1, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.groupBox_2) self.label_5.setObjectName("label_5") self.gridLayout_6.addWidget(self.label_5, 2, 0, 1, 1) self.csvSecondColumnDimensionBox = QtWidgets.QComboBox(self.groupBox_2) self.csvSecondColumnDimensionBox.setObjectName("csvSecondColumnDimensionBox") self.gridLayout_6.addWidget(self.csvSecondColumnDimensionBox, 2, 1, 1, 1) self.gridLayout_7.addWidget(self.groupBox_2, 2, 0, 1, 1) spacerItem3 = QtWidgets.QSpacerItem(20, 247, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout_7.addItem(spacerItem3, 3, 0, 1, 1) self.simpleIVplotWidget.addTab(self.mainSettingsTab, "") self.gridLayout_3.addWidget(self.simpleIVplotWidget, 1, 0, 1, 5) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1046, 31)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionClose = QtWidgets.QAction(MainWindow) self.actionClose.setObjectName("actionClose") self.menuFile.addAction(self.actionClose) self.menubar.addAction(self.menuFile.menuAction()) self.retranslateUi(MainWindow) self.simpleIVplotWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.addFilesButton.setText(_translate("MainWindow", "Add files ...")) self.clearTableButton.setText(_translate("MainWindow", "Clear table")) self.closeAppButton.setText(_translate("MainWindow", "Close App")) self.groupBox.setTitle(_translate("MainWindow", "Console Output")) self.simpleIVplotWidget.setTabText(self.simpleIVplotWidget.indexOf(self.filesTab), _translate("MainWindow", "Files")) self.pushButton.setText(_translate("MainWindow", "PushButton")) self.pushButton_2.setText(_translate("MainWindow", "PushButton")) self.pushButton_3.setText(_translate("MainWindow", "PushButton")) self.simpleIVplotWidget.setTabText(self.simpleIVplotWidget.indexOf(self.plotTab), _translate("MainWindow", "Simple Plots")) self.label.setText(_translate("MainWindow", "Active area of solar cell, [cm]")) self.label_2.setText(_translate("MainWindow", "Light energy, [mW/cm]")) self.groupBox_2.setTitle(_translate("MainWindow", "CSV/TXT file options")) self.label_3.setText(_translate("MainWindow", "Delimiter")) self.label_4.setText(_translate("MainWindow", "First Column is in")) self.label_5.setText(_translate("MainWindow", "Second Column is in")) self.simpleIVplotWidget.setTabText(self.simpleIVplotWidget.indexOf(self.mainSettingsTab), _translate("MainWindow", "Main Settings")) self.menuFile.setTitle(_translate("MainWindow", "Fi&le")) self.actionClose.setText(_translate("MainWindow", "Close"))
class Ui_Monitor(object): def setupUi(self, Monitor): Monitor.setObjectName("Monitor") Monitor.resize(1132, 595) Monitor.setMinimumSize(QtCore.QSize(1132, 595)) self.gridLayout_2 = QtWidgets.QGridLayout(Monitor) self.gridLayout_2.setObjectName("gridLayout_2") self.label = QtWidgets.QLabel(Monitor) self.label.setMinimumSize(QtCore.QSize(1091, 41)) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 0, 0, 1, 2) self.graphicsView = QChartView(Monitor) self.graphicsView.setMinimumSize(QtCore.QSize(761, 481)) self.graphicsView.setObjectName("graphicsView") self.gridLayout_2.addWidget(self.graphicsView, 1, 0, 1, 1) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label_2 = QtWidgets.QLabel(Monitor) self.label_2.setMinimumSize(QtCore.QSize(91, 30)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) self.comboBox = QtWidgets.QComboBox(Monitor) self.comboBox.setMinimumSize(QtCore.QSize(91, 30)) self.comboBox.setObjectName("comboBox") self.gridLayout.addWidget(self.comboBox, 0, 1, 1, 1) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 0, 2, 1, 1) self.label_3 = QtWidgets.QLabel(Monitor) self.label_3.setMinimumSize(QtCore.QSize(91, 30)) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(Monitor) self.lineEdit.setMinimumSize(QtCore.QSize(191, 30)) self.lineEdit.setObjectName("lineEdit") self.gridLayout.addWidget(self.lineEdit, 1, 1, 1, 2) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem1, 2, 1, 1, 1) self.label_4 = QtWidgets.QLabel(Monitor) self.label_4.setMinimumSize(QtCore.QSize(301, 161)) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 3, 0, 1, 3) self.pushButton = QtWidgets.QPushButton(Monitor) self.pushButton.setMinimumSize(QtCore.QSize(91, 41)) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 4, 0, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(Monitor) self.pushButton_2.setMinimumSize(QtCore.QSize(91, 41)) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 4, 1, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem2, 4, 2, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 1, 1, 1, 1) self.retranslateUi(Monitor) self.comboBox.currentIndexChanged['int'].connect(Monitor.iface_changed) self.lineEdit.returnPressed.connect(Monitor.filter_changed) self.pushButton.clicked.connect(Monitor.start_on_clicked) self.pushButton_2.clicked.connect(Monitor.clear_on_clicked) QtCore.QMetaObject.connectSlotsByName(Monitor) def retranslateUi(self, Monitor): _translate = QtCore.QCoreApplication.translate Monitor.setWindowTitle(_translate("Monitor", "Dialog")) self.label.setText(_translate("Monitor", "TextLabel")) self.label_2.setText(_translate("Monitor", "网络接口")) self.label_3.setText(_translate("Monitor", "过滤器")) self.label_4.setText(_translate("Monitor", "TextLabel")) self.pushButton.setText(_translate("Monitor", "start")) self.pushButton_2.setText(_translate("Monitor", "clear"))
class Ui_MainWindow(QtWidgets.QMainWindow): def openDetails(self): self.window = QtWidgets.QDialog() self.ui = Ui_Detail() self.ui.setupUi(self.window) self.window.show() if self.inputUlasan.toPlainText() != '': self.ui.setDetail(self.tmp_res[0], self.tmp_res[1], self.tmp_res[2], self.tmp_res[3], self.tmp_res[4], self.tmp_res[5]) return def __init__(self, parent=None): super().__init__(parent) self.setObjectName("MainWindow") self.resize(1366, 768) self.setAutoFillBackground(False) self.ind = 0 namaPantai = [] npn = NamaPantai() namaPan = npn.nama_pantai() for i in range(len(namaPan)): namaPantai.append(namaPan[i]) self.label_pantai = namaPantai self.label_pantai_sort = self.getLabelSort()[0] self.label_pantai_sort2 = self.getLabelSort()[1] self.label_pantai_sort3 = self.getLabelSort()[2] self.label_pantai_sort4 = self.getLabelSort()[3] self.centralwidget = QtWidgets.QWidget(self) self.centralwidget.setObjectName("centralwidget") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(0, 0, 1366, 768)) self.tabWidget.setObjectName("tabWidget") self.tab_Grafik = QtWidgets.QWidget() self.tab_Grafik.setObjectName("tab_Grafik") self.radioALL = QtWidgets.QRadioButton(self.tab_Grafik) self.radioALL.setGeometry(QtCore.QRect(850, 30, 100, 21)) self.radioDT = QtWidgets.QRadioButton(self.tab_Grafik) self.radioDT.setGeometry(QtCore.QRect(950, 30, 100, 21)) self.radioDT.setObjectName("radioDT") self.radioAK = QtWidgets.QRadioButton(self.tab_Grafik) self.radioAK.setGeometry(QtCore.QRect(1050, 30, 100, 21)) self.radioAK.setObjectName("radioAK") self.radioKB = QtWidgets.QRadioButton(self.tab_Grafik) self.radioKB.setGeometry(QtCore.QRect(1150, 30, 100, 21)) self.radioKB.setObjectName("radioKB") self.radioFS = QtWidgets.QRadioButton(self.tab_Grafik) self.radioFS.setGeometry(QtCore.QRect(1250, 30, 100, 21)) self.radioFS.setObjectName("radioFS") self.step = 0.8 self.verticalScrollBar = QtWidgets.QScrollBar( self.tab_Grafik, sliderMoved=self.onAxisSliderMoved, pageStep=self.step * 10) self.verticalScrollBar.setGeometry(QtCore.QRect(30, 620, 1300, 20)) self.verticalScrollBar.setOrientation(QtCore.Qt.Horizontal) self.verticalScrollBar.setObjectName("verticalScrollBar") self.comboBox = QtWidgets.QComboBox(self.tab_Grafik) self.comboBox.setGeometry(QtCore.QRect(110, 30, 161, 21)) self.comboBox.setObjectName("comboBox") self.comboBox.addItem("=Pilih=") self.tmp_res = None for i in range(len(namaPan)): self.comboBox.addItem(namaPan[i]) self.label_6 = QtWidgets.QLabel(self.tab_Grafik) self.label_6.setGeometry(QtCore.QRect(40, 30, 81, 16)) self.label_6.setObjectName("label_6") self.graphicsView = QChartView(self.tab_Grafik) self.graphicsView.setGeometry(QtCore.QRect(30, 70, 1300, 520)) self.graphicsView.setObjectName("graphicsView") self.tabWidget.addTab(self.tab_Grafik, "") self.tab_Klasifikasi = QtWidgets.QWidget() self.tab_Klasifikasi.setObjectName("tab_Klasifikasi") self.label = QtWidgets.QLabel(self.tab_Klasifikasi) self.label.setGeometry(QtCore.QRect(450, 70, 381, 31)) self.label.setObjectName("label") self.label_2 = QtWidgets.QLabel(self.tab_Klasifikasi) self.label_2.setGeometry(QtCore.QRect(170, 150, 131, 16)) self.label_2.setObjectName("label_2") self.label_3 = QtWidgets.QLabel(self.tab_Klasifikasi) self.label_3.setGeometry(QtCore.QRect(170, 370, 200, 16)) self.label_3.setObjectName("label_3") self.label_4 = QtWidgets.QLabel(self.tab_Klasifikasi) self.label_4.setGeometry(QtCore.QRect(850, 150, 71, 16)) self.label_4.setObjectName("label_4") self.label_5 = QtWidgets.QLabel(self.tab_Klasifikasi) self.label_5.setGeometry(QtCore.QRect(850, 370, 71, 21)) self.label_5.setObjectName("label_5") self.inputUlasan = QtWidgets.QPlainTextEdit(self.tab_Klasifikasi) self.inputUlasan.setGeometry(QtCore.QRect(170, 200, 500, 121)) self.inputUlasan.setFont(QFont('Times', 15)) self.inputUlasan.setObjectName("inputUlasan") self.hasilPreprocessing = QtWidgets.QPlainTextEdit( self.tab_Klasifikasi) self.hasilPreprocessing.setGeometry(QtCore.QRect(170, 420, 500, 121)) self.hasilPreprocessing.setFont(QFont('Times', 15)) self.hasilPreprocessing.setObjectName("hasilPreprocessing") self.hasilSentimen = QtWidgets.QPlainTextEdit(self.tab_Klasifikasi) self.hasilSentimen.setGeometry(QtCore.QRect(850, 200, 300, 121)) self.hasilSentimen.setObjectName("hasilSentimen") self.hasilSentimen.setFont(QFont('Times', 15)) self.hasilKategori = QtWidgets.QPlainTextEdit(self.tab_Klasifikasi) self.hasilKategori.setGeometry(QtCore.QRect(850, 420, 300, 121)) self.hasilKategori.setObjectName("hasilKategori") self.hasilKategori.setFont(QFont('Times', 15)) self.buttonPrediksi = QtWidgets.QPushButton(self.tab_Klasifikasi) self.buttonPrediksi.setGeometry(QtCore.QRect(170, 570, 111, 30)) self.buttonPrediksi.setObjectName("buttonPrediksi") self.buttonDetail = QtWidgets.QPushButton(self.tab_Klasifikasi) self.buttonDetail.setGeometry(QtCore.QRect(350, 570, 111, 30)) self.buttonDetail.setObjectName("buttonDetail") self.buttonClear = QtWidgets.QPushButton(self.tab_Klasifikasi) self.buttonClear.setGeometry(QtCore.QRect(1039, 570, 111, 30)) self.buttonClear.setObjectName("buttonClear") self.tabWidget.addTab(self.tab_Klasifikasi, "") self.tab_Pengujian = QtWidgets.QWidget() self.tab_Pengujian.setObjectName("tab_Pengujian") self.graphicsView_sentimen = QChartView(self.tab_Pengujian) self.graphicsView_sentimen.setGeometry(QtCore.QRect(50, 100, 600, 560)) self.graphicsView_sentimen.setObjectName("graphicsView") self.graphicsView_kategori = QChartView(self.tab_Pengujian) self.graphicsView_kategori.setGeometry(QtCore.QRect( 700, 100, 600, 560)) self.graphicsView_kategori.setObjectName("graphicsView") self.label_ujisentimen = QtWidgets.QLabel(self.tab_Pengujian) self.label_ujisentimen.setGeometry(QtCore.QRect(200, 50, 300, 31)) self.label_ujisentimen.setObjectName("label_ujisentimen") self.label_ujiKategori = QtWidgets.QLabel(self.tab_Pengujian) self.label_ujiKategori.setGeometry(QtCore.QRect(850, 50, 300, 31)) self.label_ujiKategori.setObjectName("label_ujiKategori") self.tabWidget.addTab(self.tab_Pengujian, "") self.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(self) self.statusbar.setObjectName("statusbar") self.setStatusBar(self.statusbar) self.retranslateUi(self) QtCore.QMetaObject.connectSlotsByName(self) self.comboBox.activated.connect(self.selectionChange) self.ALL() self.buttonPrediksi.clicked.connect(self.on_click) self.buttonClear.clicked.connect(self.delete) self.buttonDetail.clicked.connect(self.openDetails) self.graphicsView_sentimen.setChart(self.grafik_uji_sentimen()) self.graphicsView_kategori.setChart(self.grafik_uji_kategori()) self.radioALL.setChecked(True) self.radioALL.toggled.connect(self.ALL) self.radioDT.toggled.connect(self.DT) self.radioAK.toggled.connect(self.AK) self.radioKB.toggled.connect(self.KB) self.radioFS.toggled.connect(self.FS) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Analisis Sentimen")) self.buttonPrediksi.setText(_translate("MainWindow", "Prediksi")) self.buttonDetail.setText(_translate("MainWindow", "Detail")) self.buttonClear.setText(_translate("MainWindow", "Hapus")) self.radioALL.setText(_translate("MainWindow", "Kategori")) self.radioDT.setText(_translate("MainWindow", "Daya Tarik")) self.radioAK.setText(_translate("MainWindow", "Aksesbilitas")) self.radioKB.setText(_translate("MainWindow", "Kebersihan")) self.radioFS.setText(_translate("MainWindow", "Fasilitas")) self.label.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:14pt; font-weight:600;\">KLASIFIKASI ULASAN GOOGLE MAPS</span></p></body></html>" )) self.label_2.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600;\">Masukkan Ulasan :</span></p></body></html>" )) self.label_3.setText( _translate( "MainWindow", "<html><head/><body><p><span style=\" font-size:10pt; font-weight:600;\">Hasil Preprocessing :</span></p></body></html>" )) self.label_4.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600;\">Sentimen :</span></p></body></html>" )) self.label_5.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600;\">Kategori :</span></p></body></html>" )) self.label_ujisentimen.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">Grafik Pengujian Sentimen</span></p></body></html>" )) self.label_ujiKategori.setText( _translate( "MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">Grafik Pengujian Kategori</span></p></body></html>" )) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_Klasifikasi), _translate("MainWindow", "Klasifikasi")) self.comboBox.setItemText(0, _translate("MainWindow", "-Pilih-")) np = NamaPantai() hasil = np.nama_pantai() for i in range(len(hasil)): self.comboBox.setItemText(i + 1, _translate("MainWindow", hasil[i])) self.label_6.setText( _translate( "MainWindow", "<html><head/><body><p><span style=\" font-size:9pt;\">Pilih Pantai :</span></p></body></html>" )) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_Grafik), _translate("MainWindow", "Grafik")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_Pengujian), _translate("MainWindow", "Pengujian")) def selectionChange(self): pilih_pantai = str(self.comboBox.currentText()) if pilih_pantai == '-Pilih-': self.ALL() return gf = Grafik(pilih_pantai) hasil = gf.hasil_grafik() hasil_dayatarik = hasil[0] hasil_aksesbilitas = hasil[1] hasil_kebersihan = hasil[2] hasil_fasilitas = hasil[3] total_pantai = hasil[4] daya_tarik = (hasil_dayatarik / total_pantai) * 100 aksesbilitas = (hasil_aksesbilitas / total_pantai) * 100 kebersihan = (hasil_kebersihan / total_pantai) * 100 fasilitas = (hasil_fasilitas / total_pantai) * 100 nilai = { 'Daya Tarik': daya_tarik, 'Aksesbilitas': aksesbilitas, 'Kebersihan': kebersihan, 'Fasilitas': fasilitas } maks = max(nilai['Daya Tarik'], nilai['Aksesbilitas'], nilai['Kebersihan'], nilai['Fasilitas']) for i in nilai: if maks == nilai[i]: print(i) set0 = QBarSet(pilih_pantai) set0 << daya_tarik << aksesbilitas << kebersihan << fasilitas series = QBarSeries() series.append(set0) series.setLabelsVisible(True) chart = QChart() chart.addSeries(series) chart.setTitle('Pantai ' + str(pilih_pantai)) labelnya = ["Daya Tarik", "Aksesbilitas", "Kebersihan", "Fasilitas"] series = QPieSeries() series.append("dt", daya_tarik) series.append("ak", aksesbilitas) series.append("keb", kebersihan) series.append("fas", fasilitas) slice = QPieSlice() slice = series.slices()[0] slice.setExploded(False) slice.setLabelVisible(True) slice.setBrush(QtGui.QColor("blue")) slice = QPieSlice() slice = series.slices()[1] slice.setExploded(False) slice.setLabelVisible(True) slice.setBrush(QtGui.QColor("red")) slice = QPieSlice() slice = series.slices()[2] slice.setExploded(False) slice.setLabelVisible(True) slice.setBrush(QtGui.QColor("green")) slice = QPieSlice() slice = series.slices()[3] slice.setExploded(False) slice.setLabelVisible(True) slice.setBrush(QtGui.QColor("orange")) i = 0 for slice in series.slices(): slice.setLabel(labelnya[i] + " {:.1f}%".format(100 * slice.percentage())) i = i + 1 chart = QChart() chart.legend().hide() chart.addSeries(series) chart.createDefaultAxes() chart.setAnimationOptions(QChart.SeriesAnimations) self.graphicsView.setChart(chart) def ALL(self): self.ind = 0 set0 = QBarSet('Daya Tarik') set1 = QBarSet('Aksesbilitas') set2 = QBarSet('Kebersihan') set3 = QBarSet('Fasilitas') set0.setColor(QtGui.QColor("blue")) set1.setColor(QtGui.QColor("red")) set2.setColor(QtGui.QColor("green")) set3.setColor(QtGui.QColor("orange")) gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) hasil = gf.hasil_dayatarik() for i in range(len(hasil)): set0.append((hasil[i] / jml_pantai[i]) * 100) hasil2 = gf.hasil_aksesbilitas() for i in range(len(hasil2)): set1.append((hasil2[i] / jml_pantai[i]) * 100) hasil3 = gf.hasil_kebersihan() for i in range(len(hasil3)): set2.append((hasil3[i] / jml_pantai[i]) * 100) hasil4 = gf.hasil_fasilitas() for i in range(len(hasil4)): set3.append((hasil4[i] / jml_pantai[i]) * 100) series = QBarSeries() series.append(set0) series.append(set1) series.append(set2) series.append(set3) series.setLabelsVisible(True) series.setLabelsPosition(QAbstractBarSeries.LabelsInsideEnd) series.setLabelsAngle(-90) self.chart = QChart() self.chart.addSeries(series) self.chart.setTitle('Grafik Prosentase Ulasan Pantai') self.chart.setAnimationOptions(QChart.SeriesAnimations) axisY = QValueAxis() axisY.setTitleText("Prosentase (%)") axisY.applyNiceNumbers() self.chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignBottom) self.chart.createDefaultAxes() self.graphicsView.setChart(self.chart) self.adjust_axes(0, 2) self.lims = np.array([0, 6]) self.onAxisSliderMoved(self.verticalScrollBar.value()) def getLabelSort(self): gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) value = [] value2 = [] value3 = [] value4 = [] hasil = gf.hasil_dayatarik() for i in range(len(hasil)): value.append((hasil[i] / jml_pantai[i]) * 100) sorting = sorted(value, reverse=True) index = np.argsort(value)[::-1] label_sorting = [] for i in index: label_sorting.append(self.label_pantai[i]) hasil2 = gf.hasil_aksesbilitas() for i in range(len(hasil2)): value2.append((hasil2[i] / jml_pantai[i]) * 100) sorting2 = sorted(value2, reverse=True) index2 = np.argsort(value2)[::-1] label_sorting2 = [] for i in index2: label_sorting2.append(self.label_pantai[i]) hasil3 = gf.hasil_kebersihan() for i in range(len(hasil3)): value3.append((hasil3[i] / jml_pantai[i]) * 100) sorting3 = sorted(value3, reverse=True) index3 = np.argsort(value3)[::-1] label_sorting3 = [] for i in index3: label_sorting3.append(self.label_pantai[i]) hasil4 = gf.hasil_fasilitas() for i in range(len(hasil4)): value4.append((hasil4[i] / jml_pantai[i]) * 100) sorting4 = sorted(value4, reverse=True) index4 = np.argsort(value4)[::-1] label_sorting4 = [] for i in index4: label_sorting4.append(self.label_pantai[i]) return (label_sorting, label_sorting2, label_sorting3, label_sorting4) def adjust_axes(self, value_min, value_max): if value_max > 35: return self.chart.createDefaultAxes() self.chart.axisX().setRange(str(value_min), str(value_max)) if self.ind == 0: for i in range( value_min, value_max + 1 if value_max < 36 else len(self.label_pantai)): self.chart.axisX().replace( str(i), self.label_pantai[i - 1 if i > 0 else i]) if self.ind == 1: for i in range( value_min, value_max + 1 if value_max < 36 else len(self.label_pantai_sort)): self.chart.axisX().replace( str(i), self.label_pantai_sort[i - 1 if i > 0 else i]) if self.ind == 2: for i in range( value_min, value_max + 1 if value_max < 36 else len(self.label_pantai_sort2)): self.chart.axisX().replace( str(i), self.label_pantai_sort2[i - 1 if i > 0 else i]) if self.ind == 3: for i in range( value_min, value_max + 1 if value_max < 36 else len(self.label_pantai_sort3)): self.chart.axisX().replace( str(i), self.label_pantai_sort3[i - 1 if i > 0 else i]) if self.ind == 4: for i in range( value_min, value_max + 1 if value_max < 36 else len(self.label_pantai_sort4)): self.chart.axisX().replace( str(i), self.label_pantai_sort4[i - 1 if i > 0 else i]) @QtCore.pyqtSlot(int) def onAxisSliderMoved(self, value): r = value / ((1 + self.step) * 10) l1 = self.lims[0] + r * np.diff(self.lims) l2 = l1 + np.diff(self.lims) * self.step self.adjust_axes(math.floor(l1), math.ceil(l2)) def DT(self): self.ind = 1 gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) value = [] hasil = gf.hasil_dayatarik() for i in range(len(hasil)): value.append((hasil[i] / jml_pantai[i]) * 100) sorting = sorted(value, reverse=True) index = np.argsort(value)[::-1] label_sorting = [] for i in index: label_sorting.append(self.label_pantai[i]) set0 = QBarSet('Daya Tarik') set0.setColor(QtGui.QColor("blue")) for i in range(len(hasil)): set0.append(sorting) series = QBarSeries() series.append(set0) series.setLabelsVisible(True) series.setLabelsPosition(QAbstractBarSeries.LabelsInsideEnd) self.chart = QChart() self.chart.addSeries(series) self.chart.setTitle('Grafik Prosentase Ulasan Pantai') self.chart.setAnimationOptions(QChart.SeriesAnimations) axisX = QBarCategoryAxis() axisX.setLabelsAngle(-90) axisY = QValueAxis() axisY.setTitleText("Prosentase (%)") self.chart.addAxis(axisX, Qt.AlignBottom) self.chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) axisY.applyNiceNumbers() self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignBottom) self.chart.createDefaultAxes() self.graphicsView.setChart(self.chart) self.lims = np.array([0, 10]) self.onAxisSliderMoved(self.verticalScrollBar.value()) def AK(self): self.ind = 2 gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) value = [] hasil = gf.hasil_aksesbilitas() for i in range(len(hasil)): value.append((hasil[i] / jml_pantai[i]) * 100) sorting = sorted(value, reverse=True) set0 = QBarSet('Aksesbilitas') set0.setColor(QtGui.QColor("red")) for i in range(len(hasil)): set0.append(sorting) series = QBarSeries() series.append(set0) series.setLabelsVisible(True) series.setLabelsPosition(QAbstractBarSeries.LabelsInsideEnd) self.chart = QChart() self.chart.addSeries(series) self.chart.setTitle('Grafik Prosentase Ulasan Pantai') self.chart.setAnimationOptions(QChart.SeriesAnimations) axisY = QValueAxis() axisY.setTitleText("Prosentase (%)") axisY.applyNiceNumbers() self.chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignBottom) self.chart.createDefaultAxes() self.graphicsView.setChart(self.chart) self.adjust_axes(0, 2) self.lims = np.array([0, 10]) self.onAxisSliderMoved(self.verticalScrollBar.value()) def KB(self): self.ind = 3 gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) value = [] hasil = gf.hasil_kebersihan() for i in range(len(hasil)): value.append((hasil[i] / jml_pantai[i]) * 100) sorting = sorted(value, reverse=True) set0 = QBarSet('Kebersihan') set0.setColor(QtGui.QColor("green")) for i in range(len(hasil)): set0.append(sorting) series = QBarSeries() series.append(set0) series.setLabelsVisible(True) series.setLabelsPosition(QAbstractBarSeries.LabelsInsideEnd) self.chart = QChart() self.chart.addSeries(series) self.chart.setTitle('Grafik Prosentase Ulasan Pantai') self.chart.setAnimationOptions(QChart.SeriesAnimations) axisY = QValueAxis() axisY.setTitleText("Prosentase (%)") axisY.applyNiceNumbers() self.chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignBottom) self.chart.createDefaultAxes() self.graphicsView.setChart(self.chart) self.adjust_axes(0, 2) self.lims = np.array([0, 10]) self.onAxisSliderMoved(self.verticalScrollBar.value()) def FS(self): self.ind = 4 gf = Grafik_2() jml = gf.jumlah_per_pantai() jml_pantai = [] for i in range(len(jml)): jml_pantai.append(jml[i]) value = [] hasil = gf.hasil_fasilitas() for i in range(len(hasil)): value.append((hasil[i] / jml_pantai[i]) * 100) sorting = sorted(value, reverse=True) set0 = QBarSet('Fasilitas') set0.setColor(QtGui.QColor("orange")) for i in range(len(hasil)): set0.append(sorting) series = QBarSeries() series.append(set0) series.setLabelsVisible(True) series.setLabelsPosition(QAbstractBarSeries.LabelsInsideEnd) self.chart = QChart() self.chart.addSeries(series) self.chart.setTitle('Grafik Prosentase Ulasan Pantai') self.chart.setAnimationOptions(QChart.SeriesAnimations) axisY = QValueAxis() axisY.setTitleText("Prosentase (%)") axisY.applyNiceNumbers() self.chart.addAxis(axisY, Qt.AlignLeft) series.attachAxis(axisY) self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignBottom) self.chart.createDefaultAxes() self.graphicsView.setChart(self.chart) self.adjust_axes(0, 2) self.lims = np.array([0, 10]) self.onAxisSliderMoved(self.verticalScrollBar.value()) def on_click(self): textboxValue = self.inputUlasan.toPlainText() cf = Classification(textboxValue) hasil = cf.klasifikasi() hasil_sentimen = hasil[0] hasil_kategori = hasil[1] token = hasil[2] predict_sentimen_positif = hasil[3] predict_sentimen_negatif = hasil[4] predict_DayaTarik = hasil[5] predict_Aksesbilitas = hasil[6] predict_Kebersihan = hasil[7] predict_Fasilitas = hasil[8] if self.inputUlasan.toPlainText() != '': self.inputUlasan.setPlainText(textboxValue) self.hasilPreprocessing.setPlainText(token) self.hasilSentimen.setPlainText(hasil_sentimen) self.hasilKategori.setPlainText(hasil_kategori) self.tmp_res = (predict_sentimen_positif, predict_sentimen_negatif, predict_DayaTarik, predict_Aksesbilitas, predict_Kebersihan, predict_Fasilitas) return self.tmp_res def delete(self): self.inputUlasan.setPlainText("") self.hasilPreprocessing.setPlainText("") self.hasilSentimen.setPlainText("") self.hasilKategori.setPlainText("") def grafik_uji_sentimen(self): with open( 'C:/Users/asus/Desktop/SKRIPSWEET BISMILLAH/MODUL PROGRAM/Modul Program Bismillah/Pengujian/hasil_uji_sentimen_kfold.json' ) as f: dataa = json.load(f) print(dataa) acc = dataa['acc'] pres = dataa['presisi'] rec = dataa['recall'] set0 = QBarSet('Akurasi') set1 = QBarSet('Presisi') set2 = QBarSet('Recall') for i in range(len(acc)): set0.append(acc[i] * 100) for i in range(len(pres)): set1.append(pres[i] * 100) for i in range(len(rec)): set2.append(rec[i] * 100) series = QBarSeries() series.append(set0) series.append(set1) series.append(set2) set0.setColor(QtGui.QColor("navy")) set1.setColor(QtGui.QColor("yellow")) set2.setColor(QtGui.QColor("red")) chart = QChart() chart.addSeries(series) chart.setAnimationOptions(QChart.SeriesAnimations) label_pantai = ['K=1', 'K=2', 'K=3', 'K=4', 'K=5'] axisX = QBarCategoryAxis() axisX.append(label_pantai) axisX.setLabelsAngle(0) axisY = QValueAxis() axisX.setTitleText("K-Fold Cross Validation") axisY.setTitleText("Prosentase (%)") axisY.setRange(0, max(set0)) axisY.setMinorTickCount(5) chart.addAxis(axisX, Qt.AlignBottom) chart.addAxis(axisY, Qt.AlignLeft) chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) return (chart) def grafik_uji_kategori(self): with open( 'C:/Users/asus/Desktop/SKRIPSWEET BISMILLAH/MODUL PROGRAM/Modul Program Bismillah/Pengujian/hasil_uji_kategori_kfold.json' ) as f: dataa = json.load(f) print(dataa) acc = dataa['acc'] pres = dataa['presisi'] rec = dataa['recall'] set0 = QBarSet('Akurasi') set1 = QBarSet('Presisi') set2 = QBarSet('Recall') for i in range(len(acc)): set0.append(acc[i] * 100) for i in range(len(pres)): set1.append(pres[i] * 100) for i in range(len(rec)): set2.append(rec[i] * 100) series = QBarSeries() series.append(set0) series.append(set1) series.append(set2) set0.setColor(QtGui.QColor("navy")) set1.setColor(QtGui.QColor("yellow")) set2.setColor(QtGui.QColor("red")) chart = QChart() chart.addSeries(series) chart.setAnimationOptions(QChart.SeriesAnimations) label_pantai = ['K=1', 'K=2', 'K=3', 'K=4', 'K=5'] axisX = QBarCategoryAxis() axisX.append(label_pantai) axisX.setLabelsAngle(0) axisY = QValueAxis() axisX.setTitleText("K-Fold Cross Validation") axisY.setTitleText("Prosentase (%)") axisY.setRange(0, max(set0)) axisY.setMinorTickCount(5) chart.addAxis(axisX, Qt.AlignBottom) chart.addAxis(axisY, Qt.AlignLeft) chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) return (chart)
class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(564, 676) self.gridLayout_2 = QtWidgets.QGridLayout(Dialog) self.gridLayout_2.setObjectName("gridLayout_2") self.advancedPlotWidget = QChartView(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.advancedPlotWidget.sizePolicy().hasHeightForWidth()) self.advancedPlotWidget.setSizePolicy(sizePolicy) self.advancedPlotWidget.setMinimumSize(QtCore.QSize(500, 400)) self.advancedPlotWidget.setObjectName("advancedPlotWidget") self.gridLayout_2.addWidget(self.advancedPlotWidget, 0, 0, 1, 3) self.groupBox = QtWidgets.QGroupBox(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) self.groupBox.setSizePolicy(sizePolicy) self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.groupBox) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.shortCircuitCurrentBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.shortCircuitCurrentBox.setObjectName("shortCircuitCurrentBox") self.gridLayout.addWidget(self.shortCircuitCurrentBox, 0, 1, 1, 1) self.label_6 = QtWidgets.QLabel(self.groupBox) self.label_6.setObjectName("label_6") self.gridLayout.addWidget(self.label_6, 0, 2, 1, 1) self.nonIdealityBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.nonIdealityBox.setObjectName("nonIdealityBox") self.gridLayout.addWidget(self.nonIdealityBox, 0, 3, 1, 1) self.label_2 = QtWidgets.QLabel(self.groupBox) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.openCircuitVoltageBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.openCircuitVoltageBox.setObjectName("openCircuitVoltageBox") self.gridLayout.addWidget(self.openCircuitVoltageBox, 1, 1, 2, 1) self.label_7 = QtWidgets.QLabel(self.groupBox) self.label_7.setObjectName("label_7") self.gridLayout.addWidget(self.label_7, 1, 2, 1, 1) self.rShuntBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.rShuntBox.setObjectName("rShuntBox") self.gridLayout.addWidget(self.rShuntBox, 1, 3, 1, 1) self.label_8 = QtWidgets.QLabel(self.groupBox) self.label_8.setObjectName("label_8") self.gridLayout.addWidget(self.label_8, 2, 2, 2, 1) self.label_3 = QtWidgets.QLabel(self.groupBox) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) self.maxPowerPointBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.maxPowerPointBox.setObjectName("maxPowerPointBox") self.gridLayout.addWidget(self.maxPowerPointBox, 3, 1, 1, 1) self.rSeriesBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.rSeriesBox.setObjectName("rSeriesBox") self.gridLayout.addWidget(self.rSeriesBox, 3, 3, 1, 1) self.label_4 = QtWidgets.QLabel(self.groupBox) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1) self.fillFactorBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.fillFactorBox.setObjectName("fillFactorBox") self.gridLayout.addWidget(self.fillFactorBox, 4, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.groupBox) self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 5, 0, 1, 1) self.efficiencyBox = QtWidgets.QDoubleSpinBox(self.groupBox) self.efficiencyBox.setObjectName("efficiencyBox") self.gridLayout.addWidget(self.efficiencyBox, 5, 1, 1, 1) self.gridLayout_2.addWidget(self.groupBox, 1, 0, 1, 3) self.savePNGButton = QtWidgets.QPushButton(Dialog) self.savePNGButton.setObjectName("savePNGButton") self.gridLayout_2.addWidget(self.savePNGButton, 2, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(328, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout_2.addItem(spacerItem, 2, 1, 1, 1) self.closeButton = QtWidgets.QPushButton(Dialog) self.closeButton.setObjectName("closeButton") self.gridLayout_2.addWidget(self.closeButton, 2, 2, 1, 1) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.groupBox.setTitle(_translate("Dialog", "Main Parameters of This Solar Cell")) self.label.setText(_translate("Dialog", "jsc [mA/cm]")) self.label_6.setText(_translate("Dialog", "Diode non-ideality factor")) self.label_2.setText(_translate("Dialog", "Uoc [V]")) self.label_7.setText(_translate("Dialog", "Rshunt [Ω]")) self.label_8.setText(_translate("Dialog", "Rseries [Ω]")) self.label_3.setText(_translate("Dialog", "Max. Power Point")) self.label_4.setText(_translate("Dialog", "Fill Factor [%]")) self.label_5.setText(_translate("Dialog", "Efficiency [%]")) self.savePNGButton.setText(_translate("Dialog", "Save as PNG")) self.closeButton.setText(_translate("Dialog", "Close"))
class Ui_Master(object): def setupUi(self, Master): Master.setObjectName("Master") Master.resize(600, 400) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Master.sizePolicy().hasHeightForWidth()) Master.setSizePolicy(sizePolicy) self.gridLayout_2 = QtWidgets.QGridLayout(Master) self.gridLayout_2.setObjectName("gridLayout_2") self.label_g = QtWidgets.QLabel(Master) self.label_g.setObjectName("label_g") self.gridLayout_2.addWidget(self.label_g, 0, 1, 1, 1) self.frame = QtWidgets.QFrame(Master) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.gridLayout = QtWidgets.QGridLayout(self.frame) self.gridLayout.setObjectName("gridLayout") self.cpu_btn = QtWidgets.QPushButton(self.frame) self.cpu_btn.setObjectName("cpu_btn") self.gridLayout.addWidget(self.cpu_btn, 0, 0, 1, 1) self.memory_btn = QtWidgets.QPushButton(self.frame) self.memory_btn.setObjectName("memory_btn") self.gridLayout.addWidget(self.memory_btn, 1, 0, 1, 1) self.disk_btn = QtWidgets.QPushButton(self.frame) self.disk_btn.setObjectName("disk_btn") self.gridLayout.addWidget(self.disk_btn, 2, 0, 1, 1) self.login = QtWidgets.QPushButton(self.frame) self.login.setObjectName("login") self.gridLayout.addWidget(self.login, 3, 0, 1, 1) self.gridLayout_2.addWidget(self.frame, 1, 0, 3, 1) self.graphicsView = QChartView(Master) self.graphicsView.setObjectName("graphicsView") self.gridLayout_2.addWidget(self.graphicsView, 1, 1, 1, 1) self.label_s = QtWidgets.QLabel(Master) self.label_s.setObjectName("label_s") self.gridLayout_2.addWidget(self.label_s, 2, 1, 1, 1) self.status = QtWidgets.QStatusBar(Master) self.status.setObjectName("status") self.status.setStyleSheet(stylestatus) self.status.showMessage("hello ") self.led = QLed(Master, onColour=QLed.Green, shape=QLed.Circle) self.led.setFixedSize(30, 30) self.led.value = False self.gridLayout.addWidget(self.led, 4, 0, 1, 1) self.gridLayout_2.addWidget(self.status, 3, 1, 1, 1) self.retranslateUi(Master) QtCore.QMetaObject.connectSlotsByName(Master) self.disable_buttons(True) def retranslateUi(self, Master): _translate = QtCore.QCoreApplication.translate Master.setWindowTitle(_translate("Master", "Master")) self.label_g.setText(_translate("Master", "Graphics:")) self.cpu_btn.setText(_translate("Master", "CPU")) self.memory_btn.setText(_translate("Master", "Memory")) self.disk_btn.setText(_translate("Master", "Disk usage")) self.login.setText(_translate("Master", "Login")) self.label_s.setText(_translate("Master", "Status:")) def disable_buttons(self, state): self.cpu_btn.setDisabled(state) self.disk_btn.setDisabled(state) self.memory_btn.setDisabled(state)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1072, 821) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_7.setObjectName("verticalLayout_7") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.cvGlycoforms = QChartView(self.groupBox) self.cvGlycoforms.setFrameShape(QtWidgets.QFrame.NoFrame) self.cvGlycoforms.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing) self.cvGlycoforms.setObjectName("cvGlycoforms") self.verticalLayout.addWidget(self.cvGlycoforms) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.cbAggGlycoforms = QtWidgets.QCheckBox(self.groupBox) self.cbAggGlycoforms.setEnabled(False) self.cbAggGlycoforms.setChecked(True) self.cbAggGlycoforms.setObjectName("cbAggGlycoforms") self.horizontalLayout_7.addWidget(self.cbAggGlycoforms) self.sbAggGlycoforms = QtWidgets.QSpinBox(self.groupBox) self.sbAggGlycoforms.setEnabled(False) self.sbAggGlycoforms.setProperty("value", 7) self.sbAggGlycoforms.setObjectName("sbAggGlycoforms") self.horizontalLayout_7.addWidget(self.sbAggGlycoforms) self.lbAggGlycoforms = QtWidgets.QLabel(self.groupBox) self.lbAggGlycoforms.setEnabled(False) self.lbAggGlycoforms.setObjectName("lbAggGlycoforms") self.horizontalLayout_7.addWidget(self.lbAggGlycoforms) spacerItem = QtWidgets.QSpacerItem(1, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_7.addItem(spacerItem) self.verticalLayout.addLayout(self.horizontalLayout_7) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.btLoadGlycoforms = QtWidgets.QPushButton(self.groupBox) self.btLoadGlycoforms.setObjectName("btLoadGlycoforms") self.horizontalLayout_2.addWidget(self.btLoadGlycoforms) spacerItem1 = QtWidgets.QSpacerItem(1, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) self.lbGlycoform = QtWidgets.QLabel(self.groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lbGlycoform.sizePolicy().hasHeightForWidth()) self.lbGlycoform.setSizePolicy(sizePolicy) self.lbGlycoform.setObjectName("lbGlycoform") self.horizontalLayout_2.addWidget(self.lbGlycoform) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_3.addWidget(self.groupBox) self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_2) self.verticalLayout_2.setObjectName("verticalLayout_2") self.cvGlycation = QChartView(self.groupBox_2) self.cvGlycation.setFrameShape(QtWidgets.QFrame.NoFrame) self.cvGlycation.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing) self.cvGlycation.setObjectName("cvGlycation") self.verticalLayout_2.addWidget(self.cvGlycation) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.btLoadGlycation = QtWidgets.QPushButton(self.groupBox_2) self.btLoadGlycation.setObjectName("btLoadGlycation") self.horizontalLayout_4.addWidget(self.btLoadGlycation) spacerItem2 = QtWidgets.QSpacerItem(1, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem2) self.lbGlycation = QtWidgets.QLabel(self.groupBox_2) self.lbGlycation.setObjectName("lbGlycation") self.horizontalLayout_4.addWidget(self.lbGlycation) self.verticalLayout_2.addLayout(self.horizontalLayout_4) self.horizontalLayout_3.addWidget(self.groupBox_2) self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_3) self.verticalLayout_3.setObjectName("verticalLayout_3") self.twLibrary = QtWidgets.QTableWidget(self.groupBox_3) self.twLibrary.setAcceptDrops(True) self.twLibrary.setObjectName("twLibrary") self.twLibrary.setColumnCount(2) self.twLibrary.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.twLibrary.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.twLibrary.setHorizontalHeaderItem(1, item) self.twLibrary.horizontalHeader().setStretchLastSection(True) self.verticalLayout_3.addWidget(self.twLibrary) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.btLoadLibrary = QtWidgets.QPushButton(self.groupBox_3) self.btLoadLibrary.setObjectName("btLoadLibrary") self.horizontalLayout_5.addWidget(self.btLoadLibrary) spacerItem3 = QtWidgets.QSpacerItem(1, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_5.addItem(spacerItem3) self.verticalLayout_3.addLayout(self.horizontalLayout_5) self.horizontalLayout_3.addWidget(self.groupBox_3) self.verticalLayout_7.addLayout(self.horizontalLayout_3) self.groupBox_4 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_4.setObjectName("groupBox_4") self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox_4) self.verticalLayout_5.setObjectName("verticalLayout_5") self.horizontalLayout_9 = QtWidgets.QHBoxLayout() self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.verticalLayout_6 = QtWidgets.QVBoxLayout() self.verticalLayout_6.setSpacing(0) self.verticalLayout_6.setObjectName("verticalLayout_6") self.cvResults = QChartView(self.groupBox_4) self.cvResults.setFrameShape(QtWidgets.QFrame.NoFrame) self.cvResults.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.TextAntialiasing) self.cvResults.setObjectName("cvResults") self.verticalLayout_6.addWidget(self.cvResults) self.lbResults = QtWidgets.QLabel(self.groupBox_4) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lbResults.sizePolicy().hasHeightForWidth()) self.lbResults.setSizePolicy(sizePolicy) self.lbResults.setMinimumSize(QtCore.QSize(0, 15)) self.lbResults.setStyleSheet("QLabel {\n" "background: rgb(255, 255, 255)\n" "}") self.lbResults.setObjectName("lbResults") self.verticalLayout_6.addWidget(self.lbResults) self.horizontalLayout_9.addLayout(self.verticalLayout_6) self.twResults = QtWidgets.QTableWidget(self.groupBox_4) self.twResults.setObjectName("twResults") self.twResults.setColumnCount(6) self.twResults.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() self.twResults.setHorizontalHeaderItem(5, item) self.twResults.horizontalHeader().setDefaultSectionSize(70) self.horizontalLayout_9.addWidget(self.twResults) self.verticalLayout_5.addLayout(self.horizontalLayout_9) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.cbAggResults = QtWidgets.QCheckBox(self.groupBox_4) self.cbAggResults.setEnabled(False) self.cbAggResults.setChecked(True) self.cbAggResults.setObjectName("cbAggResults") self.horizontalLayout_8.addWidget(self.cbAggResults) self.sbAggResults = QtWidgets.QSpinBox(self.groupBox_4) self.sbAggResults.setEnabled(False) self.sbAggResults.setProperty("value", 7) self.sbAggResults.setObjectName("sbAggResults") self.horizontalLayout_8.addWidget(self.sbAggResults) self.lbAggResults = QtWidgets.QLabel(self.groupBox_4) self.lbAggResults.setEnabled(False) self.lbAggResults.setObjectName("lbAggResults") self.horizontalLayout_8.addWidget(self.lbAggResults) spacerItem4 = QtWidgets.QSpacerItem(1, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem4) self.btSaveResults = QtWidgets.QPushButton(self.groupBox_4) self.btSaveResults.setEnabled(False) self.btSaveResults.setObjectName("btSaveResults") self.horizontalLayout_8.addWidget(self.btSaveResults) self.btSaveGraph = QtWidgets.QPushButton(self.groupBox_4) self.btSaveGraph.setEnabled(False) self.btSaveGraph.setObjectName("btSaveGraph") self.horizontalLayout_8.addWidget(self.btSaveGraph) self.verticalLayout_5.addLayout(self.horizontalLayout_8) self.verticalLayout_7.addWidget(self.groupBox_4) self.groupBox_5 = QtWidgets.QGroupBox(self.centralwidget) self.groupBox_5.setObjectName("groupBox_5") self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_5) self.verticalLayout_4.setObjectName("verticalLayout_4") self.teLog = QtWidgets.QTextEdit(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Ignored) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.teLog.sizePolicy().hasHeightForWidth()) self.teLog.setSizePolicy(sizePolicy) self.teLog.setMinimumSize(QtCore.QSize(0, 80)) self.teLog.setReadOnly(True) self.teLog.setObjectName("teLog") self.verticalLayout_4.addWidget(self.teLog) self.verticalLayout_7.addWidget(self.groupBox_5) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.btCorrect = QtWidgets.QPushButton(self.centralwidget) self.btCorrect.setObjectName("btCorrect") self.horizontalLayout_6.addWidget(self.btCorrect) spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_6.addItem(spacerItem5) self.btSampleData = QtWidgets.QPushButton(self.centralwidget) self.btSampleData.setObjectName("btSampleData") self.horizontalLayout_6.addWidget(self.btSampleData) self.btHelp = QtWidgets.QPushButton(self.centralwidget) self.btHelp.setObjectName("btHelp") self.horizontalLayout_6.addWidget(self.btHelp) self.btQuit = QtWidgets.QPushButton(self.centralwidget) self.btQuit.setObjectName("btQuit") self.horizontalLayout_6.addWidget(self.btQuit) self.verticalLayout_7.addLayout(self.horizontalLayout_6) self.groupBox_4.raise_() self.groupBox_5.raise_() MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "cafog")) self.groupBox.setTitle(_translate("MainWindow", "Glycoforms")) self.cbAggGlycoforms.setText( _translate("MainWindow", "Only display the")) self.lbAggGlycoforms.setText( _translate("MainWindow", "most abundant glycoforms")) self.btLoadGlycoforms.setText(_translate("MainWindow", "Load ...")) self.lbGlycoform.setText(_translate("MainWindow", "(glycoform)")) self.groupBox_2.setTitle(_translate("MainWindow", "Glycation")) self.btLoadGlycation.setText(_translate("MainWindow", "Load ...")) self.lbGlycation.setText(_translate("MainWindow", "(glycation)")) self.groupBox_3.setTitle(_translate("MainWindow", "Glycan library")) item = self.twLibrary.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Glycan")) item = self.twLibrary.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "Composition")) self.btLoadLibrary.setText(_translate("MainWindow", "Load ...")) self.groupBox_4.setTitle(_translate("MainWindow", "Results")) self.lbResults.setText(_translate("MainWindow", "(results)")) self.twResults.setSortingEnabled(True) item = self.twResults.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Glycoform")) item = self.twResults.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "Observed")) item = self.twResults.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "Error")) item = self.twResults.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Actual")) item = self.twResults.horizontalHeaderItem(4) item.setText(_translate("MainWindow", "Error")) item = self.twResults.horizontalHeaderItem(5) item.setText(_translate("MainWindow", "Change")) self.cbAggResults.setText(_translate("MainWindow", "Only display the")) self.lbAggResults.setText( _translate("MainWindow", "most abundant glycoforms")) self.btSaveResults.setText(_translate("MainWindow", "Save results ...")) self.btSaveGraph.setText( _translate("MainWindow", "Save glycation graph ...")) self.groupBox_5.setTitle(_translate("MainWindow", "Log")) self.btCorrect.setText(_translate("MainWindow", "Correct abundances")) self.btSampleData.setText(_translate("MainWindow", "Load sample data")) self.btHelp.setText(_translate("MainWindow", "Help")) self.btHelp.setShortcut(_translate("MainWindow", "F1")) self.btQuit.setText(_translate("MainWindow", "Quit"))
class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(333, 504) Dialog.setStyleSheet( "\n" "QWidget {\n" " background-color:rgb(0, 0, 0);\n" " color: rgb(240, 240, 240);\n" " border-color: rgb(58, 58, 58);\n" "}\n" "\n" "QPlainTextEdit {\n" " background-color:rgb(0, 0, 0);\n" " color: rgb(200, 200, 200);\n" " selection-background-color: rgb(255, 153, 0);\n" " selection-color: rgb(0, 0, 0);\n" "}\n" "\n" "QTabWidget::pane {\n" " border-top: 1px solid #000000;\n" "}\n" "\n" "QTabBar::tab {\n" " background-color:rgb(0, 0, 0);\n" " border-style: outset;\n" " border-width: 1px;\n" " border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-bottom-color: rgb(58, 58, 58);\n" " border-bottom-width: 1px;\n" " border-top-width: 0px;\n" " border-style: solid;\n" " color: rgb(255, 153, 0);\n" " padding: 4px;\n" "}\n" "\n" "QTabBar::tab:selected, QTabBar::tab:hover {\n" " color: rgb(255, 255, 255);\n" " background-color:rgb(0, 0, 0);\n" " border-color:rgb(42, 42, 42);\n" " margin-left: 0px;\n" " margin-right: 0px;\n" " border-bottom-right-radius:4px;\n" " border-bottom-left-radius:4px;\n" "}\n" "\n" "QTabBar::tab:last:selected {\n" " background-color:rgb(0, 0, 0);\n" " border-color:rgb(42, 42, 42);\n" " margin-left: 0px;\n" " margin-right: 0px;\n" " border-bottom-right-radius:4px;\n" " border-bottom-left-radius:4px;\n" "}\n" "\n" "QTabBar::tab:!selected {\n" " margin-bottom: 4px;\n" " border-bottom-right-radius:4px;\n" " border-bottom-left-radius:4px;\n" "}\n" "\n" "QPushButton{\n" " border-style: outset;\n" " border-width: 2px;\n" " border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-bottom-color: rgb(58, 58, 58);\n" " border-bottom-width: 1px;\n" " border-style: solid;\n" " color: rgb(255, 255, 255);\n" " padding: 6px;\n" " background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255));\n" "}\n" "\n" "QPushButton:hover{\n" " border-style: outset;\n" " border-width: 2px;\n" " border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));\n" " border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));\n" " border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255));\n" " border-bottom-color: rgb(115, 115, 115);\n" " border-bottom-width: 1px;\n" " border-style: solid;\n" " color: rgb(255, 255, 255);\n" " padding: 6px;\n" " background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255));\n" "}\n" "\n" "QPushButton:pressed{\n" " border-style: outset;\n" " border-width: 2px;\n" " border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255));\n" " border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-bottom-color: rgb(58, 58, 58);\n" " border-bottom-width: 1px;\n" " border-style: solid;\n" " color: rgb(255, 255, 255);\n" " padding: 6px;\n" " background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255));\n" "}\n" "\n" "QPushButton:disabled{\n" " border-style: outset;\n" " border-width: 2px;\n" " border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255));\n" " border-bottom-color: rgb(58, 58, 58);\n" " border-bottom-width: 1px;\n" " border-style: solid;\n" " color: rgb(0, 0, 0);\n" " padding: 6px;\n" " background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255));\n" "}\n" "\n" "QLineEdit {\n" " border-width: 1px; border-radius: 4px;\n" " border-color: rgb(58, 58, 58);\n" " border-style: inset;\n" " padding: 0 8px;\n" " color: rgb(255, 255, 255);\n" " background:rgb(101, 101, 101);\n" " selection-background-color: rgb(187, 187, 187);\n" " selection-color: rgb(60, 63, 65);\n" "}\n" "\n" "QProgressBar {\n" " text-align: center;\n" " color: rgb(255, 255, 255);\n" " border-width: 1px; \n" " border-radius: 10px;\n" " border-color: rgb(58, 58, 58);\n" " border-style: inset;\n" "}\n" "\n" "QProgressBar::chunk {\n" " background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(0, 200, 0, 255), stop:1 rgba(30, 230, 30, 255));\n" " border-radius: 10px;\n" "}\n" "\n" "QMenuBar {\n" " background:rgb(0, 0, 0);\n" " color: rgb(255, 153, 0);\n" "}\n" "\n" "QMenuBar::item {\n" " spacing: 3px; \n" " padding: 1px 4px;\n" " background: transparent;\n" "}\n" "\n" "QMenuBar::item:selected { \n" " background:rgb(115, 115, 115);\n" "}\n" "\n" "QMenu {\n" " border-width: 2px; \n" " border-radius: 10px;\n" " border-color: rgb(255, 153, 0);\n" " border-style: outset;\n" "}\n" "\n" "QMenu::item {\n" " spacing: 3px; \n" " padding: 3px 15px;\n" "}\n" "\n" "QMenu::item:selected {\n" " spacing: 3px; \n" " padding: 3px 15px;\n" " background:rgb(115, 115, 115);\n" " color:rgb(255, 255, 255);\n" " border-width: 1px; \n" " border-radius: 10px;\n" " border-color: rgb(58, 58, 58);\n" " border-style: inset;\n" "}\n" "\n" "QLabel, QComboBox{\n" " font-size: 26px;\n" " border: 2px solid green;\n" " border-radius: 4px;\n" " padding: 2px;\n" "}\n" "\n" "QLCDNumber{\n" " border: 2px solid green;\n" " border-radius: 4px;\n" "}\n" "") self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.title = QtWidgets.QLabel(Dialog) self.title.setAlignment(QtCore.Qt.AlignCenter) self.title.setWordWrap(False) self.title.setObjectName("title") self.verticalLayout.addWidget(self.title) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.total_confirmed_num = QtWidgets.QLCDNumber(Dialog) self.total_confirmed_num.setDigitCount(9) self.total_confirmed_num.setObjectName("total_confirmed_num") self.gridLayout.addWidget(self.total_confirmed_num, 0, 1, 1, 1) self.total_deaths_num = QtWidgets.QLCDNumber(Dialog) self.total_deaths_num.setDigitCount(9) self.total_deaths_num.setObjectName("total_deaths_num") self.gridLayout.addWidget(self.total_deaths_num, 1, 1, 1, 1) self.total_deaths = QtWidgets.QLabel(Dialog) self.total_deaths.setObjectName("total_deaths") self.gridLayout.addWidget(self.total_deaths, 1, 0, 1, 1) self.total_recovered = QtWidgets.QLabel(Dialog) self.total_recovered.setObjectName("total_recovered") self.gridLayout.addWidget(self.total_recovered, 3, 0, 1, 1) self.total_confirmed = QtWidgets.QLabel(Dialog) self.total_confirmed.setObjectName("total_confirmed") self.gridLayout.addWidget(self.total_confirmed, 0, 0, 1, 1) self.total_recovered_num = QtWidgets.QLCDNumber(Dialog) self.total_recovered_num.setDigitCount(9) self.total_recovered_num.setObjectName("total_recovered_num") self.gridLayout.addWidget(self.total_recovered_num, 3, 1, 1, 1) self.total_active = QtWidgets.QLabel(Dialog) self.total_active.setObjectName("total_active") self.gridLayout.addWidget(self.total_active, 4, 0, 1, 1) self.total_active_num = QtWidgets.QLCDNumber(Dialog) self.total_active_num.setDigitCount(9) self.total_active_num.setObjectName("total_active_num") self.gridLayout.addWidget(self.total_active_num, 4, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.comboBox = QtWidgets.QComboBox(Dialog) self.comboBox.setObjectName("comboBox") self.verticalLayout.addWidget(self.comboBox) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.confirmed_button = QtWidgets.QPushButton(Dialog) self.confirmed_button.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) self.confirmed_button.setObjectName("confirmed_button") self.horizontalLayout_2.addWidget(self.confirmed_button) self.deaths_button = QtWidgets.QPushButton(Dialog) self.deaths_button.setObjectName("deaths_button") self.horizontalLayout_2.addWidget(self.deaths_button) self.recovered_button = QtWidgets.QPushButton(Dialog) self.recovered_button.setObjectName("recovered_button") self.horizontalLayout_2.addWidget(self.recovered_button) self.active_button = QtWidgets.QPushButton(Dialog) self.active_button.setObjectName("active_button") self.horizontalLayout_2.addWidget(self.active_button) self.verticalLayout.addLayout(self.horizontalLayout_2) self.graphicsView = QChartView(Dialog) self.graphicsView.setMinimumSize(QtCore.QSize(0, 0)) self.graphicsView.setObjectName("graphicsView") self.verticalLayout.addWidget(self.graphicsView) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "QtCorona")) self.title.setText(_translate("Dialog", "Global Corona Status")) self.total_deaths.setText(_translate("Dialog", "Total Deaths")) self.total_recovered.setText(_translate("Dialog", "Total Recovered")) self.total_confirmed.setText(_translate("Dialog", "Total Confirmed")) self.total_active.setText(_translate("Dialog", "Total Active")) self.confirmed_button.setText(_translate("Dialog", "Confirmed")) self.deaths_button.setText(_translate("Dialog", "Deaths")) self.recovered_button.setText(_translate("Dialog", "Recovered")) self.active_button.setText(_translate("Dialog", "Actives"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(637, 449) font = QtGui.QFont() font.setPointSize(10) MainWindow.setFont(font) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralWidget) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.verticalLayout_3.setSpacing(6) self.verticalLayout_3.setObjectName("verticalLayout_3") self.splitter = QtWidgets.QSplitter(self.centralWidget) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.frameSetup = QtWidgets.QFrame(self.splitter) self.frameSetup.setMaximumSize(QtCore.QSize(220, 16777215)) self.frameSetup.setFrameShape(QtWidgets.QFrame.Panel) self.frameSetup.setFrameShadow(QtWidgets.QFrame.Raised) self.frameSetup.setObjectName("frameSetup") self.verticalLayout = QtWidgets.QVBoxLayout(self.frameSetup) self.verticalLayout.setContentsMargins(5, 5, 5, 5) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName("verticalLayout") self.groupBox_4 = QtWidgets.QGroupBox(self.frameSetup) self.groupBox_4.setObjectName("groupBox_4") self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_4) self.gridLayout_4.setContentsMargins(11, 5, 11, 5) self.gridLayout_4.setSpacing(6) self.gridLayout_4.setObjectName("gridLayout_4") self.label_7 = QtWidgets.QLabel(self.groupBox_4) self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_7.setIndent(10) self.label_7.setObjectName("label_7") self.gridLayout_4.addWidget(self.label_7, 0, 0, 1, 1) self.comboTheme = QtWidgets.QComboBox(self.groupBox_4) self.comboTheme.setMaximumSize(QtCore.QSize(100, 16777215)) self.comboTheme.setObjectName("comboTheme") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.comboTheme.addItem("") self.gridLayout_4.addWidget(self.comboTheme, 0, 1, 1, 1) self.chkBox_ShowPoints = QtWidgets.QCheckBox(self.groupBox_4) self.chkBox_ShowPoints.setChecked(True) self.chkBox_ShowPoints.setObjectName("chkBox_ShowPoints") self.gridLayout_4.addWidget(self.chkBox_ShowPoints, 2, 1, 1, 1) self.verticalLayout.addWidget(self.groupBox_4) self.groupBox_2 = QtWidgets.QGroupBox(self.frameSetup) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout.setContentsMargins(11, 5, 11, 5) self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.label_3 = QtWidgets.QLabel(self.groupBox_2) self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_3.setIndent(10) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1) self.spinAngle_Min = QtWidgets.QSpinBox(self.groupBox_2) self.spinAngle_Min.setMinimum(-3600) self.spinAngle_Min.setMaximum(3600) self.spinAngle_Min.setSingleStep(10) self.spinAngle_Min.setObjectName("spinAngle_Min") self.gridLayout.addWidget(self.spinAngle_Min, 0, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_4.setIndent(10) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1) self.spinAngle_Max = QtWidgets.QSpinBox(self.groupBox_2) self.spinAngle_Max.setMinimum(-3600) self.spinAngle_Max.setMaximum(3600) self.spinAngle_Max.setSingleStep(10) self.spinAngle_Max.setProperty("value", 360) self.spinAngle_Max.setObjectName("spinAngle_Max") self.gridLayout.addWidget(self.spinAngle_Max, 1, 1, 1, 1) self.label = QtWidgets.QLabel(self.groupBox_2) self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label.setIndent(10) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 2, 0, 1, 1) self.spinAngle_Ticks = QtWidgets.QSpinBox(self.groupBox_2) self.spinAngle_Ticks.setMinimum(4) self.spinAngle_Ticks.setMaximum(5000) self.spinAngle_Ticks.setProperty("value", 9) self.spinAngle_Ticks.setObjectName("spinAngle_Ticks") self.gridLayout.addWidget(self.spinAngle_Ticks, 2, 1, 1, 1) self.verticalLayout.addWidget(self.groupBox_2) self.groupBox_3 = QtWidgets.QGroupBox(self.frameSetup) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_3) self.gridLayout_2.setContentsMargins(11, 5, 11, 5) self.gridLayout_2.setSpacing(6) self.gridLayout_2.setObjectName("gridLayout_2") self.label_2 = QtWidgets.QLabel(self.groupBox_3) self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_2.setIndent(10) self.label_2.setObjectName("label_2") self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1) self.spinRadial_Max = QtWidgets.QSpinBox(self.groupBox_3) self.spinRadial_Max.setMinimum(1) self.spinRadial_Max.setMaximum(500) self.spinRadial_Max.setProperty("value", 12) self.spinRadial_Max.setObjectName("spinRadial_Max") self.gridLayout_2.addWidget(self.spinRadial_Max, 0, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.groupBox_3) self.label_5.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_5.setIndent(10) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 1, 0, 1, 1) self.spinRadial_Ticks = QtWidgets.QSpinBox(self.groupBox_3) self.spinRadial_Ticks.setMinimum(2) self.spinRadial_Ticks.setMaximum(100) self.spinRadial_Ticks.setProperty("value", 6) self.spinRadial_Ticks.setObjectName("spinRadial_Ticks") self.gridLayout_2.addWidget(self.spinRadial_Ticks, 1, 1, 1, 1) self.verticalLayout.addWidget(self.groupBox_3) self.groupBox = QtWidgets.QGroupBox(self.frameSetup) self.groupBox.setObjectName("groupBox") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_3.setContentsMargins(11, 5, 11, 5) self.gridLayout_3.setSpacing(6) self.gridLayout_3.setObjectName("gridLayout_3") self.label_6 = QtWidgets.QLabel(self.groupBox) self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_6.setIndent(10) self.label_6.setObjectName("label_6") self.gridLayout_3.addWidget(self.label_6, 1, 0, 1, 1) self.spinRotate = QtWidgets.QSpinBox(self.groupBox) self.spinRotate.setMinimum(-180) self.spinRotate.setMaximum(180) self.spinRotate.setProperty("value", 90) self.spinRotate.setObjectName("spinRotate") self.gridLayout_3.addWidget(self.spinRotate, 1, 1, 1, 1) self.btnRotate = QtWidgets.QPushButton(self.groupBox) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/images/images/exec.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnRotate.setIcon(icon) self.btnRotate.setObjectName("btnRotate") self.gridLayout_3.addWidget(self.btnRotate, 2, 1, 1, 1) self.label_8 = QtWidgets.QLabel(self.groupBox) self.label_8.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_8.setIndent(10) self.label_8.setObjectName("label_8") self.gridLayout_3.addWidget(self.label_8, 0, 0, 1, 1) self.spinCount = QtWidgets.QSpinBox(self.groupBox) self.spinCount.setMinimum(2) self.spinCount.setMaximum(100) self.spinCount.setProperty("value", 3) self.spinCount.setObjectName("spinCount") self.gridLayout_3.addWidget(self.spinCount, 0, 1, 1, 1) self.verticalLayout.addWidget(self.groupBox) spacerItem = QtWidgets.QSpacerItem(20, 106, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.frameChart = QtWidgets.QFrame(self.splitter) self.frameChart.setFrameShape(QtWidgets.QFrame.Panel) self.frameChart.setFrameShadow(QtWidgets.QFrame.Raised) self.frameChart.setObjectName("frameChart") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frameChart) self.verticalLayout_2.setContentsMargins(2, 2, 2, 2) self.verticalLayout_2.setSpacing(6) self.verticalLayout_2.setObjectName("verticalLayout_2") self.chartView = QChartView(self.frameChart) self.chartView.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag) self.chartView.setObjectName("chartView") self.verticalLayout_2.addWidget(self.chartView) self.verticalLayout_3.addWidget(self.splitter) MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 637, 23)) self.menuBar.setObjectName("menuBar") MainWindow.setMenuBar(self.menuBar) self.mainToolBar = QtWidgets.QToolBar(MainWindow) self.mainToolBar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.mainToolBar.setObjectName("mainToolBar") MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.actZoomReset = QtWidgets.QAction(MainWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/images/images/414.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomReset.setIcon(icon1) self.actZoomReset.setObjectName("actZoomReset") self.actQuit = QtWidgets.QAction(MainWindow) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/images/images/132.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actQuit.setIcon(icon2) self.actQuit.setObjectName("actQuit") self.actZoomIn = QtWidgets.QAction(MainWindow) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/images/images/418.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomIn.setIcon(icon3) self.actZoomIn.setObjectName("actZoomIn") self.actZoomOut = QtWidgets.QAction(MainWindow) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/images/images/416.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actZoomOut.setIcon(icon4) self.actZoomOut.setObjectName("actZoomOut") self.actRedraw = QtWidgets.QAction(MainWindow) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/images/images/828.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actRedraw.setIcon(icon5) self.actRedraw.setObjectName("actRedraw") self.mainToolBar.addAction(self.actRedraw) self.mainToolBar.addAction(self.actZoomIn) self.mainToolBar.addAction(self.actZoomOut) self.mainToolBar.addAction(self.actZoomReset) self.mainToolBar.addSeparator() self.mainToolBar.addAction(self.actQuit) self.retranslateUi(MainWindow) self.actQuit.triggered.connect(MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "极坐标图")) self.groupBox_4.setTitle(_translate("MainWindow", "图表")) self.label_7.setText(_translate("MainWindow", "主题")) self.comboTheme.setToolTip(_translate("MainWindow", "设置图表主题")) self.comboTheme.setItemText(0, _translate("MainWindow", "Light")) self.comboTheme.setItemText(1, _translate("MainWindow", "BlueCerulean")) self.comboTheme.setItemText(2, _translate("MainWindow", "Dark")) self.comboTheme.setItemText(3, _translate("MainWindow", "BrownSand")) self.comboTheme.setItemText(4, _translate("MainWindow", "BlueNcs")) self.comboTheme.setItemText(5, _translate("MainWindow", "HighContrast")) self.comboTheme.setItemText(6, _translate("MainWindow", "BlueIcy")) self.comboTheme.setItemText(7, _translate("MainWindow", "Qt")) self.chkBox_ShowPoints.setText(_translate("MainWindow", "显示数据点")) self.groupBox_2.setTitle(_translate("MainWindow", "角度坐标轴")) self.label_3.setText(_translate("MainWindow", "最小值")) self.spinAngle_Min.setSuffix(_translate("MainWindow", "°")) self.label_4.setText(_translate("MainWindow", "最大值")) self.spinAngle_Max.setSuffix(_translate("MainWindow", "°")) self.label.setText(_translate("MainWindow", "圆周刻度数")) self.groupBox_3.setTitle(_translate("MainWindow", "径向坐标轴")) self.label_2.setText(_translate("MainWindow", "径向长度")) self.label_5.setText(_translate("MainWindow", "径向刻度数")) self.groupBox.setTitle(_translate("MainWindow", "图形形状")) self.label_6.setText(_translate("MainWindow", "旋转角度")) self.spinRotate.setToolTip(_translate("MainWindow", "顺时针方向为正")) self.spinRotate.setSuffix(_translate("MainWindow", "°")) self.btnRotate.setText(_translate("MainWindow", "旋转")) self.label_8.setText(_translate("MainWindow", "叶瓣系数")) self.actZoomReset.setText(_translate("MainWindow", "原始大小")) self.actZoomReset.setToolTip(_translate("MainWindow", "原始大小")) self.actQuit.setText(_translate("MainWindow", "退出")) self.actQuit.setToolTip(_translate("MainWindow", "退出")) self.actZoomIn.setText(_translate("MainWindow", "放大")) self.actZoomIn.setToolTip(_translate("MainWindow", "放大")) self.actZoomOut.setText(_translate("MainWindow", "缩小")) self.actZoomOut.setToolTip(_translate("MainWindow", "缩小")) self.actRedraw.setText(_translate("MainWindow", "重绘原始图形")) self.actRedraw.setToolTip(_translate("MainWindow", "重绘原始图形"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 640) MainWindow.setMinimumSize(QtCore.QSize(800, 640)) MainWindow.setMaximumSize(QtCore.QSize(800, 640)) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.main_frame = QtWidgets.QFrame(self.centralwidget) self.main_frame.setObjectName("main_frame") self.gridLayout_7 = QtWidgets.QGridLayout(self.main_frame) self.gridLayout_7.setObjectName("gridLayout_7") self.stripchart = QChartView(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.stripchart.sizePolicy().hasHeightForWidth()) self.stripchart.setSizePolicy(sizePolicy) self.stripchart.setMinimumSize(QtCore.QSize(100, 0)) self.stripchart.setObjectName("stripchart") self.gridLayout_7.addWidget(self.stripchart, 0, 1, 3, 1) self.groupBox = QtWidgets.QGroupBox(self.main_frame) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.groupBox.setFont(font) self.groupBox.setObjectName("groupBox") self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_5.setObjectName("gridLayout_5") self.message_label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(20) self.message_label.setFont(font) self.message_label.setObjectName("message_label") self.gridLayout_5.addWidget(self.message_label, 0, 0, 1, 1) self.progressBar = QtWidgets.QProgressBar(self.groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth()) self.progressBar.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.progressBar.setFont(font) self.progressBar.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.progressBar.setInvertedAppearance(False) self.progressBar.setObjectName("progressBar") self.gridLayout_5.addWidget(self.progressBar, 1, 0, 1, 1) self.gridLayout_7.addWidget(self.groupBox, 0, 0, 1, 1) self.stripchart_control_group = QtWidgets.QGroupBox(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.stripchart_control_group.sizePolicy().hasHeightForWidth()) self.stripchart_control_group.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.stripchart_control_group.setFont(font) self.stripchart_control_group.setObjectName("stripchart_control_group") self.gridLayout_4 = QtWidgets.QGridLayout(self.stripchart_control_group) self.gridLayout_4.setObjectName("gridLayout_4") self.frame_2 = QtWidgets.QFrame(self.stripchart_control_group) self.frame_2.setObjectName("frame_2") self.gridLayout_3 = QtWidgets.QGridLayout(self.frame_2) self.gridLayout_3.setContentsMargins(-1, 0, -1, 0) self.gridLayout_3.setObjectName("gridLayout_3") self.stripchart_slower_label = QtWidgets.QLabel(self.frame_2) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.stripchart_slower_label.setFont(font) self.stripchart_slower_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.stripchart_slower_label.setObjectName("stripchart_slower_label") self.gridLayout_3.addWidget(self.stripchart_slower_label, 0, 0, 1, 1) self.stripchart_speed_slider = QtWidgets.QSlider(self.frame_2) self.stripchart_speed_slider.setMaximum(6) self.stripchart_speed_slider.setProperty("value", 3) self.stripchart_speed_slider.setOrientation(QtCore.Qt.Horizontal) self.stripchart_speed_slider.setTickPosition(QtWidgets.QSlider.TicksBothSides) self.stripchart_speed_slider.setTickInterval(1) self.stripchart_speed_slider.setObjectName("stripchart_speed_slider") self.gridLayout_3.addWidget(self.stripchart_speed_slider, 0, 1, 1, 1) self.stripchart_faster_label = QtWidgets.QLabel(self.frame_2) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.stripchart_faster_label.setFont(font) self.stripchart_faster_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.stripchart_faster_label.setObjectName("stripchart_faster_label") self.gridLayout_3.addWidget(self.stripchart_faster_label, 0, 2, 1, 1) self.gridLayout_4.addWidget(self.frame_2, 0, 0, 1, 4) self.frame = QtWidgets.QFrame(self.stripchart_control_group) self.frame.setObjectName("frame") self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.chart_clear_button = QtWidgets.QPushButton(self.frame) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.chart_clear_button.setFont(font) self.chart_clear_button.setObjectName("chart_clear_button") self.horizontalLayout.addWidget(self.chart_clear_button) self.chart_legacy_button = QtWidgets.QPushButton(self.frame) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.chart_legacy_button.setFont(font) self.chart_legacy_button.setObjectName("chart_legacy_button") self.horizontalLayout.addWidget(self.chart_legacy_button) self.gridLayout_4.addWidget(self.frame, 3, 0, 1, 4) self.gridLayout_7.addWidget(self.stripchart_control_group, 2, 0, 1, 1) self.data_display_group = QtWidgets.QGroupBox(self.main_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.data_display_group.sizePolicy().hasHeightForWidth()) self.data_display_group.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.data_display_group.setFont(font) self.data_display_group.setObjectName("data_display_group") self.gridLayout_2 = QtWidgets.QGridLayout(self.data_display_group) self.gridLayout_2.setObjectName("gridLayout_2") self.dec_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) self.dec_label.setFont(font) self.dec_label.setObjectName("dec_label") self.gridLayout_2.addWidget(self.dec_label, 2, 0, 1, 1) self.channelB_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) self.channelB_label.setFont(font) self.channelB_label.setObjectName("channelB_label") self.gridLayout_2.addWidget(self.channelB_label, 5, 0, 1, 1) self.dec_value = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.dec_value.setFont(font) self.dec_value.setScaledContents(False) self.dec_value.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.dec_value.setObjectName("dec_value") self.gridLayout_2.addWidget(self.dec_value, 2, 1, 1, 1) self.channelA_value = QtWidgets.QLabel(self.data_display_group) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(33, 150, 243)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) self.channelA_value.setPalette(palette) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.channelA_value.setFont(font) self.channelA_value.setScaledContents(False) self.channelA_value.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.channelA_value.setObjectName("channelA_value") self.gridLayout_2.addWidget(self.channelA_value, 3, 1, 1, 1) self.channelA_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) self.channelA_label.setFont(font) self.channelA_label.setObjectName("channelA_label") self.gridLayout_2.addWidget(self.channelA_label, 3, 0, 1, 1) self.ra_value = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.ra_value.setFont(font) self.ra_value.setScaledContents(False) self.ra_value.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ra_value.setObjectName("ra_value") self.gridLayout_2.addWidget(self.ra_value, 1, 1, 1, 1) self.channelB_value = QtWidgets.QLabel(self.data_display_group) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(255, 82, 82)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush) brush = QtGui.QBrush(QtGui.QColor(127, 127, 127)) brush.setStyle(QtCore.Qt.SolidPattern) palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush) self.channelB_value.setPalette(palette) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) font.setBold(True) font.setWeight(75) self.channelB_value.setFont(font) self.channelB_value.setScaledContents(False) self.channelB_value.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.channelB_value.setObjectName("channelB_value") self.gridLayout_2.addWidget(self.channelB_value, 5, 1, 1, 1) self.ra_label = QtWidgets.QLabel(self.data_display_group) font = QtGui.QFont() font.setFamily("Iosevka Aile") font.setPointSize(22) self.ra_label.setFont(font) self.ra_label.setObjectName("ra_label") self.gridLayout_2.addWidget(self.ra_label, 1, 0, 1, 1) self.gridLayout_7.addWidget(self.data_display_group, 1, 0, 1, 1) self.gridLayout.addWidget(self.main_frame, 0, 0, 1, 1) self.testing_frame = QtWidgets.QFrame(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.testing_frame.sizePolicy().hasHeightForWidth()) self.testing_frame.setSizePolicy(sizePolicy) self.testing_frame.setMinimumSize(QtCore.QSize(0, 180)) self.testing_frame.setObjectName("testing_frame") self.gridLayout_8 = QtWidgets.QGridLayout(self.testing_frame) self.gridLayout_8.setContentsMargins(-1, 0, -1, -1) self.gridLayout_8.setObjectName("gridLayout_8") self.dec_group_box = QtWidgets.QGroupBox(self.testing_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dec_group_box.sizePolicy().hasHeightForWidth()) self.dec_group_box.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.dec_group_box.setFont(font) self.dec_group_box.setObjectName("dec_group_box") self.gridLayout_9 = QtWidgets.QGridLayout(self.dec_group_box) self.gridLayout_9.setObjectName("gridLayout_9") self.declination_slider = QtWidgets.QSlider(self.dec_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.declination_slider.setFont(font) self.declination_slider.setMinimum(-25) self.declination_slider.setMaximum(95) self.declination_slider.setSingleStep(5) self.declination_slider.setObjectName("declination_slider") self.gridLayout_9.addWidget(self.declination_slider, 0, 0, 2, 1) self.north_label = QtWidgets.QLabel(self.dec_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.north_label.setFont(font) self.north_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.north_label.setObjectName("north_label") self.gridLayout_9.addWidget(self.north_label, 0, 1, 1, 1) self.south_label = QtWidgets.QLabel(self.dec_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.south_label.setFont(font) self.south_label.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) self.south_label.setObjectName("south_label") self.gridLayout_9.addWidget(self.south_label, 1, 1, 1, 1) self.gridLayout_8.addWidget(self.dec_group_box, 0, 1, 1, 1) self.signal_group_box = QtWidgets.QGroupBox(self.testing_frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.signal_group_box.sizePolicy().hasHeightForWidth()) self.signal_group_box.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.signal_group_box.setFont(font) self.signal_group_box.setObjectName("signal_group_box") self.gridLayout_6 = QtWidgets.QGridLayout(self.signal_group_box) self.gridLayout_6.setObjectName("gridLayout_6") self.variance_dial = QtWidgets.QDial(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.variance_dial.setFont(font) self.variance_dial.setMinimum(0) self.variance_dial.setMaximum(16) self.variance_dial.setPageStep(4) self.variance_dial.setProperty("value", 4) self.variance_dial.setWrapping(False) self.variance_dial.setNotchTarget(1.0) self.variance_dial.setNotchesVisible(True) self.variance_dial.setObjectName("variance_dial") self.gridLayout_6.addWidget(self.variance_dial, 1, 0, 1, 1) self.variance_label = QtWidgets.QLabel(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.variance_label.setFont(font) self.variance_label.setAlignment(QtCore.Qt.AlignCenter) self.variance_label.setObjectName("variance_label") self.gridLayout_6.addWidget(self.variance_label, 0, 0, 1, 1) self.polarization_label = QtWidgets.QLabel(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.polarization_label.setFont(font) self.polarization_label.setAlignment(QtCore.Qt.AlignCenter) self.polarization_label.setObjectName("polarization_label") self.gridLayout_6.addWidget(self.polarization_label, 0, 1, 1, 1) self.noise_label = QtWidgets.QLabel(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.noise_label.setFont(font) self.noise_label.setAlignment(QtCore.Qt.AlignCenter) self.noise_label.setObjectName("noise_label") self.gridLayout_6.addWidget(self.noise_label, 0, 3, 1, 1) self.polarization_dial = QtWidgets.QDial(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.polarization_dial.setFont(font) self.polarization_dial.setMinimum(0) self.polarization_dial.setMaximum(16) self.polarization_dial.setPageStep(4) self.polarization_dial.setProperty("value", 4) self.polarization_dial.setWrapping(False) self.polarization_dial.setNotchTarget(1.0) self.polarization_dial.setNotchesVisible(True) self.polarization_dial.setObjectName("polarization_dial") self.gridLayout_6.addWidget(self.polarization_dial, 1, 1, 1, 1) self.noise_dial = QtWidgets.QDial(self.signal_group_box) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.noise_dial.setFont(font) self.noise_dial.setMinimum(0) self.noise_dial.setMaximum(16) self.noise_dial.setPageStep(4) self.noise_dial.setProperty("value", 4) self.noise_dial.setWrapping(False) self.noise_dial.setNotchTarget(1.0) self.noise_dial.setNotchesVisible(True) self.noise_dial.setObjectName("noise_dial") self.gridLayout_6.addWidget(self.noise_dial, 1, 3, 1, 1) self.gridLayout_8.addWidget(self.signal_group_box, 0, 0, 1, 1) self.gridLayout.addWidget(self.testing_frame, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22)) font = QtGui.QFont() font.setFamily("Iosevka Aile") self.menubar.setFont(font) self.menubar.setObjectName("menubar") self.menuCalibration = QtWidgets.QMenu(self.menubar) self.menuCalibration.setObjectName("menuCalibration") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.menuNew = QtWidgets.QMenu(self.menuFile) self.menuNew.setObjectName("menuNew") self.menuMode = QtWidgets.QMenu(self.menubar) self.menuMode.setObjectName("menuMode") MainWindow.setMenuBar(self.menubar) self.actionRA = QtWidgets.QAction(MainWindow) self.actionRA.setObjectName("actionRA") self.actionDec = QtWidgets.QAction(MainWindow) self.actionDec.setObjectName("actionDec") self.actionSurvey = QtWidgets.QAction(MainWindow) self.actionSurvey.setObjectName("actionSurvey") self.actionInfo = QtWidgets.QAction(MainWindow) self.actionInfo.setObjectName("actionInfo") self.actionQuit = QtWidgets.QAction(MainWindow) self.actionQuit.setObjectName("actionQuit") self.actionHelp = QtWidgets.QAction(MainWindow) self.actionHelp.setEnabled(False) self.actionHelp.setObjectName("actionHelp") self.actionScan = QtWidgets.QAction(MainWindow) self.actionScan.setObjectName("actionScan") self.actionSpectrum = QtWidgets.QAction(MainWindow) self.actionSpectrum.setObjectName("actionSpectrum") self.actionNormal = QtWidgets.QAction(MainWindow) self.actionNormal.setCheckable(True) self.actionNormal.setObjectName("actionNormal") self.actionTesting = QtWidgets.QAction(MainWindow) self.actionTesting.setCheckable(True) self.actionTesting.setObjectName("actionTesting") self.actionLegacy = QtWidgets.QAction(MainWindow) self.actionLegacy.setCheckable(True) self.actionLegacy.setObjectName("actionLegacy") self.menuCalibration.addAction(self.actionRA) self.menuCalibration.addAction(self.actionDec) self.menuNew.addAction(self.actionSurvey) self.menuNew.addAction(self.actionScan) self.menuNew.addAction(self.actionSpectrum) self.menuFile.addAction(self.menuNew.menuAction()) self.menuFile.addSeparator() self.menuFile.addAction(self.actionHelp) self.menuFile.addAction(self.actionInfo) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuMode.addAction(self.actionNormal) self.menuMode.addAction(self.actionLegacy) self.menuMode.addAction(self.actionTesting) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuCalibration.menuAction()) self.menubar.addAction(self.menuMode.menuAction()) self.retranslateUi(MainWindow) self.actionQuit.triggered.connect(MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.groupBox.setTitle(_translate("MainWindow", "Info")) self.message_label.setText(_translate("MainWindow", "...")) self.stripchart_control_group.setTitle(_translate("MainWindow", "Strip chart")) self.stripchart_slower_label.setText(_translate("MainWindow", "Slower")) self.stripchart_faster_label.setText(_translate("MainWindow", "Faster")) self.chart_clear_button.setText(_translate("MainWindow", "Clear chart")) self.chart_legacy_button.setText(_translate("MainWindow", "Legacy Mode")) self.data_display_group.setTitle(_translate("MainWindow", "Data")) self.dec_label.setText(_translate("MainWindow", "Declination:")) self.channelB_label.setText(_translate("MainWindow", "Channel B voltage:")) self.dec_value.setText(_translate("MainWindow", "0.0deg")) self.channelA_value.setText(_translate("MainWindow", "0.00V")) self.channelA_label.setText(_translate("MainWindow", "Channel A voltage:")) self.ra_value.setText(_translate("MainWindow", "00:00:00")) self.channelB_value.setText(_translate("MainWindow", "0.00V")) self.ra_label.setText(_translate("MainWindow", "Right Ascension:")) self.dec_group_box.setTitle(_translate("MainWindow", "Declination")) self.north_label.setText(_translate("MainWindow", "North")) self.south_label.setText(_translate("MainWindow", "South")) self.signal_group_box.setTitle(_translate("MainWindow", "Signal")) self.variance_label.setText(_translate("MainWindow", "Variance")) self.polarization_label.setText(_translate("MainWindow", "Polarization")) self.noise_label.setText(_translate("MainWindow", "Interference")) self.menuCalibration.setTitle(_translate("MainWindow", "Calibrate")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuNew.setTitle(_translate("MainWindow", "New")) self.menuMode.setTitle(_translate("MainWindow", "Mode")) self.actionRA.setText(_translate("MainWindow", "RA...")) self.actionDec.setText(_translate("MainWindow", "Dec...")) self.actionSurvey.setText(_translate("MainWindow", "Survey")) self.actionSurvey.setShortcut(_translate("MainWindow", "Ctrl+1")) self.actionInfo.setText(_translate("MainWindow", "Credits...")) self.actionQuit.setText(_translate("MainWindow", "Exit")) self.actionHelp.setText(_translate("MainWindow", "Help...")) self.actionScan.setText(_translate("MainWindow", "Scan")) self.actionScan.setShortcut(_translate("MainWindow", "Ctrl+2")) self.actionSpectrum.setText(_translate("MainWindow", "Spectrum")) self.actionSpectrum.setShortcut(_translate("MainWindow", "Ctrl+3")) self.actionNormal.setText(_translate("MainWindow", "Normal")) self.actionNormal.setShortcut(_translate("MainWindow", "Ctrl+N")) self.actionTesting.setText(_translate("MainWindow", "Testing")) self.actionTesting.setShortcut(_translate("MainWindow", "Ctrl+T")) self.actionLegacy.setText(_translate("MainWindow", "Legacy")) self.actionLegacy.setShortcut(_translate("MainWindow", "Ctrl+Z"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1000, 666) MainWindow.setMinimumSize(QtCore.QSize(1000, 666)) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout_2.setObjectName("verticalLayout_2") self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget) self.stackedWidget.setObjectName("stackedWidget") self.home = QtWidgets.QWidget() self.home.setObjectName("home") self.horizontalLayout = QtWidgets.QHBoxLayout(self.home) self.horizontalLayout.setObjectName("horizontalLayout") self.btn_load = QtWidgets.QPushButton(self.home) self.btn_load.setMinimumSize(QtCore.QSize(200, 50)) self.btn_load.setObjectName("btn_load") self.horizontalLayout.addWidget( self.btn_load, 0, QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.stackedWidget.addWidget(self.home) self.analytics = QtWidgets.QWidget() self.analytics.setObjectName("analytics") self.verticalLayout = QtWidgets.QVBoxLayout(self.analytics) self.verticalLayout.setObjectName("verticalLayout") self.block_bar = QtWidgets.QStackedWidget(self.analytics) self.block_bar.setObjectName("block_bar") self.block_diagram = QtWidgets.QWidget() self.block_diagram.setObjectName("block_diagram") self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.block_diagram) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.v_block_diagram = QtWidgets.QGraphicsView(self.block_diagram) self.v_block_diagram.setObjectName("v_block_diagram") self.horizontalLayout_3.addWidget(self.v_block_diagram) self.block_bar.addWidget(self.block_diagram) self.bar_diagram = QtWidgets.QWidget() self.bar_diagram.setObjectName("bar_diagram") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.bar_diagram) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.v_bar_chart = QChartView(self.bar_diagram) self.v_bar_chart.setObjectName("v_bar_chart") self.horizontalLayout_4.addWidget(self.v_bar_chart) self.block_bar.addWidget(self.bar_diagram) self.verticalLayout.addWidget(self.block_bar) self.qtcharts = QtWidgets.QHBoxLayout() self.qtcharts.setObjectName("qtcharts") self.v_method_pie = QChartView(self.analytics) self.v_method_pie.setObjectName("v_method_pie") self.qtcharts.addWidget(self.v_method_pie) self.v_cumulative_expenses = QChartView(self.analytics) self.v_cumulative_expenses.setObjectName("v_cumulative_expenses") self.qtcharts.addWidget(self.v_cumulative_expenses) self.verticalLayout.addLayout(self.qtcharts) self.stackedWidget.addWidget(self.analytics) self.verticalLayout_2.addWidget(self.stackedWidget) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 1000, 22)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionOpen_files = QtWidgets.QAction(MainWindow) self.actionOpen_files.setObjectName("actionOpen_files") self.menuFile.addAction(self.actionOpen_files) self.menubar.addAction(self.menuFile.menuAction()) self.retranslateUi(MainWindow) self.stackedWidget.setCurrentIndex(1) self.block_bar.setCurrentIndex(1) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle( _translate("MainWindow", "Transaction analytics")) self.btn_load.setText( _translate("MainWindow", "Select transaction files")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.actionOpen_files.setText(_translate("MainWindow", "Open files..."))
class Ui_MainWindow(QtWidgets.QMainWindow): def setupUi(self): self.setObjectName("MainWindow") self.resize(600, 830) self.setWindowTitle("GA - Queens") self.centralwidget = QtWidgets.QWidget(self) self.centralwidget.setObjectName("centralwidget") self.frameWorld = MyQFrame(self.centralwidget) self.frameWorld.img = QPixmap(1000, 1000) self.frameWorld.setGeometry(QtCore.QRect(10, 10, 400, 400)) self.frameWorld.setFrameShape(QtWidgets.QFrame.Box) self.frameWorld.setFrameShadow(QtWidgets.QFrame.Sunken) self.frameWorld.setObjectName("frameWorld") self.frameChart = QChartView(self.centralwidget) self.frameChart.setGeometry(QtCore.QRect(10, 420, 400, 400)) self.frameChart.setFrameShape(QtWidgets.QFrame.Box) self.frameChart.setFrameShadow(QtWidgets.QFrame.Sunken) self.frameChart.setRenderHint(QPainter.Antialiasing) self.frameChart.setObjectName("frameChart") self.gaParams = QtWidgets.QGroupBox(self.centralwidget) self.gaParams.setGeometry(QtCore.QRect(430, 10, 161, 171)) self.gaParams.setObjectName("gaParams") self.gaParams.setTitle("GA parameters") self.label1 = QtWidgets.QLabel(self.gaParams) self.label1.setGeometry(QtCore.QRect(10, 20, 61, 16)) self.label1.setObjectName("label1") self.label1.setText("Population:") self.label2 = QtWidgets.QLabel(self.gaParams) self.label2.setGeometry(QtCore.QRect(10, 50, 47, 16)) self.label2.setObjectName("label2") self.label2.setText("Mutation:") self.label3 = QtWidgets.QLabel(self.gaParams) self.label3.setGeometry(QtCore.QRect(10, 80, 81, 16)) self.label3.setObjectName("label3") self.label3.setText("Elite members:") self.label4 = QtWidgets.QLabel(self.gaParams) self.label4.setGeometry(QtCore.QRect(10, 110, 91, 16)) self.label4.setObjectName("label4") self.label4.setText("No. generations:") self.cbxPermutation = QtWidgets.QCheckBox(self.gaParams) self.cbxPermutation.setGeometry(QtCore.QRect(35, 140, 91, 17)) self.cbxPermutation.setObjectName("cbxPermutation") self.cbxPermutation.setText("Permutation") self.tbxPopulation = QtWidgets.QLineEdit(self.gaParams) self.tbxPopulation.setGeometry(QtCore.QRect(100, 20, 51, 20)) self.tbxPopulation.setObjectName("tbxPopulation") self.tbxMutation = QtWidgets.QLineEdit(self.gaParams) self.tbxMutation.setGeometry(QtCore.QRect(100, 50, 51, 20)) self.tbxMutation.setObjectName("tbxMutation") self.tbxElite = QtWidgets.QLineEdit(self.gaParams) self.tbxElite.setGeometry(QtCore.QRect(100, 80, 51, 20)) self.tbxElite.setObjectName("tbxElite") self.tbxGenerations = QtWidgets.QLineEdit(self.gaParams) self.tbxGenerations.setGeometry(QtCore.QRect(100, 110, 51, 20)) self.tbxGenerations.setObjectName("tbxGenerations") self.label5 = QtWidgets.QLabel(self.centralwidget) self.label5.setGeometry(QtCore.QRect(440, 190, 61, 16)) self.label5.setObjectName("label5") self.label5.setText("No. queens:") self.tbxNoQueens = QtWidgets.QLineEdit(self.centralwidget) self.tbxNoQueens.setGeometry(QtCore.QRect(510, 190, 51, 20)) self.tbxNoQueens.setObjectName("tbxNoQueens") self.cbxNoVis = QtWidgets.QCheckBox(self.centralwidget) self.cbxNoVis.setGeometry(QtCore.QRect(420, 215, 170, 17)) self.cbxNoVis.setObjectName("cbxNoVis") self.cbxNoVis.setText("No visualization per generation") self.btnStart = QtWidgets.QPushButton(self.centralwidget) self.btnStart.setGeometry(QtCore.QRect(430, 250, 75, 23)) self.btnStart.setObjectName("btnStart") self.btnStart.setText("Start") self.btnStop = QtWidgets.QPushButton(self.centralwidget) self.btnStop.setEnabled(False) self.btnStop.setGeometry(QtCore.QRect(510, 250, 75, 23)) self.btnStop.setObjectName("btnStop") self.btnStop.setText("Stop") self.btnSaveWorld = QtWidgets.QPushButton(self.centralwidget) self.btnSaveWorld.setGeometry(QtCore.QRect(430, 370, 121, 41)) self.btnSaveWorld.setObjectName("btnSaveWorld") self.btnSaveWorld.setText("Save world as image") self.btnSaveChart = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChart.setGeometry(QtCore.QRect(430, 730, 121, 41)) self.btnSaveChart.setObjectName("btnSaveChart") self.btnSaveChart.setText("Save chart as image") self.btnSaveChartSeries = QtWidgets.QPushButton(self.centralwidget) self.btnSaveChartSeries.setGeometry(QtCore.QRect(430, 780, 121, 41)) self.btnSaveChartSeries.setObjectName("btnSaveChartSeries") self.btnSaveChartSeries.setText("Save chart as series") self.setCentralWidget(self.centralwidget) QtCore.QMetaObject.connectSlotsByName(self) #Connect events self.btnStart.clicked.connect(self.btnStart_Click) self.btnStop.clicked.connect(self.btnStop_Click) self.btnSaveWorld.clicked.connect(self.btnSaveWorld_Click) self.btnSaveChart.clicked.connect(self.btnSaveChart_CLick) self.btnSaveChartSeries.clicked.connect(self.btnSaveChartSeries_Click) #Set default GA variables self.tbxNoQueens.insert(str(NO_QUEENS)) self.tbxGenerations.insert(str(NGEN)) self.tbxPopulation.insert(str(POP_SIZE)) self.tbxMutation.insert(str(MUTPB)) self.tbxElite.insert(str(NELT)) self.new_image = QPixmap(1000, 1000) def btnStart_Click(self): global success # Number of times when fitness function reached 0 -- Added by Denis Lazor global generations # Number of times when fitness function reached 0 -- Added by Denis Lazor global combination_series # List of lists containing min_series of 5 correct results -- Added by Denis Lazor global parameter_name # Name of parameter used for writing its data to .csv file -- Added by Denis Lazor global ELITE_SIZES global BOARD_SIZES global POPULATION_SIZES global MUTATION_SIZES # Checking if files are empty or not -- Added by Denis Lazor csv_contains = os.stat("graphs_csv/original_.csv").st_size != 0 csv_contains_permutation = os.stat( "graphs_csv/original_permutation.csv").st_size != 0 permutation_checked = self.cbxPermutation.isChecked() # Clearing non empty files if we are trying to write to them -- Added by Denis Lazor if csv_contains_permutation and permutation_checked: clear_all_csv("p") if csv_contains and not permutation_checked: clear_all_csv("np") BOARD_SIZES = [12, 24] n = 5000 # Automation for all necessary combinations -- Added by Denis Lazor for b in BOARD_SIZES: # Because we use slicing we need to restore parameters lists after changing board size POPULATION_SIZES = [50, 100, 200] MUTATION_SIZES = [0.04, 0.08, 0.16] ELITE_SIZES = [4, 8, 16] for p in POPULATION_SIZES: for m in MUTATION_SIZES: for e in ELITE_SIZES: success = 0 trials = 0 # Number of tries needed to find 5 'correct' results -- Added by Denis Lazor while success < 5: # Doing same combination till we get 5 'correct' results -- Added by Denis Lazor trials = trials + 1 # Set global variables global stop_evolution global q_min_series global q_max_series global q_avg_series stop_evolution = False q_min_series.clear() q_max_series.clear() q_avg_series.clear() # Set global variables from information on UI global NO_QUEENS global NGEN global POP_SIZE global MUTPB global NELT NO_QUEENS = b NGEN = n POP_SIZE = p MUTPB = m NELT = e # Painting chess table self.img = QPixmap(1000, 1000) self.img.fill() painter = QPainter(self.img) painter.setPen(QPen(Qt.black, 10, Qt.SolidLine)) width = 1000 / NO_QUEENS cur_width = 0 for i in range( NO_QUEENS + 1 ): # +1 in order to draw the last line as well painter.drawLine(cur_width, 0, cur_width, 1000) painter.drawLine(0, cur_width, 1000, cur_width) cur_width += width painter.end() self.frameWorld.img = self.img # Redrawing frames self.frameWorld.repaint() app.processEvents() ####Initialize deap GA objects#### # Make creator that minimize. If it would be 1.0 instead od -1.0 than it would be maxmize creator.create("FitnessMin", base.Fitness, weights=(-1.0, )) # Create an individual (a blueprint for cromosomes) as a list with a specified fitness type creator.create("Individual", list, fitness=creator.FitnessMin) # Create base toolbox for finishing creation of a individual (cromosome) self.toolbox = base.Toolbox() # Define what type of data (number, gene) will it be in the cromosome if self.cbxPermutation.isChecked(): # Permutation coding self.toolbox.register("indices", random.sample, range(NO_QUEENS), NO_QUEENS) # initIterate requires that the generator of genes (such as random.sample) generates an iterable (a list) variable self.toolbox.register("individual", tools.initIterate, creator.Individual, self.toolbox.indices) else: # Standard coding self.toolbox.register( "attr_int", random.randint, 0, NO_QUEENS - 1 ) # number in cromosome is from 0 till IND_SIZE - 1 # Initialization procedure (initRepeat) for the cromosome. For the individual to be completed we need to run initRepeat for the amaout of genes the cromosome includes self.toolbox.register("individual", tools.initRepeat, creator.Individual, self.toolbox.attr_int, n=NO_QUEENS) # Create a population of individuals (cromosomes). The population is then created by toolbox.population(n=300) where 'n' is the number of cromosomes in population self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) # Register evaluation function self.toolbox.register("evaluate", evaluateInd) # Register what genetic operators to use if self.cbxPermutation.isChecked(): # Permutation coding self.toolbox.register( "mate", tools.cxUniformPartialyMatched, indpb=0.2 ) # Use uniform recombination for permutation coding self.toolbox.register("mutate", tools.mutShuffleIndexes, indpb=0.2) else: # Standard coding self.toolbox.register( "mate", tools.cxTwoPoint ) # Use two point recombination self.toolbox.register( "mutate", tools.mutUniformInt, low=0, up=NO_QUEENS - 1, indpb=0.2) # 20% that the gene will change self.toolbox.register( "select", tools.selTournament, tournsize=3) # Use tournament selection ################################## # Generate initial poplation. Will be a member variable so we can easely pass everything to new thread self.pop = self.toolbox.population(n=POP_SIZE) # Evaluate initial population, we map() the evaluation function to every individual and then assign their respective fitness, map runs evaluate function for each individual in pop fitnesses = list( map(self.toolbox.evaluate, self.pop)) for ind, fit in zip(self.pop, fitnesses): ind.fitness.values = fit # Assign calcualted fitness value to individuals # Extracting all the fitnesses of all individuals in a population so we can monitor and evovlve the algorithm until it reaches 0 or max number of generation is reached self.fits = [ ind.fitness.values[0] for ind in self.pop ] self.fits # Disable start and enable stop self.btnStart.setEnabled(False) self.btnStop.setEnabled(True) self.gaParams.setEnabled(False) self.tbxNoQueens.setEnabled(False) self.cbxNoVis.setEnabled(False) # Start evolution self.evolve() # Mean number of generations nedeed for finding 5 correct solutions -- Added by Denis Lazor mean_gen = min(generations, key=lambda x: abs(x - statistics.mean( generations))) # Index of mean_gen value -- Added by Denis Lazor mean_idx = generations.index(mean_gen) write_to_file( combination_series[mean_idx], parameter_name, permutation_checked ) # First name will be "original", second one "elites" -- Added by Denis Lazor parameter_name = "elites" print_results(b, p, m, e, trials, generations, mean_gen, NGEN) # Clearing past lists -- Added by Denis Lazor generations = [] combination_series = [] # Reducing number of combinations and changing .csv file for writing -- Added by Denis Lazor ELITE_SIZES = ELITE_SIZES[0:1] parameter_name = "mutation" MUTATION_SIZES = MUTATION_SIZES[0:1] parameter_name = "population" POPULATION_SIZES = POPULATION_SIZES[0:1] parameter_name = "original" n = 30000 # Increasing generation size for 24x24 board def btnStop_Click(self): global stop_evolution stop_evolution = True #Disable stop and enable start self.btnStop.setEnabled(False) self.btnStart.setEnabled(True) self.gaParams.setEnabled(True) self.tbxNoQueens.setEnabled(True) self.cbxNoVis.setEnabled(True) #Function for GA evolution def evolve(self): global q_min_series global q_max_series global q_avg_series global success global generations global combination_series global NO_QUEENS global NGEN global POP_SIZE global MUTPB global NELT combination_current_series = [] # Variable for keeping track of the number of generations curr_g = 0 # Begin the evolution till goal is reached or max number of generation is reached while min(self.fits) != 0 and curr_g < NGEN: #Check if evolution and thread need to stop if stop_evolution: break #Break the evolution loop # A new generation curr_g = curr_g + 1 #print("-- Generation %i --" % curr_g) # Select the next generation individuals #Select POP_SIZE - NELT number of individuals. Since recombination is between neigbours, not two naighbours should be the clone of the same individual offspring = [] offspring.append(self.toolbox.select( self.pop, 1)[0]) #add first selected individual for i in range( POP_SIZE - NELT - 1 ): # -1 because the first seleceted individual is already added while True: new_o = self.toolbox.select(self.pop, 1)[0] if new_o != offspring[len( offspring ) - 1]: #if it is different than the last inserted then add to offspring and break offspring.append(new_o) break # Clone the selected individuals because all of the changes are inplace offspring = list(map(self.toolbox.clone, offspring)) # Apply crossover on the selected offspring for child1, child2 in zip(offspring[::2], offspring[1::2]): self.toolbox.mate(child1, child2) #inplace recombination #Invalidate new children fitness values del child1.fitness.values del child2.fitness.values #Apply mutation on the offspring for mutant in offspring: if random.random() < MUTPB: self.toolbox.mutate(mutant) del mutant.fitness.values #Add elite individuals #Is clonning needed? offspring.extend( list(map(self.toolbox.clone, tools.selBest(self.pop, NELT)))) # Evaluate the individuals with an invalid fitness invalid_ind = [ind for ind in offspring if not ind.fitness.valid] fitnesses = map(self.toolbox.evaluate, invalid_ind) for ind, fit in zip(invalid_ind, fitnesses): ind.fitness.values = fit #print(" Evaluated %i individuals" % len(invalid_ind)) #Replace population with offspring self.pop[:] = offspring # Gather all the fitnesses in one list and print the stats self.fits = [ind.fitness.values[0] for ind in self.pop] length = len(self.pop) mean = sum(self.fits) / length sum2 = sum(x * x for x in self.fits) std = abs(sum2 / length - mean**2)**0.5 q_min_series.append(curr_g, min(self.fits)) q_max_series.append(curr_g, max(self.fits)) q_avg_series.append(curr_g, mean) combination_current_series.append( min(self.fits) ) # Saving min_series fitness values of an experiment -- Added by Denis Lazor # Checking if fitness value of 0 is reached -- Added by Denis Lazor for f in self.fits: if f == 0: success = success + 1 generations.append(curr_g) combination_series.append(combination_current_series) break #print(" Min %s" % q_min_series.at(q_min_series.count()-1).y()) #print(" Max %s" % q_max_series.at(q_max_series.count()-1).y()) #print(" Avg %s" % mean) #print(" Std %s" % std) if self.cbxNoVis.isChecked(): app.processEvents() else: #Draw queen positions of best individual on a image best_ind = tools.selBest(self.pop, 1)[0] self.updateWorldFrame(generateQueenImage(best_ind)) self.chart = QChart() #self.chart.addSeries(q_min_series) #self.chart.addSeries(q_max_series) #q_avg_series.setName("Board: " + str(b) + " Population: " + str(p) + " Elite: " + str(e) + " Mutation:" + str(m*100) + "% " + "Generations:" + str(NGSEN)) self.chart.addSeries(q_avg_series) self.chart.setTitle("QN: " + str(NO_QUEENS) + " POP: " + str(POP_SIZE) + " EL: " + str(NELT) + " MT: " + str(MUTPB * 100) + "% ") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) #Printing best individual best_ind = tools.selBest(self.pop, 1)[0] #print("Best individual is %s, %s \n" % (best_ind, best_ind.fitness.values)) #Visulaize final solution if self.cbxNoVis.isChecked(): #Draw queen positions of best individual on a image best_ind = tools.selBest(self.pop, 1)[0] self.updateWorldFrame(generateQueenImage(best_ind)) self.chart = QChart() #self.chart.addSeries(q_min_series) #self.chart.addSeries(q_max_series) self.chart.addSeries(q_avg_series) self.chart.setTitle("QN: " + str(NO_QUEENS) + " POP: " + str(POP_SIZE) + " EL: " + str(NELT) + " MT: " + str(MUTPB * 100) + "% ") self.chart.setAnimationOptions(QChart.NoAnimation) self.chart.createDefaultAxes() self.frameChart.setChart(self.chart) #Disable stop and enable start self.btnStop.setEnabled(False) self.btnStart.setEnabled(True) self.gaParams.setEnabled(True) self.tbxNoQueens.setEnabled(True) self.cbxNoVis.setEnabled(True) def updateWorldFrame(self, queens_img): #new_image = QPixmap(1000,1000) self.new_image.fill() #White color is default painter = QPainter(self.new_image) #First draw the table painter.drawPixmap(self.new_image.rect(), self.img) #Then draw the queens painter.drawImage(self.new_image.rect(), queens_img) painter.end() #Set new image to the frame self.frameWorld.img = self.new_image #Redrawing frames self.frameWorld.repaint() self.frameChart.repaint() app.processEvents() def btnSaveWorld_Click(self): filename, _ = QFileDialog.getSaveFileName(None, "Save world as a image", "", "Image Files (*.png)") self.frameWorld.img.save(filename, "PNG") print("World image saved to: ", filename) def btnSaveChart_CLick(self): p = self.frameChart.grab() filename, _ = QFileDialog.getSaveFileName( None, "Save series chart as a image", "", "Image Files (*.png)") p.save(filename, "PNG") print("Chart series image saved to: ", filename) def btnSaveChartSeries_Click(self): global q_min_series global q_max_series global q_avg_series filename, _ = QFileDialog.getSaveFileName(None, "Save series to text file", "", "Text Files (*.txt, *.csv)") with open(filename, 'w') as dat: for i in range(q_min_series.count()): dat.write('%f,%f,%f\n' % (q_min_series.at(i).y(), q_avg_series.at(i).y(), q_max_series.at(i).y())) print("Chart series saved to: ", filename)
class Ui_Index_gasList(object): def setupUi(self, Index_gasList): Index_gasList.setObjectName("Index_gasList") Index_gasList.resize(807, 471) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/icons/food/23.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Index_gasList.setWindowIcon(icon) self.horizontalLayout = QtWidgets.QHBoxLayout(Index_gasList) self.horizontalLayout.setObjectName("horizontalLayout") self.groupBox = QtWidgets.QGroupBox(Index_gasList) font = QtGui.QFont() font.setFamily("宋体") font.setPointSize(14) self.groupBox.setFont(font) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.refreshButton = QtWidgets.QPushButton(self.groupBox) font = QtGui.QFont() font.setFamily("黑体") font.setPointSize(10) self.refreshButton.setFont(font) self.refreshButton.setObjectName("refreshButton") self.horizontalLayout_2.addWidget(self.refreshButton) self.deleteButton = QtWidgets.QPushButton(self.groupBox) font = QtGui.QFont() font.setFamily("黑体") font.setPointSize(10) self.deleteButton.setFont(font) self.deleteButton.setObjectName("deleteButton") self.horizontalLayout_2.addWidget(self.deleteButton) self.verticalLayout.addLayout(self.horizontalLayout_2) self.listView = QtWidgets.QListView(self.groupBox) self.listView.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.listView.setObjectName("listView") self.verticalLayout.addWidget(self.listView) self.horizontalLayout.addWidget(self.groupBox) self.groupBox_2 = QtWidgets.QGroupBox(Index_gasList) font = QtGui.QFont() font.setFamily("宋体") font.setPointSize(14) self.groupBox_2.setFont(font) self.groupBox_2.setObjectName("groupBox_2") self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.groupBox_2) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.frame = QtWidgets.QFrame(self.groupBox_2) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout_2.setObjectName("verticalLayout_2") self.chartView = QChartView(self.frame) self.chartView.setObjectName("chartView") self.verticalLayout_2.addWidget(self.chartView) self.horizontalLayout_3.addWidget(self.frame) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.maxEdit = QtWidgets.QLineEdit(self.groupBox_2) self.maxEdit.setReadOnly(True) self.maxEdit.setObjectName("maxEdit") self.gridLayout.addWidget(self.maxEdit, 3, 4, 1, 1) self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setObjectName("label_4") self.gridLayout.addWidget(self.label_4, 4, 1, 1, 1) self.timeEdit = QtWidgets.QLineEdit(self.groupBox_2) font = QtGui.QFont() font.setFamily("宋体") font.setPointSize(14) self.timeEdit.setFont(font) self.timeEdit.setReadOnly(True) self.timeEdit.setObjectName("timeEdit") self.gridLayout.addWidget(self.timeEdit, 1, 4, 1, 1) self.extrEdit = QtWidgets.QLineEdit(self.groupBox_2) self.extrEdit.setReadOnly(True) self.extrEdit.setObjectName("extrEdit") self.gridLayout.addWidget(self.extrEdit, 5, 4, 1, 1) self.label_2 = QtWidgets.QLabel(self.groupBox_2) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.groupBox_2) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 1, 1, 1) self.minEdit = QtWidgets.QLineEdit(self.groupBox_2) self.minEdit.setReadOnly(True) self.minEdit.setObjectName("minEdit") self.gridLayout.addWidget(self.minEdit, 4, 4, 1, 1) self.label = QtWidgets.QLabel(self.groupBox_2) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 1, 1, 1, 1) self.label_5 = QtWidgets.QLabel(self.groupBox_2) self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 5, 1, 1, 1) self.oriEdit = QtWidgets.QLineEdit(self.groupBox_2) self.oriEdit.setReadOnly(True) self.oriEdit.setObjectName("oriEdit") self.gridLayout.addWidget(self.oriEdit, 2, 4, 1, 1) self.sensorBox = QtWidgets.QComboBox(self.groupBox_2) font = QtGui.QFont() font.setPointSize(14) self.sensorBox.setFont(font) self.sensorBox.setObjectName("sensorBox") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.sensorBox.addItem("") self.gridLayout.addWidget(self.sensorBox, 0, 4, 1, 1) self.label_6 = QtWidgets.QLabel(self.groupBox_2) self.label_6.setObjectName("label_6") self.gridLayout.addWidget(self.label_6, 0, 1, 1, 1) self.horizontalLayout_3.addLayout(self.gridLayout) self.horizontalLayout_3.setStretch(0, 3) self.horizontalLayout_3.setStretch(1, 1) self.horizontalLayout.addWidget(self.groupBox_2) self.horizontalLayout.setStretch(0, 1) self.horizontalLayout.setStretch(1, 4) self.retranslateUi(Index_gasList) QtCore.QMetaObject.connectSlotsByName(Index_gasList) def retranslateUi(self, Index_gasList): _translate = QtCore.QCoreApplication.translate Index_gasList.setWindowTitle(_translate("Index_gasList", "Dialog")) self.groupBox.setTitle(_translate("Index_gasList", "气体列表")) self.refreshButton.setText(_translate("Index_gasList", "刷新列表")) self.deleteButton.setText(_translate("Index_gasList", "删除")) self.groupBox_2.setTitle(_translate("Index_gasList", "详细信息")) self.label_4.setText(_translate("Index_gasList", "最小值")) self.label_2.setText(_translate("Index_gasList", "初始值")) self.label_3.setText(_translate("Index_gasList", "最大值")) self.label.setText(_translate("Index_gasList", "采集次数")) self.label_5.setText(_translate("Index_gasList", "极值点")) self.sensorBox.setItemText(0, _translate("Index_gasList", "传感器1")) self.sensorBox.setItemText(1, _translate("Index_gasList", "传感器2")) self.sensorBox.setItemText(2, _translate("Index_gasList", "传感器3")) self.sensorBox.setItemText(3, _translate("Index_gasList", "传感器4")) self.sensorBox.setItemText(4, _translate("Index_gasList", "传感器5")) self.sensorBox.setItemText(5, _translate("Index_gasList", "传感器6")) self.sensorBox.setItemText(6, _translate("Index_gasList", "传感器7")) self.sensorBox.setItemText(7, _translate("Index_gasList", "传感器8")) self.sensorBox.setItemText(8, _translate("Index_gasList", "传感器9")) self.sensorBox.setItemText(9, _translate("Index_gasList", "传感器10")) self.sensorBox.setItemText(10, _translate("Index_gasList", "传感器11")) self.sensorBox.setItemText(11, _translate("Index_gasList", "传感器12")) self.sensorBox.setItemText(12, _translate("Index_gasList", "传感器13")) self.sensorBox.setItemText(13, _translate("Index_gasList", "传感器14")) self.sensorBox.setItemText(14, _translate("Index_gasList", "传感器15")) self.label_6.setText(_translate("Index_gasList", "Sensor:"))
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2.setObjectName("gridLayout_2") self.chartView = QChartView(self.centralwidget) self.chartView.setObjectName("chartView") self.gridLayout_2.addWidget(self.chartView, 3, 1, 1, 1) self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1) self.srcPushButton = QtWidgets.QPushButton(self.centralwidget) self.srcPushButton.setObjectName("srcPushButton") self.gridLayout_2.addWidget(self.srcPushButton, 0, 2, 1, 1) self.label = QtWidgets.QLabel(self.centralwidget) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1) self.destPushButton = QtWidgets.QPushButton(self.centralwidget) self.destPushButton.setObjectName("destPushButton") self.gridLayout_2.addWidget(self.destPushButton, 1, 2, 1, 1) self.destEdit = QtWidgets.QLineEdit(self.centralwidget) self.destEdit.setEnabled(False) self.destEdit.setObjectName("destEdit") self.gridLayout_2.addWidget(self.destEdit, 1, 1, 1, 1) self.srcEdit = QtWidgets.QLineEdit(self.centralwidget) self.srcEdit.setEnabled(False) self.srcEdit.setObjectName("srcEdit") self.gridLayout_2.addWidget(self.srcEdit, 0, 1, 1, 1) self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.collectPushButton = QtWidgets.QPushButton(self.centralwidget) self.collectPushButton.setObjectName("collectPushButton") self.verticalLayout_3.addWidget(self.collectPushButton) self.processPushButton = QtWidgets.QPushButton(self.centralwidget) self.processPushButton.setObjectName("processPushButton") self.verticalLayout_3.addWidget(self.processPushButton) self.copyPushButton = QtWidgets.QPushButton(self.centralwidget) self.copyPushButton.setObjectName("copyPushButton") self.verticalLayout_3.addWidget(self.copyPushButton) self.gridLayout_2.addLayout(self.verticalLayout_3, 2, 2, 1, 1) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setObjectName("verticalLayout_4") self.progressBar = QtWidgets.QProgressBar(self.centralwidget) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout_4.addWidget(self.progressBar) self.progressLabel = QtWidgets.QLabel(self.centralwidget) self.progressLabel.setText("") self.progressLabel.setObjectName("progressLabel") self.verticalLayout_4.addWidget(self.progressLabel) self.gridLayout_2.addLayout(self.verticalLayout_4, 2, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout_2) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout.addLayout(self.verticalLayout_2) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.label_2.setText(_translate("MainWindow", "整理到:")) self.srcPushButton.setText(_translate("MainWindow", "选择")) self.label.setText(_translate("MainWindow", "待处理:")) self.destPushButton.setText(_translate("MainWindow", "选择")) self.collectPushButton.setText(_translate("MainWindow", "收集")) self.processPushButton.setText(_translate("MainWindow", "预处理")) self.copyPushButton.setText(_translate("MainWindow", "复制"))
class Ui_MultipleAnalayzer(object): def setupUi(self, MultipleAnalayzer): MultipleAnalayzer.setObjectName("MultipleAnalayzer") MultipleAnalayzer.resize(964, 670) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MultipleAnalayzer.sizePolicy().hasHeightForWidth()) MultipleAnalayzer.setSizePolicy(sizePolicy) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/images/icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) MultipleAnalayzer.setWindowIcon(icon) MultipleAnalayzer.setStyleSheet( "#lbl_title {\n" "font: 75 20pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "qproperty-alignment: AlignCenter;\n" "color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 #3643f7, stop:1 #3643f7);\n" "}\n" "\n" "#btn_homepage {\n" "background: transparent;\n" "border-radius: 19px;\n" "}\n" "\n" "#btn_homepage::hover {\n" "background: #3f72af;\n" "}\n" "\n" "#btn_help {\n" "background: transparent;\n" "border-radius: 19px;\n" "}\n" "\n" "#btn_help::hover {\n" "background: #3f72af;\n" "}\n" "\n" "#btn_tweets_file {\n" "font: 75 11pt \"MS Shell Dialog 2\";\n" "border-radius: 0px;\n" "}\n" "\n" "#btn_classify,#btn_save {\n" "font: 75 11pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "}\n" "#lbl_threshold {\n" "font: 75 9pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "}\n" "#spinbox_threshold {\n" "font: 75 10pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "}\n" "QPushButton {\n" "font: 75 13pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "border-radius: 9px;\n" "border: 1px solid black;\n" "background-color: #f0f5f9;\n" "}\n" "QPushButton::disabled {\n" "background-color: #D3D3D3;\n" "}\n" "QPushButton::hover {\n" "background: #c9d6df;\n" "}\n" "QPushButton:pressed {\n" "background: #3f72af;\n" "}\n" "\n" "QProgressBar:horizontal {\n" "border: 1px solid gray;\n" "border-radius: 3px;\n" "background: white;\n" "padding: 0px;\n" "}\n" "QProgressBar::chunk:horizontal {\n" "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" " stop: 0 #a8ff78, stop: 1 #78ffd6);\n" "}\n" "\n" "QComboBox {\n" "font: 75 10.5pt \"Microsoft YaHei UI\";\n" "font-weight: bold;\n" "color: #1F1F21;\n" " border: 1px solid gray;\n" " border-radius: 10px;\n" " min-width: 6em;\n" "padding-left: 8px;\n" "qproperty-alignment: AlignCenter;\n" "}\n" "QComboBox::hover {\n" " border: 1px solid blue;\n" "background: #f0f5f9;\n" "}\n" "/* QComboBox gets the \"on\" state when the popup is open */\n" "QComboBox:!editable:on, QComboBox::drop-down:editable:on {\n" " color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n" " stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,\n" " stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);\n" "}\n" "QComboBox:on {\n" " borde-radius: 10px;\n" "}\n" "\n" "QComboBox::drop-down {\n" " subcontrol-origin: padding;\n" " subcontrol-position: top right;\n" " width: 25px;\n" " border-left-width: 1px;\n" " border-left-color: darkgray;\n" " border-left-style: solid; /* just a single line */\n" " border-top-right-radius: 10px; /* same radius as the QComboBox */\n" " border-bottom-right-radius: 10px;\n" "}\n" "QComboBox QAbstractItemView {\n" " border-radius: 10px;\n" " background: white;\n" " border: 1px solid gray;\n" " box-shadow: transparent;\n" " selection-background-color:lightblue;\n" " color: #1F1F21;\n" "}\n" "\n" "QComboBox::down-arrow {\n" "image: url(:/images/arrow_down.png);\n" " width: 15px;\n" " height: 15px;\n" "padding-right: 1px;\n" "}\n" "") self.verticalLayout_2 = QtWidgets.QVBoxLayout(MultipleAnalayzer) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_11 = QtWidgets.QHBoxLayout() self.horizontalLayout_11.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout_11.setObjectName("horizontalLayout_11") self.btn_homepage = QtWidgets.QToolButton(MultipleAnalayzer) self.btn_homepage.setAutoFillBackground(False) self.btn_homepage.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/images/homepage.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_homepage.setIcon(icon1) self.btn_homepage.setIconSize(QtCore.QSize(35, 35)) self.btn_homepage.setObjectName("btn_homepage") self.horizontalLayout_11.addWidget(self.btn_homepage) self.btn_help = QtWidgets.QToolButton(MultipleAnalayzer) self.btn_help.setText("") icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/images/help.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_help.setIcon(icon2) self.btn_help.setIconSize(QtCore.QSize(35, 35)) self.btn_help.setObjectName("btn_help") self.horizontalLayout_11.addWidget(self.btn_help) self.lbl_title = QtWidgets.QLabel(MultipleAnalayzer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lbl_title.sizePolicy().hasHeightForWidth()) self.lbl_title.setSizePolicy(sizePolicy) self.lbl_title.setAlignment(QtCore.Qt.AlignCenter) self.lbl_title.setObjectName("lbl_title") self.horizontalLayout_11.addWidget(self.lbl_title) spacerItem = QtWidgets.QSpacerItem(45, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_11.addItem(spacerItem) self.verticalLayout_2.addLayout(self.horizontalLayout_11) self.frame = QtWidgets.QFrame(MultipleAnalayzer) self.frame.setMinimumSize(QtCore.QSize(700, 0)) self.frame.setMaximumSize(QtCore.QSize(700, 16777215)) self.frame.setObjectName("frame") self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout_8.setContentsMargins(1, 16, 1, 14) self.verticalLayout_8.setSpacing(9) self.verticalLayout_8.setObjectName("verticalLayout_8") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.combobox_model = QtWidgets.QComboBox(self.frame) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.combobox_model.sizePolicy().hasHeightForWidth()) self.combobox_model.setSizePolicy(sizePolicy) self.combobox_model.setMinimumSize(QtCore.QSize(124, 0)) self.combobox_model.setMaximumSize(QtCore.QSize(270, 16777215)) self.combobox_model.setSizeAdjustPolicy( QtWidgets.QComboBox.AdjustToContents) self.combobox_model.setObjectName("combobox_model") self.combobox_model.addItem("") self.horizontalLayout_3.addWidget(self.combobox_model) self.verticalLayout_8.addLayout(self.horizontalLayout_3) self.verticalLayout_2.addWidget(self.frame, 0, QtCore.Qt.AlignHCenter) self.groupbox_config = QtWidgets.QGroupBox(MultipleAnalayzer) self.groupbox_config.setMinimumSize(QtCore.QSize(700, 0)) self.groupbox_config.setMaximumSize(QtCore.QSize(700, 16777215)) self.groupbox_config.setObjectName("groupbox_config") self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.groupbox_config) self.horizontalLayout_2.setContentsMargins(6, 10, 6, 10) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setContentsMargins(-1, 0, -1, 0) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName("verticalLayout") self.label_2 = QtWidgets.QLabel(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.label = QtWidgets.QLabel(self.groupbox_config) self.label.setText("") self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.label_7 = QtWidgets.QLabel(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_7.sizePolicy().hasHeightForWidth()) self.label_7.setSizePolicy(sizePolicy) self.label_7.setObjectName("label_7") self.verticalLayout.addWidget(self.label_7) self.horizontalLayout_2.addLayout(self.verticalLayout) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setContentsMargins(-1, 4, -1, 2) self.verticalLayout_4.setSpacing(12) self.verticalLayout_4.setObjectName("verticalLayout_4") self.verticalLayout_7 = QtWidgets.QVBoxLayout() self.verticalLayout_7.setContentsMargins(-1, 0, -1, 0) self.verticalLayout_7.setObjectName("verticalLayout_7") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout.setObjectName("horizontalLayout") self.textbox_tweets_file = QtWidgets.QLineEdit(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.textbox_tweets_file.sizePolicy().hasHeightForWidth()) self.textbox_tweets_file.setSizePolicy(sizePolicy) self.textbox_tweets_file.setMinimumSize(QtCore.QSize(370, 0)) self.textbox_tweets_file.setMaximumSize( QtCore.QSize(16777215, 16777215)) self.textbox_tweets_file.setObjectName("textbox_tweets_file") self.horizontalLayout.addWidget(self.textbox_tweets_file) self.btn_tweets_file = QtWidgets.QPushButton(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btn_tweets_file.sizePolicy().hasHeightForWidth()) self.btn_tweets_file.setSizePolicy(sizePolicy) self.btn_tweets_file.setMinimumSize(QtCore.QSize(32, 18)) self.btn_tweets_file.setMaximumSize(QtCore.QSize(32, 16777215)) self.btn_tweets_file.setObjectName("btn_tweets_file") self.horizontalLayout.addWidget(self.btn_tweets_file) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem1) self.verticalLayout_7.addLayout(self.horizontalLayout) self.checkbox_header = QtWidgets.QCheckBox(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.checkbox_header.sizePolicy().hasHeightForWidth()) self.checkbox_header.setSizePolicy(sizePolicy) self.checkbox_header.setChecked(True) self.checkbox_header.setObjectName("checkbox_header") self.verticalLayout_7.addWidget(self.checkbox_header) self.verticalLayout_4.addLayout(self.verticalLayout_7) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.spinbox_rand_tweets = QtWidgets.QSpinBox(self.groupbox_config) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.spinbox_rand_tweets.sizePolicy().hasHeightForWidth()) self.spinbox_rand_tweets.setSizePolicy(sizePolicy) self.spinbox_rand_tweets.setMinimumSize(QtCore.QSize(0, 20)) self.spinbox_rand_tweets.setMaximumSize(QtCore.QSize(60, 20)) self.spinbox_rand_tweets.setMinimum(3) self.spinbox_rand_tweets.setMaximum(5000) self.spinbox_rand_tweets.setProperty("value", 50) self.spinbox_rand_tweets.setObjectName("spinbox_rand_tweets") self.horizontalLayout_8.addWidget(self.spinbox_rand_tweets) spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_8.addItem(spacerItem2) self.verticalLayout_4.addLayout(self.horizontalLayout_8) self.horizontalLayout_2.addLayout(self.verticalLayout_4) self.verticalLayout_2.addWidget(self.groupbox_config, 0, QtCore.Qt.AlignHCenter) self.frame1 = QtWidgets.QFrame(MultipleAnalayzer) self.frame1.setMinimumSize(QtCore.QSize(700, 0)) self.frame1.setMaximumSize(QtCore.QSize(700, 16777215)) self.frame1.setObjectName("frame1") self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.frame1) self.horizontalLayout_4.setContentsMargins(35, 7, 35, 7) self.horizontalLayout_4.setSpacing(34) self.horizontalLayout_4.setObjectName("horizontalLayout_4") spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem3) self.btn_start = QtWidgets.QPushButton(self.frame1) self.btn_start.setEnabled(False) self.btn_start.setMinimumSize(QtCore.QSize(122, 40)) self.btn_start.setMaximumSize(QtCore.QSize(16777214, 40)) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/images/predict.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_start.setIcon(icon3) self.btn_start.setIconSize(QtCore.QSize(33, 33)) self.btn_start.setObjectName("btn_start") self.horizontalLayout_4.addWidget(self.btn_start) self.btn_stop = QtWidgets.QPushButton(self.frame1) self.btn_stop.setEnabled(False) self.btn_stop.setMinimumSize(QtCore.QSize(122, 40)) self.btn_stop.setMaximumSize(QtCore.QSize(16777215, 40)) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap(":/images/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_stop.setIcon(icon4) self.btn_stop.setIconSize(QtCore.QSize(30, 30)) self.btn_stop.setObjectName("btn_stop") self.horizontalLayout_4.addWidget(self.btn_stop) self.btn_save = QtWidgets.QPushButton(self.frame1) self.btn_save.setEnabled(False) self.btn_save.setMinimumSize(QtCore.QSize(122, 40)) self.btn_save.setMaximumSize(QtCore.QSize(16777215, 40)) icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap(":/images/export_excel.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btn_save.setIcon(icon5) self.btn_save.setIconSize(QtCore.QSize(27, 27)) self.btn_save.setObjectName("btn_save") self.horizontalLayout_4.addWidget(self.btn_save) spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_4.addItem(spacerItem4) self.verticalLayout_2.addWidget(self.frame1, 0, QtCore.Qt.AlignHCenter) self.horizontalGroupBox_3 = QtWidgets.QGroupBox(MultipleAnalayzer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.horizontalGroupBox_3.sizePolicy().hasHeightForWidth()) self.horizontalGroupBox_3.setSizePolicy(sizePolicy) self.horizontalGroupBox_3.setMaximumSize(QtCore.QSize(16777215, 300)) self.horizontalGroupBox_3.setTitle("") self.horizontalGroupBox_3.setObjectName("horizontalGroupBox_3") self.horizontalLayout_9 = QtWidgets.QHBoxLayout( self.horizontalGroupBox_3) self.horizontalLayout_9.setContentsMargins(10, 5, 0, 5) self.horizontalLayout_9.setSpacing(10) self.horizontalLayout_9.setObjectName("horizontalLayout_9") self.histogram = QChartView(self.horizontalGroupBox_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.histogram.sizePolicy().hasHeightForWidth()) self.histogram.setSizePolicy(sizePolicy) self.histogram.setMinimumSize(QtCore.QSize(380, 0)) self.histogram.setObjectName("histogram") self.horizontalLayout_9.addWidget(self.histogram) self.piechart = QChartView(self.horizontalGroupBox_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.piechart.sizePolicy().hasHeightForWidth()) self.piechart.setSizePolicy(sizePolicy) self.piechart.setMinimumSize(QtCore.QSize(270, 270)) self.piechart.setMaximumSize(QtCore.QSize(350, 16777215)) self.piechart.setObjectName("piechart") self.horizontalLayout_9.addWidget(self.piechart) self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5.setContentsMargins(-1, 0, 0, 0) self.verticalLayout_5.setObjectName("verticalLayout_5") self.verticalFrame_3 = QtWidgets.QFrame(self.horizontalGroupBox_3) self.verticalFrame_3.setObjectName("verticalFrame_3") self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.verticalFrame_3) self.verticalLayout_3.setContentsMargins(1, 0, 0, -1) self.verticalLayout_3.setSpacing(9) self.verticalLayout_3.setObjectName("verticalLayout_3") self.groupbox_threshold = QtWidgets.QGroupBox(self.verticalFrame_3) self.groupbox_threshold.setEnabled(False) self.groupbox_threshold.setMinimumSize(QtCore.QSize(100, 0)) self.groupbox_threshold.setMaximumSize(QtCore.QSize(90, 16777215)) self.groupbox_threshold.setObjectName("groupbox_threshold") self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.groupbox_threshold) self.verticalLayout_6.setContentsMargins(0, 5, 0, 10) self.verticalLayout_6.setSpacing(0) self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout_10 = QtWidgets.QHBoxLayout() self.horizontalLayout_10.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout_10.setObjectName("horizontalLayout_10") self.lbl_threshold = QtWidgets.QLabel(self.groupbox_threshold) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lbl_threshold.sizePolicy().hasHeightForWidth()) self.lbl_threshold.setSizePolicy(sizePolicy) self.lbl_threshold.setObjectName("lbl_threshold") self.horizontalLayout_10.addWidget(self.lbl_threshold) self.verticalLayout_6.addLayout(self.horizontalLayout_10) self.spinbox_threshold = QtWidgets.QDoubleSpinBox( self.groupbox_threshold) self.spinbox_threshold.setMinimumSize(QtCore.QSize(50, 22)) self.spinbox_threshold.setMaximumSize(QtCore.QSize(50, 22)) font = QtGui.QFont() font.setFamily("Microsoft YaHei UI") font.setPointSize(10) font.setBold(True) font.setItalic(False) font.setWeight(75) self.spinbox_threshold.setFont(font) self.spinbox_threshold.setSpecialValueText("") self.spinbox_threshold.setDecimals(1) self.spinbox_threshold.setMinimum(0.1) self.spinbox_threshold.setMaximum(1.0) self.spinbox_threshold.setSingleStep(0.1) self.spinbox_threshold.setProperty("value", 0.5) self.spinbox_threshold.setObjectName("spinbox_threshold") self.verticalLayout_6.addWidget(self.spinbox_threshold, 0, QtCore.Qt.AlignHCenter) self.verticalLayout_13 = QtWidgets.QVBoxLayout() self.verticalLayout_13.setContentsMargins(-1, 10, -1, -1) self.verticalLayout_13.setObjectName("verticalLayout_13") self.btn_classify = QtWidgets.QPushButton(self.groupbox_threshold) self.btn_classify.setEnabled(False) self.btn_classify.setMinimumSize(QtCore.QSize(80, 28)) self.btn_classify.setMaximumSize(QtCore.QSize(80, 28)) self.btn_classify.setIconSize(QtCore.QSize(25, 25)) self.btn_classify.setObjectName("btn_classify") self.verticalLayout_13.addWidget(self.btn_classify, 0, QtCore.Qt.AlignHCenter) self.verticalLayout_6.addLayout(self.verticalLayout_13) self.verticalLayout_3.addWidget(self.groupbox_threshold) self.verticalLayout_5.addWidget(self.verticalFrame_3) spacerItem5 = QtWidgets.QSpacerItem(20, 31, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_5.addItem(spacerItem5) self.horizontalLayout_9.addLayout(self.verticalLayout_5) self.verticalLayout_2.addWidget(self.horizontalGroupBox_3) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setContentsMargins(14, 8, 14, 0) self.horizontalLayout_5.setSpacing(6) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.verticalLayout_10 = QtWidgets.QVBoxLayout() self.verticalLayout_10.setContentsMargins(-1, -1, -1, 0) self.verticalLayout_10.setObjectName("verticalLayout_10") self.label_13 = QtWidgets.QLabel(MultipleAnalayzer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_13.sizePolicy().hasHeightForWidth()) self.label_13.setSizePolicy(sizePolicy) self.label_13.setObjectName("label_13") self.verticalLayout_10.addWidget(self.label_13) self.label_12 = QtWidgets.QLabel(MultipleAnalayzer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_12.sizePolicy().hasHeightForWidth()) self.label_12.setSizePolicy(sizePolicy) self.label_12.setObjectName("label_12") self.verticalLayout_10.addWidget(self.label_12) self.horizontalLayout_5.addLayout(self.verticalLayout_10) self.verticalLayout_11 = QtWidgets.QVBoxLayout() self.verticalLayout_11.setObjectName("verticalLayout_11") self.progressbar_tweets = QtWidgets.QProgressBar(MultipleAnalayzer) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.progressbar_tweets.sizePolicy().hasHeightForWidth()) self.progressbar_tweets.setSizePolicy(sizePolicy) self.progressbar_tweets.setMinimumSize(QtCore.QSize(0, 17)) self.progressbar_tweets.setMaximumSize(QtCore.QSize(16777215, 17)) self.progressbar_tweets.setMinimum(0) self.progressbar_tweets.setMaximum(100) self.progressbar_tweets.setProperty("value", 0) self.progressbar_tweets.setAlignment(QtCore.Qt.AlignCenter) self.progressbar_tweets.setTextDirection( QtWidgets.QProgressBar.TopToBottom) self.progressbar_tweets.setObjectName("progressbar_tweets") self.verticalLayout_11.addWidget(self.progressbar_tweets) self.progressbar_batch = QtWidgets.QProgressBar(MultipleAnalayzer) self.progressbar_batch.setMinimumSize(QtCore.QSize(0, 17)) self.progressbar_batch.setMaximumSize(QtCore.QSize(16777215, 17)) self.progressbar_batch.setProperty("value", 0) self.progressbar_batch.setAlignment(QtCore.Qt.AlignCenter) self.progressbar_batch.setObjectName("progressbar_batch") self.verticalLayout_11.addWidget(self.progressbar_batch) self.horizontalLayout_5.addLayout(self.verticalLayout_11) self.verticalLayout_2.addLayout(self.horizontalLayout_5) self.retranslateUi(MultipleAnalayzer) QtCore.QMetaObject.connectSlotsByName(MultipleAnalayzer) def retranslateUi(self, MultipleAnalayzer): _translate = QtCore.QCoreApplication.translate MultipleAnalayzer.setWindowTitle( _translate("MultipleAnalayzer", "Multiple Tweets Analyzer")) self.btn_homepage.setToolTip( _translate("MultipleAnalayzer", "Back To HomePage")) self.btn_help.setToolTip( _translate("MultipleAnalayzer", "Open Help Documentation")) self.lbl_title.setText( _translate("MultipleAnalayzer", "Multiple Tweets Analyzer")) self.combobox_model.setItemText( 0, _translate("MultipleAnalayzer", "Select Model")) self.groupbox_config.setTitle( _translate("MultipleAnalayzer", "Input Configuration")) self.label_2.setText(_translate("MultipleAnalayzer", "Tweets File:")) self.label_7.setText(_translate("MultipleAnalayzer", "Random Tweets:")) self.btn_tweets_file.setText(_translate("MultipleAnalayzer", "...")) self.checkbox_header.setText( _translate("MultipleAnalayzer", "Include Header")) self.btn_start.setText(_translate("MultipleAnalayzer", "Predict")) self.btn_stop.setText(_translate("MultipleAnalayzer", "Stop")) self.btn_save.setText(_translate("MultipleAnalayzer", "Export")) self.lbl_threshold.setText( _translate("MultipleAnalayzer", "Threshold:")) self.btn_classify.setText(_translate("MultipleAnalayzer", "Update")) self.label_13.setText(_translate("MultipleAnalayzer", "Tweets")) self.label_12.setText(_translate("MultipleAnalayzer", "Batch"))
class Ui_sfxPage(object): def setupUi(self, sfxPage): sfxPage.setObjectName("sfxPage") sfxPage.resize(742, 545) self.verticalLayout_2 = QtWidgets.QVBoxLayout(sfxPage) self.verticalLayout_2.setObjectName("verticalLayout_2") self.splitter_2 = QtWidgets.QSplitter(sfxPage) self.splitter_2.setOrientation(QtCore.Qt.Horizontal) self.splitter_2.setObjectName("splitter_2") self.layoutWidget = QtWidgets.QWidget(self.splitter_2) self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.graphicsView = QChartView(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(12) sizePolicy.setHeightForWidth( self.graphicsView.sizePolicy().hasHeightForWidth()) self.graphicsView.setSizePolicy(sizePolicy) self.graphicsView.setObjectName("graphicsView") self.verticalLayout.addWidget(self.graphicsView) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(self.layoutWidget) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.lineEdit = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(2) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.lineEdit.setObjectName("lineEdit") self.horizontalLayout.addWidget(self.lineEdit) self.label_2 = QtWidgets.QLabel(self.layoutWidget) self.label_2.setObjectName("label_2") self.horizontalLayout.addWidget(self.label_2) self.lineEdit_2 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(2) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_2.sizePolicy().hasHeightForWidth()) self.lineEdit_2.setSizePolicy(sizePolicy) self.lineEdit_2.setObjectName("lineEdit_2") self.horizontalLayout.addWidget(self.lineEdit_2) self.pushButton_2 = QtWidgets.QPushButton(self.layoutWidget) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout.addWidget(self.pushButton_2) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.verticalLayout.addLayout(self.horizontalLayout) self.graphicsView_2 = QChartView(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(4) sizePolicy.setVerticalStretch(12) sizePolicy.setHeightForWidth( self.graphicsView_2.sizePolicy().hasHeightForWidth()) self.graphicsView_2.setSizePolicy(sizePolicy) self.graphicsView_2.setObjectName("graphicsView_2") self.verticalLayout.addWidget(self.graphicsView_2) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_3 = QtWidgets.QLabel(self.layoutWidget) self.label_3.setObjectName("label_3") self.horizontalLayout_2.addWidget(self.label_3) self.lineEdit_3 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_3.sizePolicy().hasHeightForWidth()) self.lineEdit_3.setSizePolicy(sizePolicy) self.lineEdit_3.setObjectName("lineEdit_3") self.horizontalLayout_2.addWidget(self.lineEdit_3) self.label_4 = QtWidgets.QLabel(self.layoutWidget) self.label_4.setObjectName("label_4") self.horizontalLayout_2.addWidget(self.label_4) self.lineEdit_4 = QtWidgets.QLineEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit_4.sizePolicy().hasHeightForWidth()) self.lineEdit_4.setSizePolicy(sizePolicy) self.lineEdit_4.setObjectName("lineEdit_4") self.horizontalLayout_2.addWidget(self.lineEdit_4) self.pushButton_3 = QtWidgets.QPushButton(self.layoutWidget) self.pushButton_3.setObjectName("pushButton_3") self.horizontalLayout_2.addWidget(self.pushButton_3) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) self.verticalLayout.addLayout(self.horizontalLayout_2) self.progressBar = QtWidgets.QProgressBar(self.layoutWidget) self.progressBar.setProperty("value", 0) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.textEdit_2 = QtWidgets.QTextEdit(self.layoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(2) sizePolicy.setHeightForWidth( self.textEdit_2.sizePolicy().hasHeightForWidth()) self.textEdit_2.setSizePolicy(sizePolicy) self.textEdit_2.setObjectName("textEdit_2") self.verticalLayout.addWidget(self.textEdit_2) self.splitter = QtWidgets.QSplitter(self.splitter_2) self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setObjectName("splitter") self.textEdit = GLSLEditorWidget(self.splitter) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(2) sizePolicy.setHeightForWidth( self.textEdit.sizePolicy().hasHeightForWidth()) self.textEdit.setSizePolicy(sizePolicy) self.textEdit.setObjectName("textEdit") self.scrollArea = QtWidgets.QScrollArea(self.splitter) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(4) sizePolicy.setHeightForWidth( self.scrollArea.sizePolicy().hasHeightForWidth()) self.scrollArea.setSizePolicy(sizePolicy) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollAreaWidgetContents_2 = QtWidgets.QWidget() self.scrollAreaWidgetContents_2.setGeometry( QtCore.QRect(0, 0, 292, 113)) self.scrollAreaWidgetContents_2.setObjectName( "scrollAreaWidgetContents_2") self.verticalLayout_4 = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents_2) self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) self.verticalLayout_4.setObjectName("verticalLayout_4") self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5.setObjectName("verticalLayout_5") self.pushButton = QtWidgets.QPushButton( self.scrollAreaWidgetContents_2) self.pushButton.setObjectName("pushButton") self.verticalLayout_5.addWidget(self.pushButton) self.verticalLayout_4.addLayout(self.verticalLayout_5) self.scrollArea.setWidget(self.scrollAreaWidgetContents_2) self.verticalLayout_2.addWidget(self.splitter_2) self.retranslateUi(sfxPage) self.pushButton.clicked.connect(sfxPage.addDialBlock) QtCore.QMetaObject.connectSlotsByName(sfxPage) def retranslateUi(self, sfxPage): _translate = QtCore.QCoreApplication.translate sfxPage.setWindowTitle(_translate("sfxPage", "Form")) self.label.setText(_translate("sfxPage", "From")) self.label_2.setText(_translate("sfxPage", "To")) self.pushButton_2.setText(_translate("sfxPage", "Update")) self.label_3.setText(_translate("sfxPage", "From")) self.label_4.setText(_translate("sfxPage", "To")) self.pushButton_3.setText(_translate("sfxPage", "Update")) self.pushButton.setText(_translate("sfxPage", "Add Uniform"))
class Ui_SmainWindow(object): def setupUi(self, SmainWindow): width = QDesktopWidget().screenGeometry().width() height = QDesktopWidget().screenGeometry().height() '''screen_resolution = app.desktop().screenGeometry() width, height = screen_resolution.width(), screen_resolution.height()''' SmainWindow.setObjectName("SmainWindow") SmainWindow.resize((3400/3840)*width,(1700/2160)*height) SmainWindow.setMaximumSize(QtCore.QSize((3400/3840)*width,(1700/2160)*height)) SmainWindow.setMinimumSize(QtCore.QSize((3400/3840)*width,(1700/2160)*height)) self.centralwidget = QtWidgets.QWidget(SmainWindow) self.centralwidget.setObjectName("centralwidget") self.line = QtWidgets.QFrame(self.centralwidget) self.line.setGeometry(QtCore.QRect((20/3840)*width, (1070/2160)*height ,(3300/3840)*width, (30/2160)*height)) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setLineWidth(5) self.line.setObjectName("line") self.line2 = QtWidgets.QFrame(self.centralwidget) self.line2.setGeometry(QtCore.QRect((1440/3840)*width, (290/2160)*height ,(30/3840)*width, (700/2160)*height)) self.line2.setFrameShape(QtWidgets.QFrame.VLine) self.line2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line2.setLineWidth(5) self.line2.setObjectName("line2") self.line3 = QtWidgets.QFrame(self.centralwidget) self.line3.setGeometry(QtCore.QRect((2290/3840)*width, (290/2160)*height ,(30/3840)*width, (700/2160)*height)) self.line3.setFrameShape(QtWidgets.QFrame.VLine) self.line3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line3.setLineWidth(5) self.line3.setObjectName("line3") self.layout = QVBoxLayout(self.centralwidget) self.fig = Figure(figsize=((8/3840)*width, (6.5/2160)*height )) self.canvas = FigureCanvas(self.fig) self.layout.addWidget(self.canvas) self.widget = QWidget(self.centralwidget) #self.toolbar = NavigationToolbar(self.canvas, self.widget) self.layout.setMenuBar(NavigationToolbar(self.canvas,self.widget)) self.widget.setLayout(self.layout) self.widget.setGeometry((1480/3840)*width,(290/2160)*height,(800/3840)*width,(600/2160)*height) #layout.addWidget(self.canvas) ''' self.graphicsView = PlotWidget(self.centralwidget) self.graphicsView.setGeometry(QtCore.QRect(700, 150, 700, 700)) self.graphicsView.setObjectName("graphicsView") ''' self.chartView = QChartView(self.centralwidget) self.chartView.setGeometry(QtCore.QRect((200/3840)*width, (1090/2160)*height, (1700/3840)*width, (500/2160)*height)) self.chartView.setObjectName("graphicsView") self.browseFile = QtWidgets.QPushButton(self.centralwidget) self.browseFile.setGeometry(QtCore.QRect((200/3840)*width, (50/2160)*height, (350/3840)*width, (50/2160)*height)) self.browseFile.setObjectName("browseFile") self.filenameLabel = QtWidgets.QLabel(self.centralwidget) self.filenameLabel.setGeometry(QtCore.QRect((700/3840)*width, (55/2160)*height, (350/3840)*width, (70/2160)*height)) self.filenameLabel.setObjectName("filenameLabel") self.datasize = QtWidgets.QLabel(self.centralwidget) self.datasize.setGeometry(QtCore.QRect((20/3840)*width, (105/2160)*height, (350/3840)*width, (70/2160)*height)) self.datasize.setObjectName("datasize") self.datasize.setText("Data Shape :") self.datasize.setStyleSheet( """QLabel { font: bold; font-size: 10pt; font-family: Typograf;}""") self.datashape = QtWidgets.QLabel(self.centralwidget) self.datashape.setGeometry(QtCore.QRect((250/3840)*width, (105/2160)*height, (350/3840)*width, (70/2160)*height)) self.datashape.setObjectName("datashape") self.datashape.setStyleSheet( """QLabel { font: bold; font-size: 12pt; font-family: Typograf;}""") self.atributelabe = QtWidgets.QLabel(self.centralwidget) self.atributelabe.setGeometry(QtCore.QRect((295/3840)*width, (200/2160)*height, (350/3840)*width, (70/2160)*height)) self.atributelabe.setObjectName("atributelabe") self.atributelabe.setText("Variables") self.atributelabe.setStyleSheet( """QLabel { font: bold; font-size: 10pt; font-family: Typograf;}""") self.statisticlabel = QtWidgets.QLabel(self.centralwidget) self.statisticlabel.setGeometry(QtCore.QRect((1020/3840)*width, (200/2160)*height, (350/3840)*width, (70/2160)*height)) self.statisticlabel.setObjectName("statisticlabel") self.statisticlabel.setText("Statistics") self.statisticlabel.setStyleSheet( """QLabel { font: bold; font-size: 10pt; font-family: Typograf;}""") self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) self.textBrowser.setGeometry(QtCore.QRect((740/3840)*width, (290/2160)*height, (700/3840)*width, (700/2160)*height)) self.textBrowser.setObjectName("textBrowser") self.textBrowser.setStyleSheet( """QTextBrowser { font: bold; font-size: 12pt; font-family: Courier;}""") self.missingvalulabel = QtWidgets.QLabel(self.centralwidget) self.missingvalulabel.setGeometry(QtCore.QRect((2330/3840)*width, (500/2160)*height, (250/3840)*width, (100/2160)*height)) self.missingvalulabel.setObjectName("missingvalulabel") self.missingvalulabel.setText("Show Missing \nValues") self.missingvalulabel.setStyleSheet( """QLabel { font: bold; font-size: 10pt; font-family: Courier;}""") self.resetbtn = QtWidgets.QPushButton(self.centralwidget) self.resetbtn.setGeometry(QtCore.QRect((2330/3840)*width, (300/2160)*height, (250/3840)*width, (50/2160)*height)) self.resetbtn.setObjectName("resetbtn") self.resetbtn.setText("Reset") self.resetbtn.setEnabled(False) self.perclm = QtWidgets.QPushButton(self.centralwidget) self.perclm.setGeometry(QtCore.QRect((2330/3840)*width, (600/2160)*height, (250/3840)*width, (50/2160)*height)) self.perclm.setObjectName("perclm") self.perclm.setText("PerColumn") self.perclm.setEnabled(False) self.perrow = QtWidgets.QPushButton(self.centralwidget) self.perrow.setGeometry(QtCore.QRect((2330/3840)*width, (670/2160)*height, (250/3840)*width, (50/2160)*height)) self.perrow.setObjectName("perrow") self.perrow.setText("PerRow") self.perrow.setEnabled(False) self.datainfo = QtWidgets.QLabel(self.centralwidget) self.datainfo.setGeometry(QtCore.QRect((2850/3840)*width, (200/2160)*height, (350/3840)*width, (70/2160)*height)) self.datainfo.setObjectName("statisticlabel") self.datainfo.setText("Data Info") self.datainfo.setStyleSheet( """QLabel { font: bold; font-size: 10pt; font-family: Typograf;}""") self.infor = QtWidgets.QTextBrowser(self.centralwidget) self.infor.setGeometry(QtCore.QRect((2600/3840)*width, (290/2160)*height, (700/3840)*width, (700/2160)*height)) self.infor.setObjectName("infor") self.infor.setStyleSheet( """QTextBrowser { font: bold; font-family: Courier;}""") self.calstatistics = QtWidgets.QPushButton(self.centralwidget) self.calstatistics.setGeometry(QtCore.QRect((200/3840)*width, (1020/2160)*height, (350/3840)*width, (50/2160)*height)) self.calstatistics.setObjectName("calstatistics") self.listWidget = QtWidgets.QListWidget(self.centralwidget) self.listWidget.setGeometry(QtCore.QRect((20/3840)*width, (290/2160)*height, (700/3840)*width, (700/2160)*height)) self.listWidget.setObjectName("listWidget") self.listWidget.setAlternatingRowColors(True) self.comboBox = QtWidgets.QComboBox(self.centralwidget) self.comboBox.setGeometry(QtCore.QRect((1480/3840)*width,(120/2160)*height,(800/3840)*width,(50/2160)*height)) self.comboBox.setObjectName("comboBox") self.comboBox2 = QtWidgets.QComboBox(self.centralwidget) self.comboBox2.setGeometry(QtCore.QRect((1480/3840)*width,(200/2160)*height,(800/3840)*width,(50/2160)*height)) self.comboBox2.setObjectName("comboBox2") self.report = QtWidgets.QPushButton(self.centralwidget) self.report.setGeometry(QtCore.QRect((1700/3840)*width, (1020/2160)*height, (300/3840)*width, (50/2160)*height)) self.report.setObjectName("report") self.report.setText("Generate Report") self.back = QtWidgets.QPushButton(self.centralwidget) self.back.setGeometry(QtCore.QRect((5/3840)*width, (1600/2160)*height, (300/3840)*width, (50/2160)*height)) self.back.setObjectName("back") self.back.setText("Back") self.back.setStyleSheet( """QPushButton { border-radius:0; border:0; text-align:left; padding-left:70px; qproperty-icon:url('back.png'); qproperty-iconSize: 40px 40px;}""") SmainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(SmainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, (469/3840)*width, (22/2160)*height)) self.menubar.setObjectName("menubar") SmainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(SmainWindow) self.statusbar.setObjectName("statusbar") SmainWindow.setStatusBar(self.statusbar) self.retranslateUi(SmainWindow) QtCore.QMetaObject.connectSlotsByName(SmainWindow) def retranslateUi(self, SmainWindow): _translate = QtCore.QCoreApplication.translate SmainWindow.setWindowTitle(_translate("SmainWindow", "Data Statistical Analysis")) self.browseFile.setText(_translate("SmainWindow", "Open File")) self.browseFile.clicked.connect(self.pushButton_handler) self.filenameLabel.setText(_translate("SmainWindow", "")) self.calstatistics.setText(_translate("SmainWindow", "Calculate Statistics")) self.calstatistics.clicked.connect(self.cal) self.listWidget.clicked.connect(self.listview_clicked) self.resetbtn.clicked.connect(self.information) self.perclm.clicked.connect(self.num_missing) self.perrow.clicked.connect(self.row_missing) self.report.clicked.connect(self.generatereport) def pushButton_handler(self): self.open_dialog_box() def open_dialog_box(self): filename = QFileDialog.getOpenFileName(None, 'Open File', r"~/Desktop", '*.csv') path = filename[0] with open(path, "r") as fpath: self.infor.clear() self.comboBox.clear() self.comboBox2.clear() self.datasetheaders=[] self.filenameLabel.setText(str(path)) self.filenameLabel.adjustSize() pandas.set_option('display.max_rows', None) self.dataset=pandas.read_csv(fpath) buf = io.StringIO() self.dataset.info(verbose=True, null_counts=True,buf=buf) s = buf.getvalue() self.perclm.setDisabled(False) self.perrow.setDisabled(False) self.infor.append(s) SIZE=self.dataset.shape self.datashape.setText(str(SIZE)) self.create_piechart() #headers=self.dataset.columns self.datasetheaders=self.dataset.columns.to_numpy() self.listWidget.clear() for i in range(len(self.datasetheaders)-1): self.listWidget.insertItem(i,self.datasetheaders[i]) for i in range(len(self.datasetheaders)-1): self.comboBox.addItem(self.datasetheaders[i]) for i in range(len(self.datasetheaders)-1): self.comboBox2.addItem(self.datasetheaders[i]) self.setup() self.comboBox.currentIndexChanged.connect(self.setup) self.comboBox2.currentIndexChanged.connect(self.setup) #print(unique_headers) '''print ("Missing values per column:") print(self.dataset.apply(lambda x: sum(x.isnull()))) ''' def generatereport(self): try: profile = ProfileReport(self.dataset) profile.to_file(output_file="AnalysisReport.html") print("yes") except Exception as e: print(repr(e)) def information(self): self.infor.clear() self.resetbtn.setEnabled(False) self.perrow.setDisabled(False) self.perclm.setDisabled(False) buf = io.StringIO() self.dataset.info(verbose=True, null_counts=True,buf=buf) s = buf.getvalue() self.infor.append(s) def row_missing(self): self.perrow.setEnabled(False) self.perclm.setDisabled(False) self.resetbtn.setDisabled(False) self.infor.clear() #self.infor.append(str(self.dataset.apply(lambda x: sum(x.isnull())))) self.infor.append(str(self.dataset.apply(self.missing, axis=1))) def num_missing(self): self.perclm.setEnabled(False) self.perrow.setDisabled(False) self.resetbtn.setDisabled(False) self.infor.clear() #self.infor.append(str(self.dataset.apply(lambda x: sum(x.isnull())))) self.infor.append(str(self.dataset.apply(self.missing, axis=0))) def missing(self,x): return sum(x.isnull()) def setup(self): try: print("fig") iris=self.dataset x_index = 0 y_index = 1 w=iris.iloc[:,self.comboBox.currentIndex()] z=iris.iloc[:,self.comboBox2.currentIndex()] y=iris.iloc[:,-1].values # this formatter will label the colorbar with the correct target names #formatter = plt.FuncFormatter(y) #plt.figure(figsize=(5, 4)) ax = self.fig.add_subplot(111) ax.clear() scatter=ax.scatter(w, z, c=y) #self.figure.colorbar(ticks=y) #ax.xlabel("iris.feature_names[x_index]") #ax.ylabel("iris.feature_names[y_index]") ax.set_xlabel(self.comboBox.currentText(), fontsize=25) ax.set_ylabel(self.comboBox2.currentText(), fontsize=25) ax.set_title('Scatter Plot',fontsize=25) legend1 = ax.legend(*scatter.legend_elements(), loc="lower left", title="Classes") ax.add_artist(legend1) self.widget.adjustSize() print("fig123456789") except Exception as e: print(repr(e)) def cal(self): #self.graphicsView.clear() z=self.dataset w=z.iloc[:,self.a] self.textBrowser.setText("Mean:\n"+str(np.mean(w))+"\nMedian:\n"+str(np.median(w))+"\nMode:\n"+str(stats.mode(w))+"\nvariance:\n"+str(np.var(w))+"\nStdev:\n"+str(np.std(w))) #self.textBrowser.adjustSize() ''' pen = pg.mkPen(color=(255, 0, 0),width=8) self.graphicsView.setBackground('w') self.graphicsView.plot(w,symbol='+',symbolSize=30, pen=pen) ''' def listview_clicked(self): item=self.listWidget.currentRow() self.a=item def create_piechart(self): z=self.dataset w=z.iloc[:,-1] r=w.value_counts() p=r.to_numpy() y=w.nunique() df_val_counts = pandas.DataFrame(r) df_val_counts = df_val_counts.reset_index() df_val_counts.columns = ['unique_values', 'counts'] w=df_val_counts.iloc[:,0].to_numpy() k=df_val_counts.iloc[:,1].to_numpy() res = w.astype(str) series = QPieSeries() for i in range(y): series.append(res[i], k[i]) chart = self.chartView.chart() chart.removeAllSeries() chart.legend().hide() chart.addSeries(series) chart.createDefaultAxes() chart.setAnimationOptions(QChart.AllAnimations) chart.setTitle("Pie Chart") chart.legend().setVisible(True) chart.legend().setAlignment(Qt.AlignBottom) #self.chartView = QChartView(chart) self.chartView.setRenderHint(QPainter.Antialiasing)
class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1020, 433) MainWindow.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedKingdom)) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setLocale( QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedKingdom)) self.centralwidget.setObjectName("centralwidget") self.tabWidget = QtWidgets.QTabWidget(self.centralwidget) self.tabWidget.setGeometry(QtCore.QRect(10, 10, 971, 341)) self.tabWidget.setToolTipDuration(0) self.tabWidget.setObjectName("tabWidget") self.Connection = QtWidgets.QWidget() self.Connection.setObjectName("Connection") self.serialSettings = QtWidgets.QGroupBox(self.Connection) self.serialSettings.setGeometry(QtCore.QRect(9, 9, 231, 301)) self.serialSettings.setObjectName("serialSettings") self.availablePorts = QtWidgets.QComboBox(self.serialSettings) self.availablePorts.setGeometry(QtCore.QRect(10, 50, 211, 22)) self.availablePorts.setObjectName("availablePorts") self.refreshAvailablePorts = QtWidgets.QPushButton(self.serialSettings) self.refreshAvailablePorts.setGeometry(QtCore.QRect(10, 20, 211, 23)) self.refreshAvailablePorts.setObjectName("refreshAvailablePorts") self.connectPort = QtWidgets.QPushButton(self.serialSettings) self.connectPort.setGeometry(QtCore.QRect(10, 270, 211, 23)) self.connectPort.setCheckable(True) self.connectPort.setObjectName("connectPort") self.canInterfaceTypes = QtWidgets.QComboBox(self.serialSettings) self.canInterfaceTypes.setGeometry(QtCore.QRect(10, 80, 211, 22)) self.canInterfaceTypes.setObjectName("canInterfaceTypes") self.canInterfaceTypes.addItem("") self.canInterfaceTypes.setItemText(0, "slcan") self.canInterfaceTypes.addItem("") self.canInterfaceTypes.setItemText(1, "serial") self.canReceived = QtWidgets.QPlainTextEdit(self.Connection) self.canReceived.setGeometry(QtCore.QRect(243, 20, 711, 291)) self.canReceived.setObjectName("canReceived") self.tabWidget.addTab(self.Connection, "") self.Simulation = QtWidgets.QWidget() self.Simulation.setObjectName("Simulation") self.gridLayoutWidget = QtWidgets.QWidget(self.Simulation) self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 10, 317, 128)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.fuelField = QtWidgets.QLineEdit(self.gridLayoutWidget) self.fuelField.setReadOnly(True) self.fuelField.setObjectName("fuelField") self.gridLayout.addWidget(self.fuelField, 1, 3, 1, 1) self.fuelLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.fuelLabel.setAlignment(QtCore.Qt.AlignCenter) self.fuelLabel.setObjectName("fuelLabel") self.gridLayout.addWidget(self.fuelLabel, 0, 3, 1, 1) self.engineLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.engineLabel.setAlignment(QtCore.Qt.AlignCenter) self.engineLabel.setObjectName("engineLabel") self.gridLayout.addWidget(self.engineLabel, 0, 4, 1, 1) self.positionLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.positionLabel.setAlignment(QtCore.Qt.AlignCenter) self.positionLabel.setObjectName("positionLabel") self.gridLayout.addWidget(self.positionLabel, 0, 1, 1, 1) self.timeLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.timeLabel.setAlignment(QtCore.Qt.AlignCenter) self.timeLabel.setObjectName("timeLabel") self.gridLayout.addWidget(self.timeLabel, 0, 0, 1, 1) self.speedField = QtWidgets.QLineEdit(self.gridLayoutWidget) self.speedField.setReadOnly(True) self.speedField.setObjectName("speedField") self.gridLayout.addWidget(self.speedField, 1, 2, 1, 1) self.engineField = QtWidgets.QLineEdit(self.gridLayoutWidget) self.engineField.setObjectName("engineField") self.gridLayout.addWidget(self.engineField, 1, 4, 1, 1) self.positionField = QtWidgets.QLineEdit(self.gridLayoutWidget) self.positionField.setReadOnly(True) self.positionField.setObjectName("positionField") self.gridLayout.addWidget(self.positionField, 1, 1, 1, 1) self.makeStepButton = QtWidgets.QPushButton(self.gridLayoutWidget) self.makeStepButton.setObjectName("makeStepButton") self.gridLayout.addWidget(self.makeStepButton, 2, 0, 1, 5) self.speedLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.speedLabel.setAlignment(QtCore.Qt.AlignCenter) self.speedLabel.setObjectName("speedLabel") self.gridLayout.addWidget(self.speedLabel, 0, 2, 1, 1) self.simulationStart = QtWidgets.QPushButton(self.gridLayoutWidget) self.simulationStart.setCheckable(True) self.simulationStart.setObjectName("simulationStart") self.gridLayout.addWidget(self.simulationStart, 3, 0, 1, 5) self.timeField = QtWidgets.QLineEdit(self.gridLayoutWidget) self.timeField.setReadOnly(True) self.timeField.setObjectName("timeField") self.gridLayout.addWidget(self.timeField, 1, 0, 1, 1) self.resetSimulationButton = QtWidgets.QPushButton( self.gridLayoutWidget) self.resetSimulationButton.setObjectName("resetSimulationButton") self.gridLayout.addWidget(self.resetSimulationButton, 4, 0, 1, 5) self.gridLayoutWidget_2 = QtWidgets.QWidget(self.Simulation) self.gridLayoutWidget_2.setGeometry(QtCore.QRect(329, 9, 631, 301)) self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") self.chartsGrid = QtWidgets.QGridLayout(self.gridLayoutWidget_2) self.chartsGrid.setContentsMargins(0, 0, 0, 0) self.chartsGrid.setObjectName("chartsGrid") self.fuelChartW = QChartView(self.gridLayoutWidget_2) self.fuelChartW.setObjectName("fuelChartW") self.chartsGrid.addWidget(self.fuelChartW, 1, 0, 1, 1) self.positionChartW = QChartView(self.gridLayoutWidget_2) self.positionChartW.setObjectName("positionChartW") self.chartsGrid.addWidget(self.positionChartW, 0, 0, 1, 1) self.engineChartW = QChartView(self.gridLayoutWidget_2) self.engineChartW.setObjectName("engineChartW") self.chartsGrid.addWidget(self.engineChartW, 1, 1, 1, 1) self.speedChartW = QChartView(self.gridLayoutWidget_2) self.speedChartW.setObjectName("speedChartW") self.chartsGrid.addWidget(self.speedChartW, 0, 1, 1, 1) self.tabWidget.addTab(self.Simulation, "") self.Settings = QtWidgets.QWidget() self.Settings.setObjectName("Settings") self.langSelector = QtWidgets.QComboBox(self.Settings) self.langSelector.setGeometry(QtCore.QRect(70, 10, 69, 22)) self.langSelector.setObjectName("langSelector") self.langSelector.addItem("") self.langSelector.setItemText(0, "") self.langSelectorLabel = QtWidgets.QLabel(self.Settings) self.langSelectorLabel.setGeometry(QtCore.QRect(10, 10, 47, 13)) self.langSelectorLabel.setObjectName("langSelectorLabel") self.tabWidget.addTab(self.Settings, "") MainWindow.setCentralWidget(self.centralwidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 1020, 21)) self.menuBar.setObjectName("menuBar") self.menuMain = QtWidgets.QMenu(self.menuBar) self.menuMain.setObjectName("menuMain") self.menuAbout = QtWidgets.QMenu(self.menuBar) self.menuAbout.setObjectName("menuAbout") MainWindow.setMenuBar(self.menuBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.actionClose = QtWidgets.QAction(MainWindow) self.actionClose.setObjectName("actionClose") self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.actionImport_Settings = QtWidgets.QAction(MainWindow) self.actionImport_Settings.setObjectName("actionImport_Settings") self.actionExport_Settings = QtWidgets.QAction(MainWindow) self.actionExport_Settings.setObjectName("actionExport_Settings") self.menuMain.addAction(self.actionImport_Settings) self.menuMain.addAction(self.actionExport_Settings) self.menuMain.addSeparator() self.menuMain.addAction(self.actionClose) self.menuAbout.addAction(self.actionAbout) self.menuBar.addAction(self.menuMain.menuAction()) self.menuBar.addAction(self.menuAbout.menuAction()) self.retranslateUi(MainWindow) self.tabWidget.setCurrentIndex(1) self.actionClose.triggered.connect(MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "Simulator")) self.serialSettings.setTitle( _translate("MainWindow", "Serial communication settings")) self.refreshAvailablePorts.setText(_translate("MainWindow", "Refresh")) self.connectPort.setText(_translate("MainWindow", "Connect")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Connection), _translate("MainWindow", "Connection")) self.fuelLabel.setText(_translate("MainWindow", "Fuel")) self.engineLabel.setText(_translate("MainWindow", "Engine")) self.positionLabel.setText(_translate("MainWindow", "Position")) self.timeLabel.setText(_translate("MainWindow", "Time")) self.makeStepButton.setText( _translate("MainWindow", "Make Simulation &Step!")) self.speedLabel.setText(_translate("MainWindow", "Speed")) self.simulationStart.setText( _translate("MainWindow", "Start Simulation!")) self.resetSimulationButton.setText( _translate("MainWindow", "Reset Simulation!")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Simulation), _translate("MainWindow", "Simulation")) self.langSelectorLabel.setText(_translate("MainWindow", "Language")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.Settings), _translate("MainWindow", "Settings")) self.menuMain.setTitle(_translate("MainWindow", "Main")) self.menuAbout.setTitle(_translate("MainWindow", "About")) self.actionClose.setText(_translate("MainWindow", "Close")) self.actionAbout.setText(_translate("MainWindow", "About")) self.actionImport_Settings.setText( _translate("MainWindow", "Import Settings")) self.actionExport_Settings.setText( _translate("MainWindow", "Export Settings"))