class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(400, 120) Dialog.setMinimumSize(QSize(400, 120)) Dialog.setMaximumSize(QSize(400, 120)) self.verticalLayout = QVBoxLayout(Dialog) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(9, 9, 9, 9) self.bg_diag = QFrame(Dialog) self.bg_diag.setObjectName(u"bg_diag") self.bg_diag.setStyleSheet(u"background-color: rgb(29, 0, 86);\n" "border-radius: 10px;") self.bg_diag.setFrameShape(QFrame.NoFrame) self.bg_diag.setFrameShadow(QFrame.Raised) self.tittle_bar = QFrame(self.bg_diag) self.tittle_bar.setObjectName(u"tittle_bar") self.tittle_bar.setGeometry(QRect(10, 10, 361, 31)) self.tittle_bar.setFrameShape(QFrame.StyledPanel) self.tittle_bar.setFrameShadow(QFrame.Raised) self.lbl_falhaLogar = QLabel(self.tittle_bar) self.lbl_falhaLogar.setObjectName(u"lbl_falhaLogar") self.lbl_falhaLogar.setGeometry(QRect(64, -9, 241, 41)) self.lbl_falhaLogar.setStyleSheet(u"color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";") self.pushButton = QPushButton(self.bg_diag) self.pushButton.setObjectName(u"pushButton") self.pushButton.setGeometry(QRect(161, 60, 61, 31)) self.pushButton.setStyleSheet(u"background-color: rgb(53, 159, 159);\n" "color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";\n" "") self.verticalLayout.addWidget(self.bg_diag) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Dialog", None)) self.lbl_falhaLogar.setText( QCoreApplication.translate("Dialog", u"Falha ao logar usu\u00e1rio", None)) self.pushButton.setText( QCoreApplication.translate("Dialog", u"Ok", None))
class SecondWidget4(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent=parent) layout = QtWidgets.QVBoxLayout(self) label1 = QLabel('입력', self) label1.setAlignment(Qt.AlignVCenter) label1.move(200, 30) label2 = QLabel('결과', self) label2.setAlignment(Qt.AlignVCenter) label2.move(710, 30) self.text_dox1 = QTextEdit(self) self.text_dox1.resize(350, 350) self.text_dox1.move(50, 60) self.text_dox2 = QTextBrowser(self) self.text_dox2.append('') self.text_dox2.setGeometry(550, 60, 350, 350) self.dk_base64 = QPushButton("OK", self) self.dk_base64.setGeometry(50, 420, 850, 45) self.dk_base64.clicked.connect(self.base64_conversion) self.back = QPushButton(self) self.back.setStyleSheet( ''' QPushButton{image:url(./img/back_img.png); border:0px;} QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;} ''') self.back.setGeometry(0, 0, 50, 50) self.back.clicked.connect(self.change_stack1) def change_stack1(self): self.parent().stack.setCurrentIndex(4) def base64_conversion(self): # print(self.text_dox1.toPlainText()) sitename_bytes = base64.b64decode(self.text_dox1.toPlainText()) sitename = sitename_bytes.decode('utf-8') print(sitename) # 내용 초기화 self.text_dox2.clear() self.text_dox2.repaint() self.text_dox2.append(str(sitename))
def recordBox(self): # create box box = QtWidgets.QGroupBox('Grave seu audio') outer_layout = QtWidgets.QVBoxLayout() # add input box layout = QtWidgets.QHBoxLayout() line = QtWidgets.QLineEdit(self) line.setGeometry(20, 20, 200, 20) layout.addWidget(line) self.line = line # add button record_button = QtWidgets.QPushButton('Gravar', self) record_button.setGeometry(250, 20, 50, 20) record_button.clicked.connect(self.record_clicked) self.record_button = record_button layout.addWidget(record_button) outer_layout.addLayout(layout) inner_layout = QtWidgets.QHBoxLayout() save_button = QPushButton('Salvar', self) save_button.setGeometry(250, 20, 50, 20) save_button.clicked.connect(self.save_clicked) play_button = QPushButton('Ouvir', self) play_button.setGeometry(250, 20, 50, 20) play_button.clicked.connect(self.play_clicked) inner_layout.addWidget(save_button) inner_layout.addWidget(play_button) outer_layout.addLayout(inner_layout) box.setLayout(outer_layout) return box
class SecondWidget(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent=parent) self.butt1 = QPushButton(self) self.butt1.setStyleSheet('image:url(./img/text_img.png);border:0px;') self.butt1.setGeometry(50, 50, 400, 400) self.butt1.clicked.connect(self.change_stack1) self.butt2 = QPushButton(self) self.butt2.setStyleSheet('image:url(./img/image_img.png);border:0px;') self.butt2.setGeometry(500, 50, 400, 400) self.butt2.clicked.connect(self.change_stack2) self.back = QPushButton(self) self.back.setStyleSheet( ''' QPushButton{image:url(./img/back_img.png); border:0px;} QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;} ''') self.back.setGeometry(0, 0, 50, 50) self.back.clicked.connect(self.change_stack3) #2 텍스트 인코딩 페이지 def change_stack1(self): self.parent().stack.setCurrentIndex(2) # 3 이미지 인코딩 페이지 def change_stack2(self): self.parent().stack.setCurrentIndex(3) # 뒤로 가기 def change_stack3(self): self.parent().stack.setCurrentIndex(0)
class SecondWidget2(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent=parent) self.back = QPushButton(self) self.back.setStyleSheet( ''' QPushButton{image:url(./img/back_img.png); border:0px;} QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;} ''') self.back.setGeometry(0, 0, 50, 50) self.back.clicked.connect(self.change_stack1) label1 = QLabel(' 중요한 이미지는 변환하지마세요 BASE64는 보안으로 매우 약합니다 간단한 텍스트 용도으로 사용하기 때문에 이미지 \n 변환은 권장하지 않습니다', self) label1.move(125, 180) self.files = QPushButton("파일 선택", self) self.files.setGeometry(50, 100, 850, 50) self.files.clicked.connect(self.pushButtonClicked) self.files_encoding = QPushButton("OK", self) self.files_encoding.setGeometry(800, 450, 100, 30) self.files_encoding.clicked.connect(self.base64_files_encoding) def pushButtonClicked(self): # self.FileOpen = QFileDialog.getOpenFileName(self, '열기', './') ''' 특정 확장자 검색 https://doc.qt.io/qt-5/qfiledialog.html 참조 ''' # self.FileOpen = QFileDialog.getOpenFileName(self, '열기', '','Images (*.png *.jpg *.bmp);; All File(*)') self.FileOpen = QFileDialog.getOpenFileName(self, '열기', '','Images (*.png *.jpg *.bmp)') # self.files.setText(self.FileOpen[0]) print(self.FileOpen[0]) def base64_files_encoding(self): with open(self.FileOpen[0], 'rb') as imagefile: byteform = base64.b64encode(imagefile.read()) f = open('C:/Users/'+user_name+'/Desktop/base64encoding.bin', 'wb') f.write(byteform) f.close() guidance = QMessageBox.information(self, 'base64', '바탕화면에 base64encoding.bin 파일이 생성했습니다', QMessageBox.Ok) print('완료') def change_stack1(self): self.parent().stack.setCurrentIndex(1)
def __init__(self, parent=None): super().__init__(parent=parent) btnRun1 = QPushButton(self) btnRun1.setStyleSheet('image:url(./img/1_img_kr.png);border:0px;') btnRun1.setGeometry(50, 50, 400, 400) btnRun1.clicked.connect(self.change_stack1) btnRun2 = QPushButton(self) btnRun2.setStyleSheet('image:url(./img/2_img_kr.png);border:0px;') btnRun2.setGeometry(500, 50, 400, 400) btnRun2.clicked.connect(self.change_stack2) exit_button = QPushButton(self) exit_button.setStyleSheet('image:url(./img/PNG_exit_2.png);border:0px;') exit_button.setGeometry(900, 0, 50, 50) exit_button.clicked.connect(QCoreApplication.instance().quit)
class SecondWidget5(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent=parent) self.files = QPushButton("파일 선택", self) self.files.setGeometry(50, 100, 850, 50) self.files.clicked.connect(self.pushButtonClicked) self.files_encoding = QPushButton("OK", self) self.files_encoding.setGeometry(800, 450, 100, 30) self.files_encoding.clicked.connect(self.base64_files_encoding) self.back = QPushButton(self) self.back.setStyleSheet( ''' QPushButton{image:url(./img/back_img.png); border:0px;} QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;} ''') self.back.setGeometry(0, 0, 50, 50) self.back.clicked.connect(self.change_stack1) def change_stack1(self): self.parent().stack.setCurrentIndex(4) def pushButtonClicked(self): # self.FileOpen = QFileDialog.getOpenFileName(self, '열기', './') self.FileOpen = QFileDialog.getOpenFileName(self, '열기', '','Images (*.bin)') # self.files.setText(self.FileOpen[0]) print(self.FileOpen[0]) def base64_files_encoding(self): print(self.FileOpen[0]) file = open(self.FileOpen[0], 'r') decoding = file.read() im = Image.open(BytesIO(base64.b64decode(decoding))) im.save('C:/Users/'+user_name+'/Desktop/b64decode_images.png', 'PNG') guidance = QMessageBox.information(self, 'base64', '바탕화면에 b64decode_images.png 이 생성했습니다', QMessageBox.Ok) print("완료")
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(450, 520) MainWindow.setMinimumSize(QSize(450, 520)) MainWindow.setMaximumSize(QSize(450, 520)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.bg_frame_2 = QVBoxLayout(self.centralwidget) self.bg_frame_2.setSpacing(0) self.bg_frame_2.setObjectName(u"bg_frame_2") self.bg_frame_2.setContentsMargins(10, 10, 10, 10) self.bg_frame = QFrame(self.centralwidget) self.bg_frame.setObjectName(u"bg_frame") self.bg_frame.setStyleSheet(u"background-color: rgb(29, 0, 86);\n" "border-radius: 10px;") self.bg_frame.setFrameShape(QFrame.NoFrame) self.bg_frame.setFrameShadow(QFrame.Raised) self.tittle_bar = QFrame(self.bg_frame) self.tittle_bar.setObjectName(u"tittle_bar") self.tittle_bar.setGeometry(QRect(10, 10, 411, 31)) self.tittle_bar.setFrameShape(QFrame.StyledPanel) self.tittle_bar.setFrameShadow(QFrame.Raised) self.label = QLabel(self.tittle_bar) self.label.setObjectName(u"label") self.label.setGeometry(QRect(10, 0, 61, 31)) self.label.setStyleSheet(u"color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";") self.button_close = QPushButton(self.tittle_bar) self.button_close.setObjectName(u"button_close") self.button_close.setGeometry(QRect(380, 0, 21, 24)) self.button_close.setStyleSheet(u"background-color: rgb(152, 0, 0);\n" "font: 14pt \"Segoe UI\";") self.button_minimize = QPushButton(self.tittle_bar) self.button_minimize.setObjectName(u"button_minimize") self.button_minimize.setGeometry(QRect(350, 0, 21, 24)) self.button_minimize.setStyleSheet( u"background-color: rgb(53, 159, 159);\n" "font: 14pt \"Segoe UI\";") self.user_login = QLineEdit(self.bg_frame) self.user_login.setObjectName(u"user_login") self.user_login.setGeometry(QRect(60, 160, 301, 51)) self.user_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n" "") self.pass_login = QLineEdit(self.bg_frame) self.pass_login.setObjectName(u"pass_login") self.pass_login.setGeometry(QRect(60, 281, 301, 51)) self.pass_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n" "") self.user_lbl = QLabel(self.bg_frame) self.user_lbl.setObjectName(u"user_lbl") self.user_lbl.setGeometry(QRect(170, 110, 81, 41)) self.user_lbl.setStyleSheet(u"color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";") self.senha_lbl = QLabel(self.bg_frame) self.senha_lbl.setObjectName(u"senha_lbl") self.senha_lbl.setGeometry(QRect(179, 230, 71, 41)) self.senha_lbl.setStyleSheet(u"color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";") self.btn_login = QPushButton(self.bg_frame) self.btn_login.setObjectName(u"btn_login") self.btn_login.setGeometry(QRect(160, 360, 101, 41)) self.btn_login.setStyleSheet(u"background-color: rgb(53, 159, 159);\n" "color: rgb(255, 255, 255);\n" "font: 18pt \"Segoe UI\";\n" "") self.bg_frame_2.addWidget(self.bg_frame) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"Login", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Login", None)) self.button_close.setText( QCoreApplication.translate("MainWindow", u"x", None)) self.button_minimize.setText( QCoreApplication.translate("MainWindow", u"-", None)) self.user_lbl.setText( QCoreApplication.translate("MainWindow", u"Usu\u00e1rio", None)) self.senha_lbl.setText( QCoreApplication.translate("MainWindow", u"Senha", None)) self.btn_login.setText( QCoreApplication.translate("MainWindow", u"Logar", None))
class RenderData(QWidget): def __init__(self, db_name_from_visualize): super().__init__() self.db_name_from_visual_btn = db_name_from_visualize self.type_of_display = QLabel( "Please choose how you'd like to display the data", self) self.type_of_display.move(20, 20) self.type_of_display.setStyleSheet("border: 1px solid black;") self.type_of_display.setFont(QFont("Calibre", 12)) self.which_data = QLabel( "Please select which data you'd like to display", self) self.which_data.move(430, 20) self.which_data.setStyleSheet("border: 1px solid black") self.which_data.setFont(QFont("Calibre", 12)) # LIST BOXES display_list = QListWidget(self) self.list_control = display_list display_list.resize(770, 440) display_list.move(10, 200) # CHECK BOXES self.color_coded_checkbox = QCheckBox("Color coded text in a list", self) self.color_coded_checkbox.move(100, 60) self.color_coded_checkbox.clicked.connect( self.swap_color_coded_checkbox) self.render_map_checkbox = QCheckBox("Render a Map", self) self.render_map_checkbox.move(100, 90) self.render_map_checkbox.toggle() self.render_map_checkbox.clicked.connect(self.swap_render_map_checkbox) self.analysis_type1_checkbox = QCheckBox( "Compare the number of college graduates in a state \n(for the most recent " "year) with number of jobs in that \nstate that likely expect a college " "education.", self) self.analysis_type1_checkbox.setGeometry(430, 20, 300, 100) self.analysis_type1_checkbox.clicked.connect( self.swap_num_grads_checkbox) self.analysis_type2_checkbox = QCheckBox( "Compare the 3 year graduate cohort declining balance \npercentage to " "the 25% salary in the state.", self) self.analysis_type2_checkbox.setGeometry(430, 70, 400, 100) self.analysis_type2_checkbox.toggle() self.analysis_type2_checkbox.clicked.connect( self.swap_3_yr_cohort_checkbox) # PUSH BUTTONS self.render_data_button = QPushButton("VISUALIZE", self) self.render_data_button.setGeometry(10, 150, 770, 40) self.render_data_button.clicked.connect(self.display_visualization) self.sort_ascending_button = QPushButton("Sort Ascending", self) self.sort_ascending_button.setGeometry(10, 650, 120, 30) self.sort_ascending_button.clicked.connect(self.sort_ascending) self.sort_descending_button = QPushButton("Sort Descending", self) self.sort_descending_button.setGeometry(130, 650, 120, 30) self.sort_descending_button.clicked.connect(self.sort_descending) self.close_visual_window_button = QPushButton("CLOSE", self) self.close_visual_window_button.setGeometry(660, 650, 120, 30) self.close_visual_window_button.clicked.connect(lambda: self.close()) self.setWindowTitle( "Data Visualization for Project 1 - Sprint 4 - Ryan O'Connor - COMP490 - T/R" ) self.setGeometry(100, 100, 800, 700) self.setFixedSize(800, 700) self.center() def display_visualization(self): conn, cursor = open_db(self.db_name_from_visual_btn) cursor.execute( 'SELECT school_state, student_size_2018 FROM school_export') table = cursor.fetchall() self.list_control.clear() num_grads_in_state = { "AK": 0, "AL": 0, "AR": 0, "AS": 0, "AZ": 0, "CA": 0, "CO": 0, "CT": 0, "DC": 0, "DE": 0, "FL": 0, "FM": 0, "GA": 0, "GU": 0, "HI": 0, "IA": 0, "ID": 0, "IL": 0, "IN": 0, "KS": 0, "KY": 0, "LA": 0, "MA": 0, "MD": 0, "ME": 0, "MH": 0, "MI": 0, "MN": 0, "MO": 0, "MP": 0, "MS": 0, "MT": 0, "NC": 0, "ND": 0, "NE": 0, "NH": 0, "NJ": 0, "NM": 0, "NV": 0, "NY": 0, "OH": 0, "OK": 0, "OR": 0, "PA": 0, "PR": 0, "PW": 0, "RI": 0, "SC": 0, "SD": 0, "TN": 0, "TX": 0, "UT": 0, "VA": 0, "VI": 0, "VT": 0, "WA": 0, "WI": 0, "WV": 0, "WY": 0 } for idx, row in enumerate(table): if row[1] is None: continue else: state_abbr_from_table = row[0] student_size_2018 = row[1] state_total = num_grads_in_state[state_abbr_from_table] num_grads_in_state[ state_abbr_from_table] = state_total + student_size_2018 # Dividing by 4 years here - to simplify the size of a senior graduating class for student_total_2018 in num_grads_in_state: num_grads_in_state[student_total_2018] = num_grads_in_state[ student_total_2018] / 4 # DATA ANALYSIS - PART 1B num_jobs_in_state = { "AK": 0, "AL": 0, "AR": 0, "AS": 0, "AZ": 0, "CA": 0, "CO": 0, "CT": 0, "DC": 0, "DE": 0, "FL": 0, "FM": 0, "GA": 0, "GU": 0, "HI": 0, "IA": 0, "ID": 0, "IL": 0, "IN": 0, "KS": 0, "KY": 0, "LA": 0, "MA": 0, "MD": 0, "ME": 0, "MH": 0, "MI": 0, "MN": 0, "MO": 0, "MP": 0, "MS": 0, "MT": 0, "NC": 0, "ND": 0, "NE": 0, "NH": 0, "NJ": 0, "NM": 0, "NV": 0, "NY": 0, "OH": 0, "OK": 0, "OR": 0, "PA": 0, "PR": 0, "PW": 0, "RI": 0, "SC": 0, "SD": 0, "TN": 0, "TX": 0, "UT": 0, "VA": 0, "VI": 0, "VT": 0, "WA": 0, "WI": 0, "WV": 0, "WY": 0 } cursor.execute( 'SELECT area_title, occ_code, tot_emp FROM jobdata_by_state') table = cursor.fetchall() for idx, row in enumerate(table): check_occ_code = row[1] check_occ_code = int(check_occ_code[:2]) if 30 <= check_occ_code <= 49: continue else: state_from_school_export = str(row[0]) abbr_state = abbreviate_state(state_from_school_export) tot_emp_jobs_in_state = int(row[2]) tot_emp = num_jobs_in_state[abbr_state] num_jobs_in_state[abbr_state] = tot_emp + tot_emp_jobs_in_state compare_total_jobs_to_grads = { k: (num_jobs_in_state[k] / num_grads_in_state[k]) for k in num_jobs_in_state } display_data = open("display_map_data.csv", "w+") display_data.writelines("state,data\n") for key in compare_total_jobs_to_grads: total_jobs_rounded = (round(compare_total_jobs_to_grads[key], 2)) if total_jobs_rounded == 0: display_data.writelines(f"{key}, {total_jobs_rounded}\n") else: display_data.writelines(f"{key}, {total_jobs_rounded}\n") display_data.close() # DATA ANALYSIS PART 2A repayment_2016_dict = { "AK": 0, "AL": 0, "AR": 0, "AS": 0, "AZ": 0, "CA": 0, "CO": 0, "CT": 0, "DC": 0, "DE": 0, "FL": 0, "FM": 0, "GA": 0, "GU": 0, "HI": 0, "IA": 0, "ID": 0, "IL": 0, "IN": 0, "KS": 0, "KY": 0, "LA": 0, "MA": 0, "MD": 0, "ME": 0, "MH": 0, "MI": 0, "MN": 0, "MO": 0, "MP": 0, "MS": 0, "MT": 0, "NC": 0, "ND": 0, "NE": 0, "NH": 0, "NJ": 0, "NM": 0, "NV": 0, "NY": 0, "OH": 0, "OK": 0, "OR": 0, "PA": 0, "PR": 0, "PW": 0, "RI": 0, "SC": 0, "SD": 0, "TN": 0, "TX": 0, "UT": 0, "VA": 0, "VI": 0, "VT": 0, "WA": 0, "WI": 0, "WV": 0, "WY": 0 } cursor.execute( 'SELECT school_state, repayment_repayment_cohort_3_year_declining_balance_2016 FROM school_export' ) table = cursor.fetchall() for idx, row in enumerate(table): if row[1] is None: continue else: state_from_school_export = str(row[0]) repayment_2016_data = row[1] repayment_2016_data_tot_sum = repayment_2016_dict[ state_from_school_export] repayment_2016_dict[ state_from_school_export] = repayment_2016_data + repayment_2016_data_tot_sum for key in repayment_2016_dict: if repayment_2016_dict[key] == 0: repayment_2016_dict[ key] = 0.0001 # States with 0 data get this due to dividing by 0 # DATA ANALYSIS - PART 2B a_pc25_dict = { "AK": 0, "AL": 0, "AR": 0, "AS": 0, "AZ": 0, "CA": 0, "CO": 0, "CT": 0, "DC": 0, "DE": 0, "FL": 0, "FM": 0, "GA": 0, "GU": 0, "HI": 0, "IA": 0, "ID": 0, "IL": 0, "IN": 0, "KS": 0, "KY": 0, "LA": 0, "MA": 0, "MD": 0, "ME": 0, "MH": 0, "MI": 0, "MN": 0, "MO": 0, "MP": 0, "MS": 0, "MT": 0, "NC": 0, "ND": 0, "NE": 0, "NH": 0, "NJ": 0, "NM": 0, "NV": 0, "NY": 0, "OH": 0, "OK": 0, "OR": 0, "PA": 0, "PR": 0, "PW": 0, "RI": 0, "SC": 0, "SD": 0, "TN": 0, "TX": 0, "UT": 0, "VA": 0, "VI": 0, "VT": 0, "WA": 0, "WI": 0, "WV": 0, "WY": 0 } cursor.execute('SELECT area_title, a_pct25 FROM jobdata_by_state') table = cursor.fetchall() for idx, row in enumerate(table): a_pct25_from_job_date_by_state = str(row[0]) abbr_state = abbreviate_state(a_pct25_from_job_date_by_state) current_a_pct25 = row[1] tot_ann_pct25_dict = a_pc25_dict[abbr_state] a_pc25_dict[abbr_state] = current_a_pct25 + tot_ann_pct25_dict compare_a_pct25_to_2016_repayment = { k: (a_pc25_dict[k] / repayment_2016_dict[k]) for k in a_pc25_dict } display_data = open("display_map_data2.csv", "w+") display_data.writelines("state,data\n") for key in compare_a_pct25_to_2016_repayment: if key in ("GU", "VI" ): # Omitting Guam & Virgin Islands due to skewing data continue else: tot_apc25_2016_repay_rounded = (round( compare_a_pct25_to_2016_repayment[key], 2)) display_data.writelines( f"{key}, {tot_apc25_2016_repay_rounded}\n") display_data.close() if self.analysis_type1_checkbox.isChecked(): type_of_analysis = "1" else: type_of_analysis = "2" if self.render_map_checkbox.isChecked(): DisplayMap.display_map(type_of_analysis) else: if type_of_analysis == "1": for key in compare_total_jobs_to_grads: total_jobs_rounded = (round( compare_total_jobs_to_grads[key], 2)) if total_jobs_rounded == 0: display_text = f"State: {key}\t Total jobs: {num_jobs_in_state[key]}\t\t Total college grads: " \ f"{num_grads_in_state[key]}\t\t {total_jobs_rounded} jobs available " \ f"per graduating student" else: display_text = f"State: {key}\t Total jobs: {num_jobs_in_state[key]}\t Total college grads: " \ f"{num_grads_in_state[key]}\t\t {total_jobs_rounded} jobs available " \ f"per graduating student" list_item = QListWidgetItem(display_text, listview=self.list_control) list_item.setForeground(Qt.darkRed) else: for key in compare_a_pct25_to_2016_repayment: apc25_to_2016_repay_rounded = (round( compare_a_pct25_to_2016_repayment[key], 2)) repay_2016_rounded = (round(repayment_2016_dict[key], 2)) if apc25_to_2016_repay_rounded == 0: display_text = f"State: {key}\t 3 year graduate cohort declining balance percent: " \ f"{repayment_2016_dict[key]}\t 25% salary: {a_pc25_dict[key]}\t\t Result: " \ f"{apc25_to_2016_repay_rounded}" else: display_text = f"State: {key}\t 3 year graduate cohort declining balance percent: " \ f"{repay_2016_rounded}\t 25% salary: {a_pc25_dict[key]}\t Result: " \ f"{apc25_to_2016_repay_rounded}" list_item = QListWidgetItem(display_text, listview=self.list_control) list_item.setForeground(Qt.darkBlue) close_db(conn) def sort_ascending(self): self.list_control.sortItems(Qt.AscendingOrder) def sort_descending(self): self.list_control.sortItems(Qt.DescendingOrder) def swap_color_coded_checkbox(self): status = self.color_coded_checkbox.isChecked() if status: self.render_map_checkbox.setChecked(False) else: self.render_map_checkbox.setChecked(True) def swap_render_map_checkbox(self): status = self.render_map_checkbox.isChecked() if status: self.color_coded_checkbox.setChecked(False) else: self.color_coded_checkbox.setChecked(True) def swap_num_grads_checkbox(self): status = self.analysis_type1_checkbox.isChecked() if status: self.analysis_type2_checkbox.setChecked(False) else: self.analysis_type2_checkbox.setChecked(True) def swap_3_yr_cohort_checkbox(self): status = self.analysis_type2_checkbox.isChecked() if status: self.analysis_type1_checkbox.setChecked(False) else: self.analysis_type1_checkbox.setChecked(True) def center(self): screen_center = QScreen.availableGeometry( QApplication.primaryScreen()).center() self_geometry = self.frameGeometry() self_geometry.moveCenter(screen_center) self.move(self_geometry.topLeft())
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(671, 496) self.help = QAction(MainWindow) self.help.setObjectName(u"help") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.log_text = QTextEdit(self.centralwidget) self.log_text.setObjectName(u"log_text") self.log_text.setGeometry(QRect(0, 190, 671, 291)) self.labe = QLabel(self.centralwidget) self.labe.setObjectName(u"labe") self.labe.setGeometry(QRect(30, 20, 54, 12)) self.ssid = QLineEdit(self.centralwidget) self.ssid.setObjectName(u"ssid") self.ssid.setGeometry(QRect(70, 20, 131, 20)) self.time = QLineEdit(self.centralwidget) self.time.setObjectName(u"time") self.time.setGeometry(QRect(540, 20, 91, 20)) self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(470, 20, 54, 12)) self.password = QLineEdit(self.centralwidget) self.password.setObjectName(u"password") self.password.setGeometry(QRect(310, 20, 131, 20)) self.label_3 = QLabel(self.centralwidget) self.label_3.setObjectName(u"label_3") self.label_3.setGeometry(QRect(240, 20, 54, 12)) self.connect = QPushButton(self.centralwidget) self.connect.setObjectName(u"connect") self.connect.setGeometry(QRect(140, 60, 75, 23)) self.disconnect = QPushButton(self.centralwidget) self.disconnect.setObjectName(u"disconnect") self.disconnect.setGeometry(QRect(250, 60, 75, 23)) self.labe_2 = QLabel(self.centralwidget) self.labe_2.setObjectName(u"labe_2") self.labe_2.setGeometry(QRect(30, 120, 91, 16)) self.cur_ssid = QTextEdit(self.centralwidget) self.cur_ssid.setObjectName(u"cur_ssid") self.cur_ssid.setGeometry(QRect(140, 110, 241, 31)) self.label = QLabel(self.centralwidget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(30, 160, 101, 16)) self.interface_name = QTextEdit(self.centralwidget) self.interface_name.setObjectName(u"interface_name") self.interface_name.setGeometry(QRect(140, 150, 241, 31)) self.label_4 = QLabel(self.centralwidget) self.label_4.setObjectName(u"label_4") self.label_4.setGeometry(QRect(450, 70, 54, 12)) self.frequency = QLineEdit(self.centralwidget) self.frequency.setObjectName(u"frequency") self.frequency.setGeometry(QRect(540, 70, 91, 20)) self.test = QPushButton(self.centralwidget) self.test.setObjectName(u"test") self.test.setGeometry(QRect(550, 110, 75, 23)) self.label_5 = QLabel(self.centralwidget) self.label_5.setObjectName(u"label_5") self.label_5.setGeometry(QRect(470, 70, 61, 16)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 671, 22)) self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName(u"menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.menubar.addAction(self.menuFile.menuAction()) self.menuFile.addAction(self.help) self.menuFile.addSeparator() self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"WIFI-Test", None)) self.help.setText( QCoreApplication.translate("MainWindow", u"\u5e2e\u52a9\u4fe1\u606f", None)) self.labe.setText( QCoreApplication.translate("MainWindow", u"SSID:", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"Time(s):", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"Password:"******"MainWindow", u"Connect", None)) self.disconnect.setText( QCoreApplication.translate("MainWindow", u"Disconnect", None)) self.labe_2.setText( QCoreApplication.translate("MainWindow", u"Connected SSID:", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Interface Name:", None)) self.label_4.setText("") self.test.setText( QCoreApplication.translate("MainWindow", u"Test", None)) self.label_5.setText( QCoreApplication.translate("MainWindow", u"Frequency:", None)) self.menuFile.setTitle( QCoreApplication.translate("MainWindow", u"help", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.setWindowModality(Qt.ApplicationModal) MainWindow.resize(1492, 1852) sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QSize(700, 700)) MainWindow.setMaximumSize(QSize(16777215, 16777215)) MainWindow.setBaseSize(QSize(600, 600)) font = QFont() font.setPointSize(12) font.setKerning(True) MainWindow.setFont(font) MainWindow.setAutoFillBackground(False) MainWindow.setStyleSheet(u"") MainWindow.setDocumentMode(False) MainWindow.setTabShape(QTabWidget.Rounded) MainWindow.setDockOptions(QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks) MainWindow.setUnifiedTitleAndToolBarOnMac(False) self.action_Quit = QAction(MainWindow) self.action_Quit.setObjectName(u"action_Quit") self.main_widget = QWidget(MainWindow) self.main_widget.setObjectName(u"main_widget") self.main_widget.setEnabled(True) self.main_widget.setMinimumSize(QSize(650, 650)) self.main_widget.setContextMenuPolicy(Qt.DefaultContextMenu) self.main_widget.setAutoFillBackground(False) self.main_widget.setStyleSheet(u"") self.main_layout = QGridLayout(self.main_widget) self.main_layout.setObjectName(u"main_layout") self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.log_button = QPushButton(self.main_widget) self.log_button.setObjectName(u"log_button") sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.log_button.sizePolicy().hasHeightForWidth()) self.log_button.setSizePolicy(sizePolicy1) self.log_button.setMinimumSize(QSize(24, 24)) font1 = QFont() font1.setPointSize(9) font1.setBold(True) font1.setKerning(True) self.log_button.setFont(font1) self.log_button.setCursor(QCursor(Qt.PointingHandCursor)) self.log_button.setCheckable(False) self.log_button.setFlat(True) self.horizontalLayout_2.addWidget(self.log_button) self.main_layout.addLayout(self.horizontalLayout_2, 5, 2, 1, 1) self.shuttle_widget = QWidget(self.main_widget) self.shuttle_widget.setObjectName(u"shuttle_widget") self.shuttle_widget.setMinimumSize(QSize(600, 600)) self.shuttle_widget.setMaximumSize(QSize(600, 600)) self.shuttle_widget.setAutoFillBackground(False) self.shuttle_widget.setStyleSheet(u"QWidget#shuttle_widget {background: url(images/ShuttleXpress_Black.png);\n" " background-repeat:no-repeat;}\n" " ") self.button_1 = QCheckBox(self.shuttle_widget) self.button_1.setObjectName(u"button_1") self.button_1.setGeometry(QRect(80, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_1.sizePolicy().hasHeightForWidth()) self.button_1.setSizePolicy(sizePolicy1) self.button_1.setMinimumSize(QSize(24, 24)) self.button_1.setFont(font) self.button_1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.usb_status = QPushButton(self.shuttle_widget) self.usb_status.setObjectName(u"usb_status") self.usb_status.setEnabled(False) self.usb_status.setGeometry(QRect(288, 10, 24, 24)) sizePolicy1.setHeightForWidth(self.usb_status.sizePolicy().hasHeightForWidth()) self.usb_status.setSizePolicy(sizePolicy1) self.usb_status.setMinimumSize(QSize(24, 24)) self.usb_status.setFont(font1) self.usb_status.setCursor(QCursor(Qt.ArrowCursor)) self.usb_status.setAutoFillBackground(False) self.usb_status.setText(u"") icon = QIcon() icon.addFile(u"images/usb_black_24.png", QSize(), QIcon.Disabled, QIcon.Off) icon.addFile(u"images/usb_white_24.png", QSize(), QIcon.Disabled, QIcon.On) self.usb_status.setIcon(icon) self.usb_status.setIconSize(QSize(24, 24)) self.usb_status.setCheckable(True) self.usb_status.setChecked(False) self.usb_status.setFlat(True) self.button_5 = QCheckBox(self.shuttle_widget) self.button_5.setObjectName(u"button_5") self.button_5.setGeometry(QRect(498, 266, 24, 24)) sizePolicy1.setHeightForWidth(self.button_5.sizePolicy().hasHeightForWidth()) self.button_5.setSizePolicy(sizePolicy1) self.button_5.setMinimumSize(QSize(24, 24)) self.button_5.setFont(font) self.button_5.setLayoutDirection(Qt.RightToLeft) self.button_5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos4 = QRadioButton(self.shuttle_widget) self.wheel_pos4.setObjectName(u"wheel_pos4") self.wheel_pos4.setGeometry(QRect(382, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos4.sizePolicy().hasHeightForWidth()) self.wheel_pos4.setSizePolicy(sizePolicy1) self.wheel_pos4.setMinimumSize(QSize(24, 24)) self.wheel_pos4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0 = QRadioButton(self.shuttle_widget) self.wheel_cent0.setObjectName(u"wheel_cent0") self.wheel_cent0.setGeometry(QRect(289, 130, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_cent0.sizePolicy().hasHeightForWidth()) self.wheel_cent0.setSizePolicy(sizePolicy1) self.wheel_cent0.setMinimumSize(QSize(24, 24)) self.wheel_cent0.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_cent0.setChecked(True) self.wheel_pos1 = QRadioButton(self.shuttle_widget) self.wheel_pos1.setObjectName(u"wheel_pos1") self.wheel_pos1.setGeometry(QRect(314, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos1.sizePolicy().hasHeightForWidth()) self.wheel_pos1.setSizePolicy(sizePolicy1) self.wheel_pos1.setMinimumSize(QSize(24, 24)) self.wheel_pos1.setStyleSheet(u"color: white;") self.wheel_pos2 = QRadioButton(self.shuttle_widget) self.wheel_pos2.setObjectName(u"wheel_pos2") self.wheel_pos2.setGeometry(QRect(338, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos2.sizePolicy().hasHeightForWidth()) self.wheel_pos2.setSizePolicy(sizePolicy1) self.wheel_pos2.setMinimumSize(QSize(24, 24)) self.wheel_pos2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.dial = QDial(self.shuttle_widget) self.dial.setObjectName(u"dial") self.dial.setGeometry(QRect(197, 178, 216, 216)) sizePolicy2 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.dial.sizePolicy().hasHeightForWidth()) self.dial.setSizePolicy(sizePolicy2) self.dial.setMinimumSize(QSize(24, 24)) self.dial.setAutoFillBackground(False) self.dial.setStyleSheet(u"background-color: black;") self.dial.setMinimum(0) self.dial.setMaximum(10) self.dial.setPageStep(1) self.dial.setValue(5) self.dial.setSliderPosition(5) self.dial.setInvertedAppearance(False) self.dial.setInvertedControls(False) self.dial.setWrapping(True) self.dial.setNotchTarget(3.700000000000000) self.dial.setNotchesVisible(False) self.wheel_neg6 = QRadioButton(self.shuttle_widget) self.wheel_neg6.setObjectName(u"wheel_neg6") self.wheel_neg6.setGeometry(QRect(162, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg6.sizePolicy().hasHeightForWidth()) self.wheel_neg6.setSizePolicy(sizePolicy1) self.wheel_neg6.setMinimumSize(QSize(24, 24)) self.wheel_neg6.setStyleSheet(u"color: white;") self.wheel_pos5 = QRadioButton(self.shuttle_widget) self.wheel_pos5.setObjectName(u"wheel_pos5") self.wheel_pos5.setGeometry(QRect(400, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos5.sizePolicy().hasHeightForWidth()) self.wheel_pos5.setSizePolicy(sizePolicy1) self.wheel_pos5.setMinimumSize(QSize(24, 24)) self.wheel_pos5.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_2 = QCheckBox(self.shuttle_widget) self.button_2.setObjectName(u"button_2") self.button_2.setGeometry(QRect(156, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_2.sizePolicy().hasHeightForWidth()) self.button_2.setSizePolicy(sizePolicy1) self.button_2.setMinimumSize(QSize(24, 24)) self.button_2.setFont(font) self.button_2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg5 = QRadioButton(self.shuttle_widget) self.wheel_neg5.setObjectName(u"wheel_neg5") self.wheel_neg5.setGeometry(QRect(178, 182, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg5.sizePolicy().hasHeightForWidth()) self.wheel_neg5.setSizePolicy(sizePolicy1) self.wheel_neg5.setMinimumSize(QSize(24, 24)) self.wheel_neg5.setStyleSheet(u"color: white;") self.wheel_pos6 = QRadioButton(self.shuttle_widget) self.wheel_pos6.setObjectName(u"wheel_pos6") self.wheel_pos6.setGeometry(QRect(416, 204, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos6.sizePolicy().hasHeightForWidth()) self.wheel_pos6.setSizePolicy(sizePolicy1) self.wheel_pos6.setMinimumSize(QSize(24, 24)) self.wheel_pos6.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg1 = QRadioButton(self.shuttle_widget) self.wheel_neg1.setObjectName(u"wheel_neg1") self.wheel_neg1.setGeometry(QRect(264, 133, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg1.sizePolicy().hasHeightForWidth()) self.wheel_neg1.setSizePolicy(sizePolicy1) self.wheel_neg1.setMinimumSize(QSize(24, 24)) self.wheel_neg1.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_4 = QCheckBox(self.shuttle_widget) self.button_4.setObjectName(u"button_4") self.button_4.setGeometry(QRect(430, 122, 24, 24)) sizePolicy1.setHeightForWidth(self.button_4.sizePolicy().hasHeightForWidth()) self.button_4.setSizePolicy(sizePolicy1) self.button_4.setMinimumSize(QSize(24, 24)) self.button_4.setFont(font) self.button_4.setLayoutDirection(Qt.RightToLeft) self.button_4.setAutoFillBackground(False) self.button_4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos7 = QRadioButton(self.shuttle_widget) self.wheel_pos7.setObjectName(u"wheel_pos7") self.wheel_pos7.setGeometry(QRect(427, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos7.sizePolicy().hasHeightForWidth()) self.wheel_pos7.setSizePolicy(sizePolicy1) self.wheel_pos7.setMinimumSize(QSize(24, 24)) self.wheel_pos7.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3 = QCheckBox(self.shuttle_widget) self.button_3.setObjectName(u"button_3") self.button_3.setGeometry(QRect(290, 72, 24, 24)) sizePolicy1.setHeightForWidth(self.button_3.sizePolicy().hasHeightForWidth()) self.button_3.setSizePolicy(sizePolicy1) self.button_3.setMinimumSize(QSize(24, 24)) self.button_3.setFont(font) self.button_3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.button_3.setTristate(False) self.wheel_neg2 = QRadioButton(self.shuttle_widget) self.wheel_neg2.setObjectName(u"wheel_neg2") self.wheel_neg2.setGeometry(QRect(240, 139, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg2.sizePolicy().hasHeightForWidth()) self.wheel_neg2.setSizePolicy(sizePolicy1) self.wheel_neg2.setMinimumSize(QSize(24, 24)) self.wheel_neg2.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_pos3 = QRadioButton(self.shuttle_widget) self.wheel_pos3.setObjectName(u"wheel_pos3") self.wheel_pos3.setGeometry(QRect(361, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_pos3.sizePolicy().hasHeightForWidth()) self.wheel_pos3.setSizePolicy(sizePolicy1) self.wheel_pos3.setMinimumSize(QSize(24, 24)) self.wheel_pos3.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg3 = QRadioButton(self.shuttle_widget) self.wheel_neg3.setObjectName(u"wheel_neg3") self.wheel_neg3.setGeometry(QRect(217, 149, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg3.sizePolicy().hasHeightForWidth()) self.wheel_neg3.setSizePolicy(sizePolicy1) self.wheel_neg3.setMinimumSize(QSize(24, 24)) self.wheel_neg3.setStyleSheet(u"color: white;") self.wheel_neg4 = QRadioButton(self.shuttle_widget) self.wheel_neg4.setObjectName(u"wheel_neg4") self.wheel_neg4.setGeometry(QRect(196, 164, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg4.sizePolicy().hasHeightForWidth()) self.wheel_neg4.setSizePolicy(sizePolicy1) self.wheel_neg4.setMinimumSize(QSize(24, 24)) self.wheel_neg4.setStyleSheet(u"background: #000000ff;\n" " color: white;\n" " ") self.wheel_neg7 = QRadioButton(self.shuttle_widget) self.wheel_neg7.setObjectName(u"wheel_neg7") self.wheel_neg7.setGeometry(QRect(151, 229, 24, 24)) sizePolicy1.setHeightForWidth(self.wheel_neg7.sizePolicy().hasHeightForWidth()) self.wheel_neg7.setSizePolicy(sizePolicy1) self.wheel_neg7.setMinimumSize(QSize(24, 24)) self.wheel_neg7.setStyleSheet(u"color: white;") self.dial.raise_() self.button_1.raise_() self.usb_status.raise_() self.button_5.raise_() self.wheel_pos4.raise_() self.wheel_cent0.raise_() self.wheel_pos1.raise_() self.wheel_pos2.raise_() self.wheel_neg6.raise_() self.wheel_pos5.raise_() self.button_2.raise_() self.wheel_neg5.raise_() self.wheel_pos6.raise_() self.wheel_neg1.raise_() self.button_4.raise_() self.wheel_pos7.raise_() self.button_3.raise_() self.wheel_neg2.raise_() self.wheel_pos3.raise_() self.wheel_neg3.raise_() self.wheel_neg4.raise_() self.wheel_neg7.raise_() self.main_layout.addWidget(self.shuttle_widget, 3, 2, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.about_button = QPushButton(self.main_widget) self.about_button.setObjectName(u"about_button") sizePolicy1.setHeightForWidth(self.about_button.sizePolicy().hasHeightForWidth()) self.about_button.setSizePolicy(sizePolicy1) self.about_button.setMinimumSize(QSize(24, 24)) self.about_button.setFont(font1) self.about_button.setCursor(QCursor(Qt.WhatsThisCursor)) self.about_button.setCheckable(False) self.about_button.setFlat(True) self.horizontalLayout.addWidget(self.about_button) self.main_layout.addLayout(self.horizontalLayout, 1, 2, 1, 1) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.plug_button = QPushButton(self.main_widget) self.plug_button.setObjectName(u"plug_button") sizePolicy1.setHeightForWidth(self.plug_button.sizePolicy().hasHeightForWidth()) self.plug_button.setSizePolicy(sizePolicy1) self.plug_button.setMinimumSize(QSize(24, 24)) self.plug_button.setFont(font1) self.plug_button.setCursor(QCursor(Qt.PointingHandCursor)) self.plug_button.setCheckable(False) self.plug_button.setFlat(True) self.horizontalLayout_3.addWidget(self.plug_button) self.main_layout.addLayout(self.horizontalLayout_3, 3, 1, 1, 1) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.conf_button = QPushButton(self.main_widget) self.conf_button.setObjectName(u"conf_button") sizePolicy1.setHeightForWidth(self.conf_button.sizePolicy().hasHeightForWidth()) self.conf_button.setSizePolicy(sizePolicy1) self.conf_button.setMinimumSize(QSize(24, 24)) self.conf_button.setFont(font1) self.conf_button.setCursor(QCursor(Qt.PointingHandCursor)) self.conf_button.setCheckable(False) self.conf_button.setFlat(True) self.verticalLayout.addWidget(self.conf_button) self.main_layout.addLayout(self.verticalLayout, 3, 4, 1, 1) MainWindow.setCentralWidget(self.main_widget) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") self.statusbar.setMinimumSize(QSize(600, 0)) MainWindow.setStatusBar(self.statusbar) self.about_widget = QDockWidget(MainWindow) self.about_widget.setObjectName(u"about_widget") self.about_widget.setEnabled(True) sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) sizePolicy3.setHeightForWidth(self.about_widget.sizePolicy().hasHeightForWidth()) self.about_widget.setSizePolicy(sizePolicy3) self.about_widget.setMinimumSize(QSize(600, 600)) self.about_widget.setVisible(True) self.about_widget.setFloating(False) self.about_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetMovable) self.about_widget.setAllowedAreas(Qt.TopDockWidgetArea) self.about_layout = QWidget() self.about_layout.setObjectName(u"about_layout") sizePolicy3.setHeightForWidth(self.about_layout.sizePolicy().hasHeightForWidth()) self.about_layout.setSizePolicy(sizePolicy3) self.about_layout.setAutoFillBackground(False) self.gridLayout_3 = QGridLayout(self.about_layout) self.gridLayout_3.setObjectName(u"gridLayout_3") self.about_text = QTextEdit(self.about_layout) self.about_text.setObjectName(u"about_text") self.about_text.setFocusPolicy(Qt.WheelFocus) self.about_text.setAcceptDrops(False) self.about_text.setStyleSheet(u"color: white;") self.about_text.setFrameShape(QFrame.StyledPanel) self.about_text.setFrameShadow(QFrame.Sunken) self.about_text.setUndoRedoEnabled(False) self.about_text.setReadOnly(True) self.about_text.setAcceptRichText(True) self.gridLayout_3.addWidget(self.about_text, 0, 0, 1, 1) self.about_widget.setWidget(self.about_layout) MainWindow.addDockWidget(Qt.TopDockWidgetArea, self.about_widget) self.log_widget = QDockWidget(MainWindow) self.log_widget.setObjectName(u"log_widget") self.log_widget.setEnabled(True) self.log_widget.setMinimumSize(QSize(550, 158)) self.log_widget.setFont(font) self.log_widget.setVisible(True) self.log_widget.setFloating(False) self.log_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.log_widget.setAllowedAreas(Qt.BottomDockWidgetArea) self.log_layout = QWidget() self.log_layout.setObjectName(u"log_layout") sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth(self.log_layout.sizePolicy().hasHeightForWidth()) self.log_layout.setSizePolicy(sizePolicy4) self.gridLayout_2 = QGridLayout(self.log_layout) self.gridLayout_2.setObjectName(u"gridLayout_2") self.log_content_layout = QVBoxLayout() self.log_content_layout.setObjectName(u"log_content_layout") self.log_content_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_text = QPlainTextEdit(self.log_layout) self.log_text.setObjectName(u"log_text") sizePolicy4.setHeightForWidth(self.log_text.sizePolicy().hasHeightForWidth()) self.log_text.setSizePolicy(sizePolicy4) self.log_text.setMinimumSize(QSize(0, 0)) self.log_text.setAcceptDrops(False) self.log_text.setFrameShape(QFrame.StyledPanel) self.log_text.setFrameShadow(QFrame.Sunken) self.log_text.setUndoRedoEnabled(False) self.log_text.setReadOnly(True) self.log_content_layout.addWidget(self.log_text) self.buttons_layout = QHBoxLayout() self.buttons_layout.setObjectName(u"buttons_layout") self.buttons_layout.setSizeConstraint(QLayout.SetDefaultConstraint) self.log_clear_button = QToolButton(self.log_layout) self.log_clear_button.setObjectName(u"log_clear_button") icon1 = QIcon() icon1.addFile(u"images/delete-sweep_24.png", QSize(), QIcon.Normal, QIcon.Off) self.log_clear_button.setIcon(icon1) self.log_clear_button.setIconSize(QSize(24, 24)) self.buttons_layout.addWidget(self.log_clear_button) self.log_content_layout.addLayout(self.buttons_layout) self.gridLayout_2.addLayout(self.log_content_layout, 0, 0, 1, 1) self.log_widget.setWidget(self.log_layout) MainWindow.addDockWidget(Qt.BottomDockWidgetArea, self.log_widget) self.config_widget = QDockWidget(MainWindow) self.config_widget.setObjectName(u"config_widget") self.config_widget.setEnabled(True) self.config_widget.setMinimumSize(QSize(250, 600)) self.config_widget.setFloating(False) self.config_widget.setFeatures(QDockWidget.DockWidgetClosable|QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetMovable) self.config_widget.setAllowedAreas(Qt.RightDockWidgetArea) self.config_layout = QWidget() self.config_layout.setObjectName(u"config_layout") self.gridLayout = QGridLayout(self.config_layout) self.gridLayout.setObjectName(u"gridLayout") self.config_content_layout = QFormLayout() self.config_content_layout.setObjectName(u"config_content_layout") self.gridLayout.addLayout(self.config_content_layout, 0, 0, 1, 1) self.config_widget.setWidget(self.config_layout) MainWindow.addDockWidget(Qt.RightDockWidgetArea, self.config_widget) self.plugins_widget = QDockWidget(MainWindow) self.plugins_widget.setObjectName(u"plugins_widget") self.plugins_widget.setMinimumSize(QSize(250, 600)) self.plugins_widget.setAllowedAreas(Qt.LeftDockWidgetArea) self.dockWidgetContents = QWidget() self.dockWidgetContents.setObjectName(u"dockWidgetContents") self.plugins_widget.setWidget(self.dockWidgetContents) MainWindow.addDockWidget(Qt.LeftDockWidgetArea, self.plugins_widget) self.about_widget.raise_() self.log_widget.raise_() self.retranslateUi(MainWindow) self.usb_status.setDefault(False) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Contour ShuttleXpress", None)) self.action_Quit.setText(QCoreApplication.translate("MainWindow", u"&Quit", None)) #if QT_CONFIG(tooltip) self.log_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.log_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Log", None)) #endif // QT_CONFIG(statustip) self.log_button.setText(QCoreApplication.translate("MainWindow", u"//", None)) #if QT_CONFIG(statustip) self.button_1.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 1", None)) #endif // QT_CONFIG(statustip) self.button_1.setText("") #if QT_CONFIG(tooltip) self.usb_status.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.usb_status.setStatusTip(QCoreApplication.translate("MainWindow", u"USB connection status", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(whatsthis) self.usb_status.setWhatsThis(QCoreApplication.translate("MainWindow", u"USB Status", None)) #endif // QT_CONFIG(whatsthis) #if QT_CONFIG(statustip) self.button_5.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 5", None)) #endif // QT_CONFIG(statustip) self.button_5.setText("") #if QT_CONFIG(statustip) self.wheel_pos4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 4", None)) #endif // QT_CONFIG(statustip) self.wheel_pos4.setText("") #if QT_CONFIG(statustip) self.wheel_cent0.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: center", None)) #endif // QT_CONFIG(statustip) self.wheel_cent0.setText("") #if QT_CONFIG(statustip) self.wheel_pos1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 1", None)) #endif // QT_CONFIG(statustip) self.wheel_pos1.setText("") #if QT_CONFIG(statustip) self.wheel_pos2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 2", None)) #endif // QT_CONFIG(statustip) self.wheel_pos2.setText("") #if QT_CONFIG(statustip) self.dial.setStatusTip(QCoreApplication.translate("MainWindow", u"Dial", None)) #endif // QT_CONFIG(statustip) #if QT_CONFIG(statustip) self.wheel_neg6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 6", None)) #endif // QT_CONFIG(statustip) self.wheel_neg6.setText("") #if QT_CONFIG(statustip) self.wheel_pos5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 5", None)) #endif // QT_CONFIG(statustip) self.wheel_pos5.setText("") #if QT_CONFIG(statustip) self.button_2.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 2", None)) #endif // QT_CONFIG(statustip) self.button_2.setText("") #if QT_CONFIG(statustip) self.wheel_neg5.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 5", None)) #endif // QT_CONFIG(statustip) self.wheel_neg5.setText("") #if QT_CONFIG(statustip) self.wheel_pos6.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 6", None)) #endif // QT_CONFIG(statustip) self.wheel_pos6.setText("") #if QT_CONFIG(statustip) self.wheel_neg1.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 1", None)) #endif // QT_CONFIG(statustip) self.wheel_neg1.setText("") #if QT_CONFIG(statustip) self.button_4.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 4", None)) #endif // QT_CONFIG(statustip) self.button_4.setText("") #if QT_CONFIG(statustip) self.wheel_pos7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 7", None)) #endif // QT_CONFIG(statustip) self.wheel_pos7.setText("") #if QT_CONFIG(statustip) self.button_3.setStatusTip(QCoreApplication.translate("MainWindow", u"Button 3", None)) #endif // QT_CONFIG(statustip) self.button_3.setText("") #if QT_CONFIG(statustip) self.wheel_neg2.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 2", None)) #endif // QT_CONFIG(statustip) self.wheel_neg2.setText("") #if QT_CONFIG(statustip) self.wheel_pos3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: right 3", None)) #endif // QT_CONFIG(statustip) self.wheel_pos3.setText("") #if QT_CONFIG(statustip) self.wheel_neg3.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 3", None)) #endif // QT_CONFIG(statustip) self.wheel_neg3.setText("") #if QT_CONFIG(statustip) self.wheel_neg4.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 4", None)) #endif // QT_CONFIG(statustip) self.wheel_neg4.setText(QCoreApplication.translate("MainWindow", u"-", None)) #if QT_CONFIG(statustip) self.wheel_neg7.setStatusTip(QCoreApplication.translate("MainWindow", u"Wheel position: left 7", None)) #endif // QT_CONFIG(statustip) self.wheel_neg7.setText("") #if QT_CONFIG(tooltip) self.about_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.about_button.setStatusTip(QCoreApplication.translate("MainWindow", u"About", None)) #endif // QT_CONFIG(statustip) self.about_button.setText(QCoreApplication.translate("MainWindow", u"?", None)) #if QT_CONFIG(tooltip) self.plug_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.plug_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.plug_button.setText(QCoreApplication.translate("MainWindow", u"#", None)) #if QT_CONFIG(tooltip) self.conf_button.setToolTip("") #endif // QT_CONFIG(tooltip) #if QT_CONFIG(statustip) self.conf_button.setStatusTip(QCoreApplication.translate("MainWindow", u"Configuration", None)) #endif // QT_CONFIG(statustip) self.conf_button.setText(QCoreApplication.translate("MainWindow", u"=", None)) self.about_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"About", None)) self.about_text.setDocumentTitle("") self.log_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Log", None)) self.log_clear_button.setText(QCoreApplication.translate("MainWindow", u"Clear", None)) self.config_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Configuration", None)) self.plugins_widget.setWindowTitle(QCoreApplication.translate("MainWindow", u"Plugins", None))
class Ui_MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowIcon(QIcon(resource_path('icon.ico'))) self.setFixedSize(540, 470) def setupUi(self): self.centralwidget = QWidget(self) with open(resource_path('style.css'), 'r') as file: self.centralwidget.setStyleSheet(file.read()) self.appswidget = QWidget(self.centralwidget) self.appswidget.setGeometry(50, 0, 490, 470) self.appswidget.setProperty('class', 'appswidget') self.sidebar = QFrame(self.centralwidget) self.sidebar.setFrameShape(QFrame.StyledPanel) self.sidebar.setGeometry(0, 0, 50, 470) self.sidebar.setProperty('class', 'sidebar') self.refresh_btn = QPushButton(self.sidebar) self.refresh_btn.setGeometry(QRect(0, 0, 51, 51)) self.refresh_btn.setProperty('class', 'sidebar_btns') self.refresh_btn.setIcon(QIcon(':/icon/refresh_icon.png')) self.refresh_btn.setIconSize(QSize(24, 24)) self.refresh_bind = QShortcut(QKeySequence('Ctrl+R'), self) self.store_btn = QPushButton(self.sidebar) self.store_btn.setGeometry(QRect(0, 51, 51, 51)) self.store_btn.setProperty('class', 'sidebar_btns') self.store_btn.setIcon(QIcon(':/icon/store_icon.png')) self.store_btn.setIconSize(QSize(24, 24)) self.store_bind = QShortcut(QKeySequence('Ctrl+S'), self) self.homepage_btn = QPushButton(self.sidebar) self.homepage_btn.setGeometry(QRect(0, 102, 51, 51)) self.homepage_btn.setProperty('class', 'sidebar_btns') self.homepage_btn.setIcon(QIcon(':/icon/github_icon.png')) self.homepage_btn.setIconSize(QSize(24, 24)) self.homepage_bind = QShortcut(QKeySequence('Ctrl+G'), self) self.about_btn = QPushButton(self.sidebar) self.about_btn.setGeometry(QRect(0, 153, 51, 51)) self.about_btn.setProperty('class', 'sidebar_btns') self.about_btn.setIcon(QIcon(':/icon/about_icon.png')) self.about_btn.setIconSize(QSize(24, 24)) self.about_bind = QShortcut(QKeySequence('Ctrl+A'), self) self.quit_btn = QPushButton(self.sidebar) self.quit_btn.setGeometry(QRect(0, 420, 51, 51)) self.quit_btn.setProperty('class', 'sidebar_btns_quit') self.quit_btn.setIcon(QIcon(':/icon/quit_icon.png')) self.quit_btn.setIconSize(QSize(24, 24)) self.quit_bind = QShortcut(QKeySequence('Ctrl+Q'), self) self.font = QFont() self.font.setPointSize(8) self.font.setStyleStrategy(QFont.PreferAntialias) self.label_refresh = QLabel(self.appswidget) self.label_refresh.setFont(self.font) self.label_refresh.setGeometry(QRect(20, 10, 441, 15)) self.label_info = QLabel(self.appswidget) self.label_info.setFont(self.font) self.label_info.setGeometry(QRect(20, 10, 441, 30)) self.progressbar = QProgressBar(self.appswidget) self.progressbar.setGeometry(QRect(20, 30, 441, 20)) self.layout_widget_checkboxes = QWidget(self.appswidget) self.layout_widget_checkboxes.setGeometry(QRect(20, 55, 155, 311)) self.layout_checkboxes = QVBoxLayout(self.layout_widget_checkboxes) self.layout_checkboxes.setContentsMargins(0, 0, 0, 0) self.layout_widget_checkboxes_2 = QWidget(self.appswidget) self.layout_widget_checkboxes_2.setGeometry(QRect(175, 55, 155, 311)) self.layout_checkboxes_2 = QVBoxLayout(self.layout_widget_checkboxes_2) self.layout_checkboxes_2.setContentsMargins(0, 0, 0, 0) self.layout_widget_checkboxes_3 = QWidget(self.appswidget) self.layout_widget_checkboxes_3.setGeometry(QRect(330, 55, 155, 311)) self.layout_checkboxes_3 = QVBoxLayout(self.layout_widget_checkboxes_3) self.layout_checkboxes_3.setContentsMargins(0, 0, 0, 0) self.layout_widget_labels = QWidget(self.appswidget) self.layout_widget_labels.setGeometry(QRect(20, 390, 350, 16)) self.layout_labels = QHBoxLayout(self.layout_widget_labels) self.layout_labels.setContentsMargins(0, 0, 0, 0) self.label_space = QLabel(self.appswidget) self.label_space.setFont(self.font) self.layout_labels.addWidget(self.label_space) self.label_size = QLabel(self.appswidget) self.label_size.setFont(self.font) self.layout_labels.addWidget(self.label_size) self.layout_widget_buttons = QWidget(self.appswidget) self.layout_widget_buttons.setGeometry(QRect(20, 420, 454, 31)) self.layout_buttons = QHBoxLayout(self.layout_widget_buttons) self.layout_buttons.setContentsMargins(0, 0, 0, 0) self.button_select_all = QPushButton(self.layout_widget_buttons) self.button_select_all.setIcon(QIcon(':/icon/check_icon.png')) self.button_select_all.setIconSize(QSize(18, 18)) self.button_select_all.setLayoutDirection(Qt.RightToLeft) self.layout_buttons.addWidget(self.button_select_all) self.button_select_all.setMinimumSize(100, 30) self.button_select_all.setProperty('class', 'Aqua') self.button_deselect_all = QPushButton(self.layout_widget_buttons) self.button_deselect_all.setIcon(QIcon(':/icon/cancel_icon.png')) self.button_deselect_all.setIconSize(QSize(18, 18)) self.button_deselect_all.setLayoutDirection(Qt.RightToLeft) self.layout_buttons.addWidget(self.button_deselect_all) self.button_deselect_all.setMinimumSize(100, 30) self.button_deselect_all.setProperty('class', 'Aqua') self.layout_buttons.addStretch() self.button_uninstall = QPushButton(self.layout_widget_buttons) self.button_uninstall.setIcon(QIcon(':/icon/trash_icon.png')) self.button_uninstall.setIconSize(QSize(18, 18)) self.button_uninstall.setLayoutDirection(Qt.RightToLeft) self.layout_buttons.addWidget(self.button_uninstall) self.button_uninstall.setMinimumSize(100, 30) self.button_uninstall.setProperty('class', 'Grapefruit') self.setCentralWidget(self.centralwidget) self.retranslateUi() QMetaObject.connectSlotsByName(self) def retranslateUi(self): QToolTip.setFont(self.font) self.setWindowTitle(QCoreApplication.translate("Title", "PyDebloatX")) self.label_info.setText(QCoreApplication.translate("Label", "")) self.app_name_list = list( ( # Convert tuple to list, because lupdate ignores initial lists QCoreApplication.translate("AppName", "3D Builder"), QCoreApplication.translate("AppName", "3D Viewer"), QCoreApplication.translate("AppName", "Alarms and Clock"), QCoreApplication.translate("AppName", "Calculator"), QCoreApplication.translate("AppName", "Calendar and Mail"), QCoreApplication.translate("AppName", "Camera"), QCoreApplication.translate("AppName", "Feedback Hub"), QCoreApplication.translate("AppName", "Get Help"), QCoreApplication.translate("AppName", "Groove Music"), QCoreApplication.translate("AppName", "Maps"), QCoreApplication.translate("AppName", "Messaging"), QCoreApplication.translate("AppName", "Mixed Reality Portal"), QCoreApplication.translate("AppName", "Mobile Plans"), QCoreApplication.translate("AppName", "Money"), QCoreApplication.translate("AppName", "Movies && TV"), QCoreApplication.translate("AppName", "News"), QCoreApplication.translate("AppName", "Office"), QCoreApplication.translate("AppName", "OneNote"), QCoreApplication.translate("AppName", "Paint 3D"), QCoreApplication.translate("AppName", "People"), QCoreApplication.translate("AppName", "Photos"), QCoreApplication.translate("AppName", "Print 3D"), QCoreApplication.translate("AppName", "Skype"), QCoreApplication.translate("AppName", "Snip && Sketch"), QCoreApplication.translate("AppName", "Solitaire"), QCoreApplication.translate("AppName", "Sports"), QCoreApplication.translate("AppName", "Spotify"), QCoreApplication.translate("AppName", "Sticky Notes"), QCoreApplication.translate("AppName", "Tips"), QCoreApplication.translate("AppName", "Translator"), QCoreApplication.translate("AppName", "Voice Recorder"), QCoreApplication.translate("AppName", "Weather"), QCoreApplication.translate("AppName", "Xbox"), QCoreApplication.translate("AppName", "Xbox Game Bar"), QCoreApplication.translate("AppName", "Your Phone"))) self.tooltip_list = list(( QCoreApplication.translate( "ToolTip", "View, create, and personalize 3D objects."), QCoreApplication.translate( "ToolTip", "View 3D models and animations in real-time."), QCoreApplication.translate( "ToolTip", "A combination of alarm clock, world clock, timer, and stopwatch." ), QCoreApplication.translate( "ToolTip", "A calculator that includes standard, scientific, and programmer modes, as well as a unit converter." ), QCoreApplication.translate( "ToolTip", "Stay up to date with email and schedule managing."), QCoreApplication.translate( "ToolTip", "Point and shoot to take pictures on Windows 10."), QCoreApplication.translate( "ToolTip", "Provide feedback about Windows and apps by sharing suggestions or problems." ), QCoreApplication.translate( "ToolTip", "Provide a way to ask a question and get recommended solutions or contact assisted support." ), QCoreApplication.translate( "ToolTip", "Listen to music on Windows, iOS, and Android devices."), QCoreApplication.translate( "ToolTip", "Search for places to get directions, business info, and reviews." ), QCoreApplication.translate( "ToolTip", "Quick, reliable SMS, MMS and RCS messaging from your phone."), QCoreApplication.translate( "ToolTip", "Discover Windows Mixed Reality and dive into more than 3,000 games and VR experiences from Steam VR and Microsoft Store." ), QCoreApplication.translate( "ToolTip", "Sign up for a data plan and connect with mobile operators in your area. You will need a supported SIM card." ), QCoreApplication.translate( "ToolTip", "Finance calculators, currency exchange rates and commodity prices from around the world." ), QCoreApplication.translate( "ToolTip", "All your movies and TV shows, all in one place, on all your devices." ), QCoreApplication.translate( "ToolTip", "Deliver breaking news and trusted, in-depth reporting from the world\'s best journalists." ), QCoreApplication.translate( "ToolTip", "Find all your Office apps and files in one place."), QCoreApplication.translate( "ToolTip", "Digital notebook for capturing and organizing everything across your devices." ), QCoreApplication.translate( "ToolTip", "Make 2D masterpieces or 3D models that you can play with from all angles." ), QCoreApplication.translate( "ToolTip", "Connect with all your friends, family, colleagues, and acquaintances in one place." ), QCoreApplication.translate( "ToolTip", "View and edit your photos and videos, make movies, and create albums." ), QCoreApplication.translate( "ToolTip", "Quickly and easily prepare objects for 3D printing on your PC." ), QCoreApplication.translate( "ToolTip", "Instant message, voice or video call application."), QCoreApplication.translate( "ToolTip", "Quickly annotate screenshots, photos and other images and save, paste or share with other apps." ), QCoreApplication.translate( "ToolTip", "Solitaire is one of the most played computer card games of all time." ), QCoreApplication.translate( "ToolTip", "Live scores and in-depth game experiences for more than 150 leagues." ), QCoreApplication.translate( "ToolTip", "Play your favorite songs and albums free on Windows 10 with Spotify." ), QCoreApplication.translate( "ToolTip", "Create notes, type, ink or add a picture, add text formatting, or stick them to the desktop." ), QCoreApplication.translate( "ToolTip", "Provide users with information and tips about operating system features." ), QCoreApplication.translate( "ToolTip", "Translate text and speech, have translated conversations, and even download AI-powered language packs to use offline." ), QCoreApplication.translate( "ToolTip", "Record sounds, lectures, interviews, and other events."), QCoreApplication.translate( "ToolTip", "Latest weather conditions, accurate 10-day and hourly forecasts." ), QCoreApplication.translate( "ToolTip", "Browse the catalogue, view recommendations, and discover PC games with Xbox Game Pass." ), QCoreApplication.translate( "ToolTip", "Instant access to widgets for screen capture and sharing, and chatting with Xbox friends." ), QCoreApplication.translate( "ToolTip", "Link your Android phone and PC to view and reply to text messages, access mobile apps, and receive notifications." ))) self.app_data_list = [{ "name": "*Microsoft.3DBuilder*", "link": "/?PFN=Microsoft.3DBuilder_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Microsoft3DViewer*", "link": "/?PFN=Microsoft.Microsoft3DViewer_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsAlarms*", "link": "/?PFN=Microsoft.WindowsAlarms_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsCalculator*", "link": "/?PFN=Microsoft.WindowsCalculator_8wekyb3d8bbwe", "size": 0 }, { "name": "*microsoft.windowscommunicationsapps*", "link": "/?PFN=Microsoft.windowscommunicationsapps_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsCamera*", "link": "/?PFN=Microsoft.WindowsCamera_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsFeedbackHub*", "link": "/?PFN=Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.GetHelp*", "link": "/?PFN=Microsoft.Gethelp_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.ZuneMusic*", "link": "/?PFN=Microsoft.ZuneMusic_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsMaps*", "link": "/?PFN=Microsoft.WindowsMaps_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Messaging*", "link": "/?PFN=Microsoft.Messaging_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.MixedReality.Portal*", "link": "/?PFN=Microsoft.MixedReality.Portal_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.OneConnect*", "link": "/?PFN=Microsoft.OneConnect_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.BingFinance*", "link": "/?PFN=Microsoft.BingFinance_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.ZuneVideo*", "link": "/?PFN=Microsoft.ZuneVideo_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.BingNews*", "link": "/?PFN=Microsoft.BingNews_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.MicrosoftOfficeHub*", "link": "/?PFN=Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Office.OneNote*", "link": "/?PFN=Microsoft.Office.OneNote_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.MSPaint*", "link": "/?PFN=Microsoft.MSPaint_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.People*", "link": "/?PFN=Microsoft.People_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Windows.Photos*", "link": "/?PFN=Microsoft.Windows.Photos_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Print3D*", "link": "/?PFN=Microsoft.Print3D_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.SkypeApp*", "link": "/?PFN=Microsoft.SkypeApp_kzf8qxf38zg5c", "size": 0 }, { "name": "*Microsoft.ScreenSketch*", "link": "/?PFN=Microsoft.ScreenSketch_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.MicrosoftSolitaireCollection*", "link": "/?PFN=Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.BingSports*", "link": "/?PFN=Microsoft.BingSports_8wekyb3d8bbwe", "size": 0 }, { "name": "*SpotifyAB.SpotifyMusic*", "link": "/?PFN=SpotifyAB.SpotifyMusic_zpdnekdrzrea0", "size": 0 }, { "name": "*Microsoft.MicrosoftStickyNotes*", "link": "/?PFN=Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.Getstarted*", "link": "/?PFN=Microsoft.Getstarted_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.BingTranslator*", "link": "/?PFN=Microsoft.BingTranslator_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.WindowsSoundRecorder*", "link": "/?PFN=Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.BingWeather*", "link": "/?PFN=Microsoft.BingWeather_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.GamingApp*", "link": "/?PFN=Microsoft.GamingApp_8wekyb3d8bbwe", "size": 0 }, { "name": "*Xbox*", "link": "/?PFN=Microsoft.XboxGameOverlay_8wekyb3d8bbwe", "size": 0 }, { "name": "*Microsoft.YourPhone*", "link": "/?PFN=Microsoft.YourPhone_8wekyb3d8bbwe", "size": 0 }] if version.parse(platform.version()) >= version.parse("10.0.19041"): insort(self.app_name_list, QCoreApplication.translate("AppName", "Cortana")) cortana_index = self.app_name_list.index("Cortana") self.tooltip_list.insert( cortana_index, QCoreApplication.translate("ToolTip", "Personal intelligence assistant.")) self.app_data_list.insert( cortana_index, { "name": "*Microsoft.549981C3F5F10*", "link": "/?PFN=Microsoft.549981C3F5F10_8wekyb3d8bbwe", "size": 0 }) self.checkbox_list = [] for i, _ in enumerate(self.app_name_list): self.checkbox_list.append(QCheckBox()) if i % 3 == 2: self.layout_checkboxes_3.addWidget(self.checkbox_list[i]) elif i % 3 == 1: self.layout_checkboxes_2.addWidget(self.checkbox_list[i]) else: self.layout_checkboxes.addWidget(self.checkbox_list[i]) self.apps_dict = {} for i, checkbox in enumerate(self.checkbox_list): checkbox.setText(self.app_name_list[i]) checkbox.setToolTip(self.tooltip_list[i]) checkbox.setFont(self.font) self.apps_dict[checkbox] = self.app_data_list[i] self.label_space.setText( QCoreApplication.translate("Label", "Total amount of disk space:")) self.label_size.setText(QCoreApplication.translate("Label", "0 MB")) self.button_select_all.setText( QCoreApplication.translate("Button", "Select All")) self.button_deselect_all.setText( QCoreApplication.translate("Button", "Deselect All")) self.button_uninstall.setText( QCoreApplication.translate("Button", "Uninstall"))
class SecondWidget1(QtWidgets.QWidget): def __init__(self, parent=None): super().__init__(parent=parent) layout = QtWidgets.QVBoxLayout(self) label1 = QLabel('입력', self) label1.setAlignment(Qt.AlignVCenter) label1.move(200, 30) label2 = QLabel('결과', self) label2.setAlignment(Qt.AlignVCenter) label2.move(710, 30) self.text_box1 = QTextEdit(self) self.text_box1.resize(350, 350) self.text_box1.move(50, 60) self.text_box2 = QTextBrowser(self) self.text_box2.append('') self.text_box2.setGeometry(550, 60, 350, 350) self.ok_base64 = QPushButton("OK", self) self.ok_base64.setGeometry(50, 420, 850, 45) self.ok_base64.clicked.connect(self.base64_conversion) self.back = QPushButton(self) self.back.setStyleSheet( ''' QPushButton{image:url(./img/back_img.png); border:0px;} QPushButton:hover{image:url(./img/back_img_ev_1.png); border:0px;} ''') self.back.setGeometry(0, 0, 50, 50) self.back.clicked.connect(self.change_stack1) def base64_conversion(self): ''' QTextEdit 사용 경우 .toPlainText() 사용 바람 https://doc.qt.io/qt-5/qplaintextedit.html#plainText-prop 참조 ''' # print(self.text_box1.toPlainText()) # Base64 변환 과정 inpututf = self.text_box1.toPlainText().encode('utf-8') # ascii 사용시 오류발생 utf-8으로 사용하세요 finalvalue = base64.b64encode(inpututf) print(finalvalue) ''' 내용 수정또는 추가시 내용 초기화 https://study-code.gitbook.io/python-basic/qtpy/pyqt-widget/application-make/widget-2#undefined-1 참조 ''' self.text_box2.clear() self.text_box2.repaint() ''' "b"와 따옴표없이 출력 .decode("utf-8") https://stackoverflow.com/a/45151048 참조 ''' self.text_box2.append(str(finalvalue.decode("utf-8"))) def change_stack(self): self.parent().stack.setCurrentIndex(0) def change_stack1(self): self.parent().stack.setCurrentIndex(1)
def set_up_ls_tabs(self): for obj_no in range(self.optimiser.n_objs): if self.optimiser.obj_func.obj_names is not None: obj_name = self.optimiser.obj_func.obj_names[obj_no] else: obj_name = f"Obj {obj_no}" if obj_no == 0: self.ls_tabs.append(self.ui.ls_tab_1) self.ui.length_scale_tabs.setTabText(obj_no, obj_name) else: self.ls_tabs.append(QWidget()) self.ui.length_scale_tabs.addTab(self.ls_tabs[obj_no], obj_name) if obj_no == 0: self.ls_tab_widgets.append({ "label_length_scale": self.ui.label_length_scale, "label_constraints": self.ui.label_constraints, "lineEdit_constraint_0": self.ui.lineEdit_constraint_0, "lineEdit_constraint_1": self.ui.lineEdit_constraint_1, "pushButton_set_constraints": self.ui.pushButton_set_constraints, "label_obj_best_val": self.ui.label_obj_best_val }) else: label_length_scale = QLabel(parent=self.ls_tabs[obj_no]) label_length_scale.setGeometry( self.ui.label_length_scale.geometry()) label_length_scale.setText(self.ui.label_length_scale.text()) label_constraints = QLabel(parent=self.ls_tabs[obj_no]) label_constraints.setGeometry( self.ui.label_constraints.geometry()) lineEdit_constraint_0 = QLineEdit(parent=self.ls_tabs[obj_no]) lineEdit_constraint_0.setGeometry( self.ui.lineEdit_constraint_0.geometry()) lineEdit_constraint_1 = QLineEdit(parent=self.ls_tabs[obj_no]) lineEdit_constraint_1.setGeometry( self.ui.lineEdit_constraint_1.geometry()) pushButton_set_constraints = QPushButton( parent=self.ls_tabs[obj_no]) pushButton_set_constraints.setGeometry( self.ui.pushButton_set_constraints.geometry()) pushButton_set_constraints.setText( self.ui.pushButton_set_constraints.text()) label_obj_best_val = QLabel(parent=self.ls_tabs[obj_no]) label_obj_best_val.setGeometry( self.ui.label_obj_best_val.geometry()) label_obj_best_val.setText(self.ui.label_obj_best_val.text()) self.ls_tab_widgets.append({ "label_length_scale": label_length_scale, "label_constraints": label_constraints, "lineEdit_constraint_0": lineEdit_constraint_0, "lineEdit_constraint_1": lineEdit_constraint_1, "pushButton_set_constraints": pushButton_set_constraints, "label_obj_best_val": label_obj_best_val })
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1020, 588) self.actionSave = QAction(MainWindow) self.actionSave.setObjectName(u"actionSave") self.actionExit = QAction(MainWindow) self.actionExit.setObjectName(u"actionExit") self.actionExit_2 = QAction(MainWindow) self.actionExit_2.setObjectName(u"actionExit_2") self.openini = QAction(MainWindow) self.openini.setObjectName(u"openini") self.openjson = QAction(MainWindow) self.openjson.setObjectName(u"openjson") self.main_widget = QWidget(MainWindow) self.main_widget.setObjectName(u"main_widget") self.ini_widget = QWidget(self.main_widget) self.ini_widget.setObjectName(u"ini_widget") self.ini_widget.setGeometry(QRect(670, 10, 341, 551)) self.initable = QTableWidget(self.ini_widget) if (self.initable.columnCount() < 2): self.initable.setColumnCount(2) self.initable.setObjectName(u"initable") self.initable.setEnabled(True) self.initable.setGeometry(QRect(10, 60, 321, 451)) font = QFont() self.initable.setFont(font) self.initable.setEditTriggers(QAbstractItemView.DoubleClicked) self.initable.setDragEnabled(False) self.initable.setSelectionMode(QAbstractItemView.ExtendedSelection) self.initable.setSelectionBehavior(QAbstractItemView.SelectRows) self.initable.setWordWrap(False) self.initable.setRowCount(0) self.initable.setColumnCount(2) self.initable.horizontalHeader().setDefaultSectionSize(110) self.initable.horizontalHeader().setProperty("showSortIndicator", False) self.initable.horizontalHeader().setStretchLastSection(True) self.initable.verticalHeader().setDefaultSectionSize(21) self.inilabel = QLabel(self.ini_widget) self.inilabel.setObjectName(u"inilabel") self.inilabel.setGeometry(QRect(10, 10, 181, 16)) self.inipath = QTextBrowser(self.ini_widget) self.inipath.setObjectName(u"inipath") self.inipath.setEnabled(True) self.inipath.setGeometry(QRect(10, 30, 321, 22)) self.inipath.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.iniapply = QPushButton(self.ini_widget) self.iniapply.setObjectName(u"iniapply") self.iniapply.setEnabled(True) self.iniapply.setGeometry(QRect(250, 520, 80, 21)) self.inidel = QPushButton(self.ini_widget) self.inidel.setObjectName(u"inidel") self.inidel.setEnabled(False) self.inidel.setGeometry(QRect(10, 520, 80, 21)) self.iniadd = QPushButton(self.ini_widget) self.iniadd.setObjectName(u"iniadd") self.iniadd.setEnabled(False) self.iniadd.setGeometry(QRect(100, 520, 80, 21)) self.json_widget = QWidget(self.main_widget) self.json_widget.setObjectName(u"json_widget") self.json_widget.setGeometry(QRect(0, 10, 661, 551)) self.checkBox = QCheckBox(self.json_widget) self.checkBox.setObjectName(u"checkBox") self.checkBox.setEnabled(True) self.checkBox.setGeometry(QRect(20, 100, 131, 20)) self.checkBox.setChecked(True) self.delentry = QPushButton(self.json_widget) self.delentry.setObjectName(u"delentry") self.delentry.setEnabled(False) self.delentry.setGeometry(QRect(10, 520, 80, 21)) self.remote = QLineEdit(self.json_widget) self.remote.setObjectName(u"remote") self.remote.setEnabled(True) self.remote.setGeometry(QRect(20, 130, 601, 22)) self.textBrowser = QTextBrowser(self.json_widget) self.textBrowser.setObjectName(u"textBrowser") self.textBrowser.setEnabled(True) self.textBrowser.setGeometry(QRect(20, 30, 601, 22)) self.textBrowser.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.addButton = QPushButton(self.json_widget) self.addButton.setObjectName(u"addButton") self.addButton.setEnabled(True) self.addButton.setGeometry(QRect(280, 160, 61, 22)) self.table = QTableWidget(self.json_widget) if (self.table.columnCount() < 2): self.table.setColumnCount(2) self.table.setObjectName(u"table") self.table.setEnabled(True) self.table.setGeometry(QRect(10, 200, 641, 311)) self.table.setFont(font) self.table.setEditTriggers(QAbstractItemView.DoubleClicked) self.table.setDragEnabled(False) self.table.setSelectionMode(QAbstractItemView.ExtendedSelection) self.table.setSelectionBehavior(QAbstractItemView.SelectRows) self.table.setWordWrap(False) self.table.setRowCount(0) self.table.setColumnCount(2) self.table.horizontalHeader().setDefaultSectionSize(80) self.table.horizontalHeader().setProperty("showSortIndicator", False) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setDefaultSectionSize(21) self.path = QLineEdit(self.json_widget) self.path.setObjectName(u"path") self.path.setEnabled(True) self.path.setGeometry(QRect(20, 70, 531, 22)) self.apply = QPushButton(self.json_widget) self.apply.setObjectName(u"apply") self.apply.setEnabled(True) self.apply.setGeometry(QRect(570, 520, 80, 21)) self.label = QLabel(self.json_widget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(20, 10, 181, 16)) self.browse = QPushButton(self.json_widget) self.browse.setObjectName(u"browse") self.browse.setGeometry(QRect(560, 70, 61, 22)) MainWindow.setCentralWidget(self.main_widget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 1020, 19)) self.File = QMenu(self.menubar) self.File.setObjectName(u"File") self.menuOpen = QMenu(self.File) self.menuOpen.setObjectName(u"menuOpen") MainWindow.setMenuBar(self.menubar) self.menubar.addAction(self.File.menuAction()) self.File.addAction(self.menuOpen.menuAction()) self.File.addAction(self.actionSave) self.File.addSeparator() self.File.addAction(self.actionExit_2) self.menuOpen.addAction(self.openini) self.menuOpen.addAction(self.openjson) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate("MainWindow", u"frii-config", None)) self.actionSave.setText( QCoreApplication.translate("MainWindow", u"Save", None)) self.actionExit.setText( QCoreApplication.translate("MainWindow", u"Exit", None)) self.actionExit_2.setText( QCoreApplication.translate("MainWindow", u"Exit", None)) self.openini.setText( QCoreApplication.translate("MainWindow", u"Main config (frii_update.ini)", None)) self.openjson.setText( QCoreApplication.translate("MainWindow", u"Repository information (info.json)", None)) self.inilabel.setText( QCoreApplication.translate("MainWindow", u"Configuration (frii_update.ini)", None)) self.iniapply.setText( QCoreApplication.translate("MainWindow", u"Save", None)) self.inidel.setText( QCoreApplication.translate("MainWindow", u"Delete", None)) self.iniadd.setText( QCoreApplication.translate("MainWindow", u"Insert", None)) self.checkBox.setText( QCoreApplication.translate("MainWindow", u"Clone repository", None)) self.delentry.setText( QCoreApplication.translate("MainWindow", u"Delete", None)) self.remote.setText( QCoreApplication.translate("MainWindow", u"Enter repository URL here", None)) self.addButton.setText( QCoreApplication.translate("MainWindow", u"Next", None)) self.path.setText( QCoreApplication.translate("MainWindow", u"Enter repository path here", None)) self.apply.setText( QCoreApplication.translate("MainWindow", u"Save", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"Saved Information (info.json)", None)) self.browse.setText( QCoreApplication.translate("MainWindow", u"Browse", None)) self.File.setTitle( QCoreApplication.translate("MainWindow", u"File", None)) self.menuOpen.setTitle( QCoreApplication.translate("MainWindow", u"Open", None))
class Ui_MainWindow(object): def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(983, 807) MainWindow.setWindowOpacity(0.000000000000000) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.groupBox = QGroupBox(self.centralwidget) self.groupBox.setObjectName(u"groupBox") self.groupBox.setGeometry(QRect(10, 10, 961, 191)) self.horizontalLayoutWidget = QWidget(self.groupBox) self.horizontalLayoutWidget.setObjectName(u"horizontalLayoutWidget") self.horizontalLayoutWidget.setGeometry(QRect(10, 30, 211, 41)) self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.label = QLabel(self.horizontalLayoutWidget) self.label.setObjectName(u"label") self.horizontalLayout.addWidget(self.label) self.lineEdit = QLineEdit(self.horizontalLayoutWidget) self.lineEdit.setObjectName(u"lineEdit") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.lineEdit.sizePolicy().hasHeightForWidth()) self.lineEdit.setSizePolicy(sizePolicy) self.horizontalLayout.addWidget(self.lineEdit) self.horizontalLayoutWidget_2 = QWidget(self.groupBox) self.horizontalLayoutWidget_2.setObjectName( u"horizontalLayoutWidget_2") self.horizontalLayoutWidget_2.setGeometry(QRect(10, 70, 211, 41)) self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.label_2 = QLabel(self.horizontalLayoutWidget_2) self.label_2.setObjectName(u"label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_2) self.lineEdit_2.setObjectName(u"lineEdit_2") sizePolicy.setHeightForWidth( self.lineEdit_2.sizePolicy().hasHeightForWidth()) self.lineEdit_2.setSizePolicy(sizePolicy) self.horizontalLayout_2.addWidget(self.lineEdit_2) self.horizontalLayoutWidget_3 = QWidget(self.groupBox) self.horizontalLayoutWidget_3.setObjectName( u"horizontalLayoutWidget_3") self.horizontalLayoutWidget_3.setGeometry(QRect(10, 110, 211, 41)) self.horizontalLayout_3 = QHBoxLayout(self.horizontalLayoutWidget_3) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0) self.label_3 = QLabel(self.horizontalLayoutWidget_3) self.label_3.setObjectName(u"label_3") self.horizontalLayout_3.addWidget(self.label_3) self.lineEdit_3 = QLineEdit(self.horizontalLayoutWidget_3) self.lineEdit_3.setObjectName(u"lineEdit_3") sizePolicy.setHeightForWidth( self.lineEdit_3.sizePolicy().hasHeightForWidth()) self.lineEdit_3.setSizePolicy(sizePolicy) self.horizontalLayout_3.addWidget(self.lineEdit_3) self.horizontalLayoutWidget_4 = QWidget(self.groupBox) self.horizontalLayoutWidget_4.setObjectName( u"horizontalLayoutWidget_4") self.horizontalLayoutWidget_4.setGeometry(QRect(230, 30, 238, 41)) self.horizontalLayout_4 = QHBoxLayout(self.horizontalLayoutWidget_4) self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) self.label_4 = QLabel(self.horizontalLayoutWidget_4) self.label_4.setObjectName(u"label_4") self.horizontalLayout_4.addWidget(self.label_4) self.lineEdit_4 = QLineEdit(self.horizontalLayoutWidget_4) self.lineEdit_4.setObjectName(u"lineEdit_4") sizePolicy.setHeightForWidth( self.lineEdit_4.sizePolicy().hasHeightForWidth()) self.lineEdit_4.setSizePolicy(sizePolicy) self.horizontalLayout_4.addWidget(self.lineEdit_4) self.horizontalLayoutWidget_5 = QWidget(self.groupBox) self.horizontalLayoutWidget_5.setObjectName( u"horizontalLayoutWidget_5") self.horizontalLayoutWidget_5.setGeometry(QRect(230, 70, 240, 41)) self.horizontalLayout_5 = QHBoxLayout(self.horizontalLayoutWidget_5) self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.horizontalLayout_5.setContentsMargins(0, 0, 0, 0) self.label_5 = QLabel(self.horizontalLayoutWidget_5) self.label_5.setObjectName(u"label_5") self.horizontalLayout_5.addWidget(self.label_5) self.lineEdit_5 = QLineEdit(self.horizontalLayoutWidget_5) self.lineEdit_5.setObjectName(u"lineEdit_5") sizePolicy.setHeightForWidth( self.lineEdit_5.sizePolicy().hasHeightForWidth()) self.lineEdit_5.setSizePolicy(sizePolicy) self.horizontalLayout_5.addWidget(self.lineEdit_5) self.groupBox_2 = QGroupBox(self.centralwidget) self.groupBox_2.setObjectName(u"groupBox_2") self.groupBox_2.setGeometry(QRect(10, 210, 961, 171)) self.textBrowser = QTextBrowser(self.centralwidget) self.textBrowser.setObjectName(u"textBrowser") self.textBrowser.setGeometry(QRect(10, 440, 961, 311)) self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.pushButton.setGeometry(QRect(858, 400, 111, 25)) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 983, 22)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) # setupUi def retranslateUi(self, MainWindow): MainWindow.setWindowTitle( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u043f\u043e\u0440\u0442 \u0413\u0410\u0420", None)) self.groupBox.setTitle( QCoreApplication.translate( "MainWindow", u"\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b", None)) self.label.setText( QCoreApplication.translate("MainWindow", u"URL", None)) self.label_2.setText( QCoreApplication.translate("MainWindow", u"\u041f\u043e\u0440\u0442", None)) self.label_3.setText( QCoreApplication.translate("MainWindow", u"\u0418\u043c\u044f \u0411\u0414", None)) self.label_4.setText( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u044f \u0440\u043e\u043b\u0438", None)) self.label_5.setText( QCoreApplication.translate( "MainWindow", u"\u041f\u0430\u0440\u043e\u043b\u044c", None)) self.groupBox_2.setTitle( QCoreApplication.translate( "MainWindow", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0430", None)) self.pushButton.setText( QCoreApplication.translate( "MainWindow", u"\u0418\u043c\u043f\u043e\u0440\u0442", None))
class GUI: class Window: statistics = 1 options = 2 app = QApplication([]) statisticsWindow = QWidget(f=Qt.FramelessWindowHint) optionsWindow = QWidget(f=Qt.FramelessWindowHint) defaultSizeX = 800 defaultSizeY = 600 newSizeX = None newSizeY = None hypixelAPILoad = 0 minecraftAPILoad = 0 overlayLoad = 0 currentWindow = Window.statistics def __init__(self, winx: int, winy: int, version: str, statisticsTypes: list, statistics: dict): self.newSizeX = winx self.newSizeY = winy self.version = version self.stats = statistics self.statTypes = statisticsTypes self.buildStatistics() def buildWindow(self, window: QWidget): window.resize(self.newSizeX, self.newSizeY) font = QFont() font.setBold(False) font.setUnderline(False) font.setKerning(False) font.setWeight(QFont.Weight.Normal) window.setFont(font) window.setObjectName(u"background") window.setStyleSheet("QWidget#background {background-color: gray}") def buildOptions(self): self.buildWindow() QLabel("Options", self.optionsWindow) def buildStatistics(self): self.buildWindow(self.window()) self.statTableMain = QTableView(self.window()) self.statTableMain.setObjectName(u"statTableMain") statTableHeader = QHeaderView(Qt.Orientation.Vertical) # self.statTableMain.commitData() # https://doc.qt.io/qt-5/sql-model.html self.statTableMain.setVerticalHeader(statTableHeader) self.statTableMain.setGeometry(self.winw(5), self.winh(10), self.winw(90), self.winh(80)) hypixelAPILabel = QLabel("Hypixel API Load:", self.window()) hypixelAPILabel.setGeometry(self.winw(5), self.winh(90), self.winw(15), self.winh(5)) minecraftAPILabel = QLabel("Minecraft API Load:", self.window()) minecraftAPILabel.setGeometry(self.winw(20), self.winh(90), self.winw(15), self.winh(5)) overlayProgressLabel = QLabel("Overlay Load:", self.window()) overlayProgressLabel.setGeometry(self.winw(35), self.winh(90), self.winw(15), self.winh(5)) self.hypixelProgressBar = QProgressBar(self.window()) self.hypixelProgressBar.setValue(self.hypixelAPILoad) self.hypixelProgressBar.setGeometry(self.winw(5), self.winh(95), self.winw(15), self.winh(3)) self.minecraftProgressBar = QProgressBar(self.window()) self.minecraftProgressBar.setValue(self.minecraftAPILoad) self.minecraftProgressBar.setGeometry(self.winw(20), self.winh(95), self.winw(15), self.winh(3)) self.overlayProgressBar = QProgressBar(self.window()) self.overlayProgressBar.setValue(self.overlayLoad) self.overlayProgressBar.setGeometry(self.winw(35), self.winh(95), self.winw(15), self.winh(3)) self.statisticsButton = QPushButton("&Stats", self.window()) self.statisticsButton.setGeometry(self.winw(5), self.winh(4), self.winw(10), self.winh(4)) self.statisticsButton.setObjectName(u"menuButton") self.optionsButton = QPushButton("&Options", self.window()) self.optionsButton.setGeometry(self.winw(16), self.winh(4), self.winw(10), self.winh(4)) self.optionsButton.setObjectName(u"menuButton") self.exitButton = QPushButton("&Exit", self.window()) self.exitButton.setGeometry(self.winw(85), self.winh(4), self.winw(10), self.winh(4)) self.exitButton.setObjectName(u"menuButton") self.statisticsButton.clicked.connect( lambda: self.statisticsButtonClick()) self.optionsButton.clicked.connect(lambda: self.optionsButtonClick()) self.exitButton.clicked.connect(lambda: self.exitButtonClick()) def updateButtons(self): self.statisticsButton.setDisabled( self.currentWindow == self.Window.statistics) self.optionsButton.setDisabled( self.currentWindow == self.Window.options) def statisticsButtonClick(self): self.currentWindow = self.Window.statistics def optionsButtonClick(self): self.currentWindow = self.Window.options def exitButtonClick(self): self.app.exit() def winw(self, percent: int): return percent / 100 * self.defaultSizeX def winh(self, percent: int): return percent / 100 * self.defaultSizeY def scale(self, normal: int, dir="both"): size = self.window().size() xscale = size.width() / self.defaultSizeX yscale = size.height() / self.defaultSizeY normal *= xscale if dir == "both" or dir == "hor" else 1 normal *= yscale if dir == "both" or dir == "ver" else 1 return normal def window(self): if self.currentWindow == self.Window.statistics: return self.statisticsWindow else: return self.optionsWindow def run(self): self.window().show() self.app.exec_()