else: # look for FOQUS configuration file try: with open(generalSettings.getUserConfigLocation(), 'r') as f: s = f.read() settings = json.loads(s) os.chdir( settings['working_dir'] ) except: # was not able to get working dir from # configuration file if app: # gui is available ask about working dir # and write config file settings = {'working_dir': None} msg = QMessageBox() msg.setText(("The user working directory has not " "been specified yet. \nPlease create a FOQUS " "working directory and specify its location " "after pressing okay.")) msg.exec_() msg = QFileDialog() msg.setFileMode(QFileDialog.Directory) msg.setOption(QFileDialog.ShowDirsOnly) if msg.exec_(): dirs = msg.selectedFiles() settings["working_dir"] = dirs[0] os.chdir(settings['working_dir']) else: logging.getLogger("foqus." + __name__)\ .error(('No working directory'
def canNotUse(self): QMessageBox().information(self, "提示", "请先登录!", QMessageBox.Yes) return 0
def printBon(self): msgBox=QMessageBox() msgBox.setStyleSheet("color: black; background-color: gainsboro") msgBox.setWindowIcon(QIcon('./images/logos/logo.jpg')) msgBox.setWindowTitle("Printen orderbon") msgBox.setIcon(QMessageBox.Information) msgBox.setText("Wilt de orderbon printen?"); msgBox.setStandardButtons(QMessageBox.Yes) msgBox.addButton(QMessageBox.No) msgBox.setStyleSheet("color: black; background-color: gainsboro") msgBox.setDefaultButton(QMessageBox.Yes) if(msgBox.exec_() == QMessageBox.Yes): metadata = MetaData() balieverkoop = Table('balieverkoop', metadata, Column('ID', Integer(), primary_key=True), Column('bonnummer', Integer), Column('artikelID', Integer), Column('barcode', String), Column('omschrijving', String), Column('aantal', Float), Column('prijs', Float), Column('subtotaal', Float), Column('subbtw', Float)) params = Table('params', metadata, Column('paramID', Integer(), primary_key=True), Column('tarief', Float), Column('lock', Boolean)) engine = create_engine('postgresql+psycopg2://postgres@localhost/bisystem') con = engine.connect() selpar = select([params]).where(params.c.paramID == 103) rppar = con.execute(selpar).first() mbonnr = int(rppar[1]) delbal = delete(balieverkoop).where(and_(balieverkoop.c.aantal == 0,\ balieverkoop.c.bonnummer == mbonnr)) con.execute(delbal) selb = select([balieverkoop]).where(balieverkoop.c.bonnummer == mbonnr).order_by(balieverkoop.c.barcode) rpb = con.execute(selb) mcumtot = 0 mcumbtw = 0 mblad = 0 rgl = 0 if platform == 'win32': fbarc = '.\\forms\\Barcodelijsten\\'+str(mbonnr)+'.txt' else: fbarc = './forms//Barcodelijsten/'+str(mbonnr)+'.txt' for row in rpb: rgl += 1 if rgl == 1 : mblad += 1 open(fbarc, 'w').write(heading(mblad, mbonnr)) elif rgl%57 == 1: mblad += 1 open(fbarc, 'a').write(heading(mblad, mbonnr)) martnr = row[2] momschr = row[4] maantal = row[5] mprijs = row[6] mtotaal = row[7] mtotbtw = row[8] open(fbarc,'a').write(str(martnr) +' '+'{:<40s}'.format(momschr)+' '+'{:>6d}'\ .format(int(maantal))+'{:>12.2f}'.format(float(mprijs))+'{:>12.2f}'\ .format(float(mtotaal))+'{:>12.2f}'\ .format(float(mtotbtw))+'\n') mcumtot = mcumtot+mtotaal mcumbtw = mcumbtw+mtotbtw tail=\ ('==============================================================================================\n'+ 'Totaal bedrag af te rekenen inclusief BTW en bedrag BTW 21% '+'{:>12.2f}'.format(mcumtot)+'{:>12.2f}'.format(mcumbtw)+' \n'+ '==============================================================================================\n') if rgl > 0: open(fbarc,'a').write(tail) if platform == 'win32': from os import startfile startfile(fbarc, "print") else: from os import system system("lpr "+fbarc) printing() else: geenGegevens()
key.write(keys.export_key()) else: with open(key_file, 'rb') as key: keys = RSA.import_key(key.read()) #!!!keys.publickey().export_key() logger.debug("Keys sucsessfully loaded.") # Создаём объект базы данных database = ClientDatabase(client_name) # Создаём объект - транспорт и запускаем транспортный поток try: transport = ClientTransport(server_port, server_address, database, client_name, client_passwd, keys) logger.debug("Transport ready.") except ServerError as error: message = QMessageBox() message.critical(start_dialog, 'Ошибка сервера', error.text) exit(1) transport.setDaemon(True) transport.start() # Удалим объект диалога за ненадобностью del start_dialog # Создаём GUI main_window = ClientMainWindow(database, transport, keys) main_window.make_connection(transport) main_window.setWindowTitle(f'Чат Программа alpha release - {client_name}') client_app.exec_() # Раз графическая оболочка закрылась, закрываем транспорт
def __showMessageBoxInvalidHexColor(hexColor): messageBoxInvalidColor = QMessageBox() messageBoxInvalidColor.setIcon(QMessageBox.Critical) messageBoxInvalidColor.setWindowTitle('Invalid Hex Color Code') messageBoxInvalidColor.setText('"' + hexColor + '"' + ' is not valid hex color code') messageBoxInvalidColor.exec_()
def calculate_schedules(self): if (self.solve_schedule_thread): return list_of_componets = [] self.tree_model.lock(True) for course in self.tree_model.root.data: if not course.is_included(): continue for component in course.data: if not component.is_included(): continue list_of_sections = [ section.data for section in component.data if section.data.include ] list_of_componets.append(list_of_sections) if not list_of_componets: self.tree_model.lock(False) QMessageBox(QMessageBox.Warning, "No Course Selected", "Cannot make schedules since no course is selected.", QMessageBox.Close).exec() return if self.earlyHorizontalSlider.isEnabled(): time = qtime2minutes(self.earlyTimeEdit.time()) penalty = self.earlyHorizontalSlider.value() / 1000 early_curve = [(0, penalty * time), (time, 0)] else: early_curve = parse_ELI_penalty(self.earlyPenaltyLineEdit.text()) if early_curve is None: QMessageBox(QMessageBox.Warning, "Invalid Early Penalty", self.earlyPenaltyLineEdit.text() + " isn't valid.", QMessageBox.Close).exec() self.tree_model.lock(False) return if self.lateHorizontalSlider.isEnabled(): time = qtime2minutes(self.lateTimeEdit.time()) penalty = self.lateHorizontalSlider.value() / 1000 late_curve = [(time, 0), (1440, penalty * (1440 - time))] else: late_curve = parse_ELI_penalty(self.latePenaltyLineEdit.text()) if late_curve is None: QMessageBox(QMessageBox.Warning, "Invalid Late Penalty", self.latePenaltyLineEdit.text() + " isn't valid.", QMessageBox.Close).exec() self.tree_model.lock(False) return if self.intervalHorizontalSlider.isEnabled(): time = qtime2minutes(self.intervalTimeEdit.time()) penalty = self.intervalHorizontalSlider.value() / 1000 interval_curve = [(time, 0), (1440, penalty * (1440 - time))] else: interval_curve = parse_ELI_penalty( self.intervalPenaltyLineEdit.text()) if interval_curve is None: QMessageBox( QMessageBox.Warning, "Invalid Interval Penalty", self.intervalPenaltyLineEdit.text() + " isn't valid.", QMessageBox.Close).exec() self.tree_model.lock(False) return if self.breakTreeWidget.isEnabled(): req_breaks = self.req_breaks else: req_breaks = parse_req_breaks(self.requiredBreaksLineEdit.text()) if req_breaks is None: QMessageBox( QMessageBox.Warning, "Invalid Required Breaks", self.requiredBreaksLineEdit.text() + " isn't valid.", QMessageBox.Close).exec() self.tree_model.lock(False) return self.solve_schedule_thread = CalcScheduleThread( list_of_componets, early_curve, late_curve, interval_curve, req_breaks) self.solve_schedule_thread.results_ready.connect( self.handle_schedule_calc_results) self.solve_schedule_thread.update_count.connect( self.handle_schedule_calc_update) self.scheduleScoreTreeWidget.clear() self.scheduleDetailsTreeWidget.clear() self.solve_schedule_thread.start()
def apply_clicked(self): square_coef_text = self.view.ui.tb_square_coeff.text() truth_factor_text = self.view.ui.tb_truth_factor.text() self.model.settings.language = self.view.ui.cmb_language.currentText() self.model.settings.logs_saving = bool( self.view.ui.cmb_log_saving.currentText()) self.model.settings.connection_string = self.view.ui.tb_conn_str.text() try: self.model.settings.square_coef = float(square_coef_text) except ValueError: self.model.settings.square_coef = 0 try: self.model.settings.truth_factor = float(truth_factor_text) except ValueError: self.model.settings.square_coef = 0 if not self.model.is_valid_values(): QMessageBox.warning( self.view, _('Warning'), _('Incorrect truth factor or square coefficient values entered.\nValues can range from 0 to 1' )) return if not self.model.is_valid_paths(): QMessageBox.warning( self.view, _('Warning'), _('Incorrect paths to files or directories entered')) return if not self.model.is_valid_conn_str(): QMessageBox.warning( self.view, _('Warning'), _('Database doesnt exists or username/password incorrect')) return if self.model.settings.settings_file != program_settings.settings_file or self.model.settings.language != program_settings.language or \ self.model.settings.connection_string != program_settings.connection_string: close = QMessageBox().question( self.view, _('Restart'), _('To apply the selected settings will require a restart.\nRestart the system?' ), QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if close == QMessageBox.Yes: self.parent_o.controller.exit() if self.model.settings.settings_file != program_settings.settings_file: if not program_settings.forced_restore( self.model.settings.settings_file, program_settings.settings_file): QMessageBox.warning( self.view, _('Warning'), _('Settings file is damaged!\nSettings returned to their previous state.' ) + _('\nRestart canceled.')) self.view.close() return program_settings.update_obj(self.model.settings) program_settings.save() program_logs.change_settings_log() program_logs.restart_log() self.view.close() self.parent_o.destroy() do_restart() return else: return program_settings.update_obj(self.model.settings) program_settings.save() program_logs.change_settings_log() QMessageBox.information(self.view, _('Success'), _('Settings successfully applied')) self.view.close()
""" # PyQt Modules from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QMessageBox # Python Modules if __name__ == "__main__": # Tipica creacion de la aplicacion que crea un contexto (eventos del sistema) app = QApplication([]) # Creamos instancia del QMessageBox editada por nosotros a nuestro antojo! widget = QMessageBox( QMessageBox.Warning, # Podemos agregar un icono al dialogo "Informacion", # El titulo del dialogo emergente "Este es un ejemplo de QMessageBox", # Mensaje del QMessageBox QMessageBox.Yes | QMessageBox.No # Podemos elegir que botones poner, indica mas de uno con | ) widget.show() # Estas en apuro y queres crear un pop-up con mensajes rapido! # QMessageBox.information(widget, "Informacion", "Esto muestra un mensaje rapidamente con informacion!") # QMessageBox.warning(widget, "Precaucion", "Ojo, puede que la estes cagando...") # QMessageBox.critical(widget, "Critico", "Estoy a punto de trular") # # IMPORTANTE! esto esta comentado porque asi como esta no funcionaria, puede usarse asi directo, # pero es necesario que en "widget" le pases un Parent, digamos que creas tu propia QMainWindow o un QWidget, # y no este main escueto, entonces ahi pondrias "self". # Ejecucion del loop para eventos app.exec()
def on_load_summary_clicked(self): alert = QMessageBox() palette = self.GetPalette() alert.setPalette(palette) alert.setText('Call control logic to load a summary from the database') alert.exec_()
def show_message(self, title, message, icon=QMessageBox.Information): dlg = QMessageBox(parent=self) dlg.setWindowTitle(title) dlg.setIcon(icon) dlg.setText(message) dlg.exec_()
def nueva_sol(self, restricciones, mensaje, respuesta, iteraciones, holgura, artificial, data): vars_sol = [] vars_entrada = [] ultima_iteracion = iteraciones[len(iteraciones) - 1] for var in respuesta: tmp = str(var).split(" = ") if float(tmp[1]) > 0 and tmp[0] != 'Z': vars_sol.append(tmp[0]) print("VARIABLES DE LA SOLUCION: ", vars_sol) for var in range(len(ultima_iteracion[0])): if ultima_iteracion[0][var] != "V.B" and ultima_iteracion[0][ var] != 'bi' and not ultima_iteracion[0][var] in vars_sol: if ultima_iteracion[len(ultima_iteracion) - 1][var] == 0: vars_entrada.append(ultima_iteracion[0][var]) print("VARIABLES DE ENTRADA: ", vars_entrada) input_ = QInputDialog(self) input_.setLabelText("Seleccione la nueva Variable de Entrada") input_.setWindowTitle("Seleccione la Nueva Variable de entrada") input_.setComboBoxItems(vars_entrada) input_.setOkButtonText("Encontrar la nueva Solución") input_.setCancelButtonText("Cancelar") button = input_.exec() print("RESULT: ", input_.textValue()) print("BUTTON: ", button) pivote = sp.special_solution( ultima_iteracion[0].index(input_.textValue()), ultima_iteracion) sol_ = copy.deepcopy(ultima_iteracion) sol_ = sp.var_salida(sol_, pivote) sol_ = sp.reducir_fila_pivote(sol_, pivote) sol_ = sp.nueva_solucion_v2(sol_, pivote, holgura, artificial) sol_ = sp.depurar_nueva_solucion(sol_) iteraciones.append(sol_) respuesta = sp.generar_solucion(sol_, 2) message = QMessageBox() message.setWindowTitle("Simplex") message.setText("Nueva Solución") sol = "" for var in respuesta: sol = sol + var + "\n" message.setInformativeText("Solución: \n\n" + sol + "\n" + "¿Desea obtener una nueva solución?") yes = message.addButton("Sí", QMessageBox.YesRole) no = message.addButton("No", QMessageBox.NoRole) message.setIcon(QMessageBox.Information) message.setStyleSheet("font-weight: bold;") message.exec() if message.clickedButton() == yes: self.nueva_sol(restricciones, mensaje, respuesta, iteraciones, holgura, artificial, data) elif message.clickedButton() == no: reporte = saveReport(restricciones, respuesta, iteraciones, mensaje, data) reporte.crear_pdf() reporte.mostrar_pdf()
def removelist1(self, item): self.total = self.bats +self.bowls + self.ars + self.wks if(self.total<11): c = item.text() # print(c) if(data_1.get(c)=='BAT'): player_value = data_value.get(c) self.bats+=1 self.label_10.setText( "<html><head/><body><p align=\"center\"><span style=\" font-size:11pt; font-weight:600; color:#edd400;\">{}</span></p></body></html>".format(self.bats)) self.list_1.takeItem(self.list_1.row(item)) self.list_2.addItem(item.text()) bat.remove(c) # count+=1 if(data_1.get(c)=='BWL'): player_value = data_value.get(c) self.bowls+=1 self.label_9.setText( "<html><head/><body><p align=\"center\"><span style=\" font-size:11pt; font-weight:600; color:#edd400;\">{}</span></p></body></html>".format(self.bowls)) self.list_1.takeItem(self.list_1.row(item)) self.list_2.addItem(item.text()) # count+=1 bowl.remove(c) if(data_1.get(c)=='AR'): player_value = data_value.get(c) self.ars+=1 self.label_8.setText( "<html><head/><body><p align=\"center\"><span style=\" font-size:11pt; font-weight:600; color:#edd400;\">{}</span></p></body></html>".format(self.ars)) self.list_1.takeItem(self.list_1.row(item)) self.list_2.addItem(item.text()) ar.remove(c) if(data_1.get(c)=='WK'): player_value = data_value.get(c) self.wks+=1 if self.wks>1: msg = QMessageBox() msg.setStyleSheet("QLabel{min-width: 200px;}") msg.setIcon(QMessageBox.Critical) msg.setInformativeText('YOU CAN\'T INSERT MORE THAN ONE WICKETKEEPER') msg.setWindowTitle("Error") self.label_7.setText( "<html><head/><body><p align=\"center\"><span style=\" font-size:11pt; font-weight:600; color:#edd400;\">1</span></p></body></html>") msg.exec_() else: self.label_7.setText( "<html><head/><body><p align=\"center\"><span style=\" font-size:11pt; font-weight:600; color:#edd400;\">{}</span></p></body></html>".format(self.wks)) self.list_1.takeItem(self.list_1.row(item)) self.list_2.addItem(item.text()) wk.remove(c) k = self.points_Available - player_value if k<0: msg = QMessageBox() msg.setStyleSheet("QLabel{min-width: 250px;}") msg.setInformativeText('Not Enoght Point Available') msg.setWindowTitle("Error") msg.exec_() self.label_14.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">{}</span></p></body></html>".format(k)) else: self.label_14.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">{}</span></p></body></html>".format(self.points_Available)) self.points_Available = k increase = self.h + player_value if increase>1000: increase = 0 self.label_15.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">{}</span></p></body></html>".format(increase)) else: self.label_15.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:12pt; font-weight:600;\">{}</span></p></body></html>".format(increase)) self.h = increase self.count+=1 self.point_used = increase else: msg = QMessageBox() msg.setStyleSheet("QLabel{min-width: 250px;}") msg.setInformativeText('Player Limit Exceeded') msg.setWindowTitle("Error") msg.exec_()
def show_modal(self, text): msg = QMessageBox() msg.setText(text) msg.exec_()
def logout_success(self): msg = QMessageBox() msg.setText('Logged out successful') msg.exec_() ## go to login screen self.close()
def __show_error(self, message: str): dialog = QMessageBox(self) dialog.setIcon(QMessageBox.Critical) dialog.setText(message) dialog.addButton(QMessageBox.Ok) dialog.exec()
def showError(self, error): msg = QMessageBox() msg.setWindowTitle("Error") msg.setText(error) x = msg.exec_()
def setupUi(self, windowEdit): windowEdit.setObjectName("windowEdit") windowEdit.resize(800, 600) # Background oImage = QImage("background_editspell.jpg") sImage = oImage.scaled(QSize(800, 600)) # resize Image to widgets size palette = QPalette() palette.setBrush(10, QBrush(sImage)) # 10 = Windowrole windowEdit.setPalette(palette) self.centralwidget = QtWidgets.QWidget(windowEdit) self.centralwidget.setObjectName("centralwidget") self.buttonSave = QtWidgets.QPushButton(self.centralwidget) self.buttonSave.setGeometry(QtCore.QRect(610, 520, 75, 23)) self.buttonSave.setObjectName("buttonSave") self.buttonSave.clicked.connect(lambda: self.saveSpell(windowEdit)) self.buttonCancel = QtWidgets.QPushButton(self.centralwidget) self.buttonCancel.setGeometry(QtCore.QRect(700, 520, 75, 23)) self.buttonCancel.setObjectName("buttonCancel") self.buttonCancel.clicked.connect(lambda: self.closeWindow(windowEdit)) self.gridLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_2.setGeometry(QtCore.QRect(20, 20, 761, 451)) self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget_2) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") self.labelConcentration = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelConcentration.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelConcentration.setObjectName("labelConcentration") self.gridLayout_2.addWidget(self.labelConcentration, 6, 0, 1, 1) self.labelClasses = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelClasses.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelClasses.setObjectName("labelClasses") self.gridLayout_2.addWidget(self.labelClasses, 5, 0, 1, 1) self.labelAddSpell = QtWidgets.QLabel(self.gridLayoutWidget_2) font = QtGui.QFont() font.setPointSize(16) font.setBold(True) font.setWeight(75) self.labelAddSpell.setFont(font) self.labelAddSpell.setObjectName("labelAddSpell") self.gridLayout_2.addWidget(self.labelAddSpell, 0, 0, 1, 1) self.labelSchool = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelSchool.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelSchool.setObjectName("labelSchool") self.gridLayout_2.addWidget(self.labelSchool, 4, 0, 1, 1) self.labelRitual = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelRitual.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelRitual.setObjectName("labelRitual") self.gridLayout_2.addWidget(self.labelRitual, 7, 0, 1, 1) self.labelName = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelName.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelName.setObjectName("labelName") self.gridLayout_2.addWidget(self.labelName, 1, 0, 1, 1) self.filterConcentration = QtWidgets.QComboBox(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterConcentration.sizePolicy().hasHeightForWidth()) self.filterConcentration.setSizePolicy(sizePolicy) self.filterConcentration.setMaximumSize(QtCore.QSize(60, 16777215)) self.filterConcentration.setObjectName("filterConcentration") self.filterConcentration.addItem("") self.filterConcentration.setItemText(0, "") self.filterConcentration.addItem("") self.filterConcentration.addItem("") self.gridLayout_2.addWidget(self.filterConcentration, 6, 1, 1, 1) self.filterRitual = QtWidgets.QComboBox(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterRitual.sizePolicy().hasHeightForWidth()) self.filterRitual.setSizePolicy(sizePolicy) self.filterRitual.setMaximumSize(QtCore.QSize(60, 16777215)) self.filterRitual.setObjectName("filterRitual") self.filterRitual.addItem("") self.filterRitual.setItemText(0, "") self.filterRitual.addItem("") self.filterRitual.addItem("") self.gridLayout_2.addWidget(self.filterRitual, 7, 1, 1, 1) self.labelDescription = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelDescription.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelDescription.setObjectName("labelDescription") self.gridLayout_2.addWidget(self.labelDescription, 2, 0, 1, 1) self.labelLevel = QtWidgets.QLabel(self.gridLayoutWidget_2) self.labelLevel.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelLevel.setObjectName("labelLevel") self.gridLayout_2.addWidget(self.labelLevel, 3, 0, 1, 1) self.filterDescription = QtWidgets.QLineEdit(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterDescription.sizePolicy().hasHeightForWidth()) self.filterDescription.setSizePolicy(sizePolicy) self.filterDescription.setMaximumSize(QtCore.QSize(125, 16777215)) self.filterDescription.setObjectName("filterDescription") self.gridLayout_2.addWidget(self.filterDescription, 2, 1, 1, 1) self.filterName = QtWidgets.QLineEdit(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterName.sizePolicy().hasHeightForWidth()) self.filterName.setSizePolicy(sizePolicy) self.filterName.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.filterName.setObjectName("filterName") self.gridLayout_2.addWidget(self.filterName, 1, 1, 1, 1) self.filterLevel = QtWidgets.QComboBox(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterLevel.sizePolicy().hasHeightForWidth()) self.filterLevel.setSizePolicy(sizePolicy) self.filterLevel.setMaximumSize(QtCore.QSize(40, 16777215)) self.filterLevel.setObjectName("filterLevel") self.filterLevel.addItem("") self.filterLevel.setItemText(0, "") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.filterLevel.addItem("") self.gridLayout_2.addWidget(self.filterLevel, 3, 1, 1, 1) self.filterSchool = QtWidgets.QComboBox(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.filterSchool.sizePolicy().hasHeightForWidth()) self.filterSchool.setSizePolicy(sizePolicy) self.filterSchool.setMaximumSize(QtCore.QSize(125, 16777215)) self.filterSchool.setObjectName("filterSchool") self.filterSchool.addItem("") self.filterSchool.setItemText(0, "") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.filterSchool.addItem("") self.gridLayout_2.addWidget(self.filterSchool, 4, 1, 1, 1) # [START] CLASSES self.classLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.classLayoutWidget.setObjectName("classLayoutWidget") self.classLayout = QtWidgets.QGridLayout(self.classLayoutWidget) self.classLayout.setContentsMargins(0, 0, 0, 0) self.classLayout.setObjectName("classLayout") self.gridLayout_2.addWidget(self.classLayoutWidget, 5, 1, 1, 1) self.checkboxClassBard = QCheckBox("Bard") self.checkboxClassCleric = QCheckBox("Cleric") self.checkboxClassDruid = QCheckBox("Druid") self.checkboxClassPaladin = QCheckBox("Paladin") self.checkboxClassRanger = QCheckBox("Ranger") self.checkboxClassSorcerer = QCheckBox("Sorcerer") self.checkboxClassWarlock = QCheckBox("Warlock") self.checkboxClassWizard = QCheckBox("Wizard") self.classLayout.addWidget(self.checkboxClassBard, 0, 0, 1, 1) self.classLayout.addWidget(self.checkboxClassCleric, 0, 1, 1, 1) self.classLayout.addWidget(self.checkboxClassDruid, 1, 0, 1, 1) self.classLayout.addWidget(self.checkboxClassPaladin, 1, 1, 1, 1) self.classLayout.addWidget(self.checkboxClassRanger, 2, 0, 1, 1) self.classLayout.addWidget(self.checkboxClassSorcerer, 2, 1, 1, 1) self.classLayout.addWidget(self.checkboxClassWarlock, 3, 0, 1, 1) self.classLayout.addWidget(self.checkboxClassWizard, 3, 1, 1, 1) # [END] CLASSES # [START] COMPONENTS self.labelComponents = QtWidgets.QLabel(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.labelComponents.sizePolicy().hasHeightForWidth()) self.labelComponents.setSizePolicy(sizePolicy) self.labelComponents.setMaximumSize(QtCore.QSize(16777215, 20)) self.labelComponents.setObjectName("labelComponents") self.gridLayout_2.addWidget(self.labelComponents, 8, 0, 1, 1) self.componentLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.componentLayoutWidget.setObjectName("componentLayoutWidget") self.componentLayout = QtWidgets.QGridLayout( self.componentLayoutWidget) self.componentLayout.setContentsMargins(0, 0, 0, 0) self.componentLayout.setObjectName("componentLayout") self.gridLayout_2.addWidget(self.componentLayoutWidget, 8, 1, 1, 1) self.checkboxComponentV = QCheckBox("V") self.checkboxComponentS = QCheckBox("S") self.checkboxComponentM = QCheckBox("M") self.componentLayout.addWidget(self.checkboxComponentV, 0, 0, 1, 1) self.componentLayout.addWidget(self.checkboxComponentS, 0, 1, 1, 1) self.componentLayout.addWidget(self.checkboxComponentM, 0, 2, 1, 1) # [END] COMPONENTS self.nameData = {} self.msgBoxInvalidInput = QMessageBox() self.msgBoxAlreadyExists = QMessageBox() windowEdit.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(windowEdit) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21)) self.menubar.setObjectName("menubar") windowEdit.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(windowEdit) self.statusbar.setObjectName("statusbar") windowEdit.setStatusBar(self.statusbar) self.retranslateUi(windowEdit) QtCore.QMetaObject.connectSlotsByName(windowEdit)
def showHelp(self): msg = QMessageBox() msg.setWindowTitle("Help") msg.setText("HEllo") x = msg.exec_()
def PopMsg(input): msg = QMessageBox() msg.setDefaultButton(QMessageBox.Ok) msg.setWindowTitle("Done!") msg.setText("Sorted List: " + str(input)) msg.exec()
def setIBInfile(self): ''' Use the glob in the text widget to find a list of matched input files. Set the settings variable to the first one, but warn the user if there are multiple input files. ''' sedit = self.fui.ibInfile.text() sglob = os.path.split(sedit)[1] self.fui.ibInfile.setStyleSheet("color: black;") if not sglob: self.fui.ibInfileLbl.setText(self.getDirectory()) self.fui.ibInfileLbl.setStyleSheet("color: red;") self.fui.ibInfile.setStyleSheet("color: red;") return if sglob and sedit and sedit == sglob: self.settings.setValue('ibInfile', sglob) elif sglob and sedit and len(sedit) > len(sglob): sset = self.settings.value('ibInfile') if sset: self.fui.ibInfile.setText(sset) return rgx = re.sub('{\\*}', '.*', sglob) rgx = rgx + '$' d = self.getDirectory() # What should turn red here???? if not d or not os.path.exists(d): logging.warning(f'Cannot locate directory "{d}".') self.fui.ibInfileLbl.setText(sedit) self.fui.ibInfileLbl.setStyleSheet("color: red;") return fs = list() for f in os.listdir(d): x = re.search((rgx), f) if x: fs.append(x.string) fname = '' if len(fs) > 1: title = 'Matched Files' msg = '<h3>You have matched multiple files:</h3><ul> ' for name in fs: msg = msg + '<li>' + name + '</li>' msg = msg + '</ul><p>Displaying the first</p>' msgbx = QMessageBox(QMessageBox.Information, title, msg, QMessageBox.Ok) msgbx.setWindowIcon(QIcon("structjour/images/ZSLogo.png")) # msgbx.setText(msg) msgbx.exec() fname = fs[0] elif len(fs) == 1: fname = fs[0] else: fname = sglob fpathname = os.path.join(d, fname) if not os.path.exists(fpathname): self.fui.ibInfileLbl.setStyleSheet("color: red;") else: self.fui.ibInfileLbl.setStyleSheet("color: green;") self.fui.ibInfileLbl.setText(fpathname) self.settings.setValue('ibInfile', sglob)
def press_record(self): msg = QMessageBox() msg.setWindowTitle("Warning") msg.setText("Record: NOT IMPLEMENTED YET") x = msg.exec_()
def btn_iniciar_click(self): if self.ui.lbl_pdf.text() == "Ubicación del pdf": msg_cargar_pdf = QMessageBox() msg_cargar_pdf.setIcon(QMessageBox.Warning) msg_cargar_pdf.setText("¡Cargue un pdf primero!.") msg_cargar_pdf.setWindowTitle("Error") msg_cargar_pdf.exec_() return if self.ui.chkBox_excel.isChecked() and self.ui.lbl_excel.text( ) == "Ubicación del excel": msg_cargar_excel = QMessageBox() msg_cargar_excel.setIcon(QMessageBox.Warning) msg_cargar_excel.setText( "Error, debe cargar un Excel o desmarcar la opción.") msg_cargar_excel.setWindowTitle("Error") msg_cargar_excel.exec_() return if self.ui.cant_a_partir.value() > int(self.ui.lbl_cant_pag.text()): msg_a_partir_ultima_pag = QMessageBox() msg_a_partir_ultima_pag.setIcon(QMessageBox.Warning) msg_a_partir_ultima_pag.setText( "Error, no se puede a partir de más de la última página") msg_a_partir_ultima_pag.setWindowTitle("Error") msg_a_partir_ultima_pag.exec_() return if self.ui.cant_a_partir.value( ) - 1 + self.ui.cant_pag_a_recortar.value() >= int( self.ui.lbl_cant_pag.text()) + 1: msg_a_partir_exedido = QMessageBox() msg_a_partir_exedido.setIcon(QMessageBox.Warning) msg_a_partir_exedido.setText( "Error, se exedió el numero de páginas del documento.") msg_a_partir_exedido.setWindowTitle("Error") msg_a_partir_exedido.exec_() return if self.ui.txt_carpeta.text() == "": msg_txt_carpeta_vacio = QMessageBox() msg_txt_carpeta_vacio.setIcon(QMessageBox.Warning) msg_txt_carpeta_vacio.setText( "Error, el nombre de la carpeta no debe estar vacío.") msg_txt_carpeta_vacio.setWindowTitle("Error") msg_txt_carpeta_vacio.exec_() return if self.ui.cant_intervalo.value() > int(self.ui.lbl_cant_pag.text()): msg_intervalo_exedido = QMessageBox() msg_intervalo_exedido.setIcon(QMessageBox.Warning) msg_intervalo_exedido.setText( "Error, el intervalo de páginas exede al del documento.") msg_intervalo_exedido.setWindowTitle("Error") msg_intervalo_exedido.exec_() return pagina = self.ui.cant_a_partir.value() - 1 pagina_hasta = self.ui.cant_pag_a_recortar.value() + pagina intervalo = self.ui.cant_intervalo.value() nombre_carpeta = self.ui.txt_carpeta.text() bool_excel = self.ui.chkBox_excel.isChecked() paginas_generadas = extract_page(self.ui.lbl_pdf.text(), pagina, pagina_hasta, intervalo, nombre_carpeta, bool_excel) msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText(f"Se han generado {paginas_generadas} archivos PDF.") msg.setWindowTitle("Información") msg.exec_()
def show_popup(self): msg = QMessageBox() msg.setWindowTitle("Results") msg.setText("wrong:" + str(self.session.all_wrongs) + "-right:" + str(self.session.all_rights)) x = msg.exec()
def draw_menu(self): self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 800, 30)) self.menu_files = QMenu() self.menu_tools = QMenu() self.menu_help = QMenu() self.menu_team = QMenu("小组") self.action_lyl = QAction("刘彦龙") self.action_lyl.setObjectName(Namer.action_lyl) self.action_brb = QAction("白汝冰") self.action_brb.setObjectName(Namer.action_brb) self.action_hjy = QAction("何婧源") self.action_hjy.setObjectName(Namer.action_hjy) self.menu_team.addActions([self.action_lyl, self.action_brb, self.action_hjy]) self.menu_open = QMenu() self.action_open_db = QAction() self.action_open_db.setObjectName(Namer.action_open_db) self.menu_open.addActions([self.action_open_db]) self.action_exit = QAction() self.action_exit.setObjectName(Namer.action_exit) self.msgbox_about = QMessageBox() about = ''' <!DOCTYPE html><html><head> <title>about</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> /** * prism.js Github theme based on GitHub's theme. * @author Sam Clarke */ code[class*="language-"], pre[class*="language-"] { color: #333; background: none; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.4; -moz-tab-size: 8; -o-tab-size: 8; tab-size: 8; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; } /* Code blocks */ pre[class*="language-"] { padding: .8em; overflow: auto; /* border: 1px solid #ddd; */ border-radius: 3px; /* background: #fff; */ background: #f5f5f5; } /* Inline code */ :not(pre) > code[class*="language-"] { padding: .1em; border-radius: .3em; white-space: normal; background: #f5f5f5; } .token.comment, .token.blockquote { color: #969896; } .token.cdata { color: #183691; } .token.doctype, .token.punctuation, .token.variable, .token.macro.property { color: #333; } .token.operator, .token.important, .token.keyword, .token.rule, .token.builtin { color: #a71d5d; } .token.string, .token.url, .token.regex, .token.attr-value { color: #183691; } .token.property, .token.number, .token.boolean, .token.entity, .token.atrule, .token.constant, .token.symbol, .token.command, .token.code { color: #0086b3; } .token.tag, .token.selector, .token.prolog { color: #63a35c; } .token.function, .token.namespace, .token.pseudo-element, .token.class, .token.class-name, .token.pseudo-class, .token.id, .token.url-reference .token.variable, .token.attr-name { color: #795da3; } .token.entity { cursor: help; } .token.title, .token.title .token.punctuation { font-weight: bold; color: #1d3e81; } .token.list { color: #ed6a43; } .token.inserted { background-color: #eaffea; color: #55a532; } .token.deleted { background-color: #ffecec; color: #bd2c00; } .token.bold { font-weight: bold; } .token.italic { font-style: italic; } /* JSON */ .language-json .token.property { color: #183691; } .language-markup .token.tag .token.punctuation { color: #333; } /* CSS */ code.language-css, .language-css .token.function { color: #0086b3; } /* YAML */ .language-yaml .token.atrule { color: #63a35c; } code.language-yaml { color: #183691; } /* Ruby */ .language-ruby .token.function { color: #333; } /* Markdown */ .language-markdown .token.url { color: #795da3; } /* Makefile */ .language-makefile .token.symbol { color: #795da3; } .language-makefile .token.variable { color: #183691; } .language-makefile .token.builtin { color: #0086b3; } /* Bash */ .language-bash .token.keyword { color: #0086b3; } /* highlight */ pre[data-line] { position: relative; padding: 1em 0 1em 3em; } pre[data-line] .line-highlight-wrapper { position: absolute; top: 0; left: 0; background-color: transparent; display: block; width: 100%; } pre[data-line] .line-highlight { position: absolute; left: 0; right: 0; padding: inherit 0; margin-top: 1em; background: hsla(24, 20%, 50%,.08); background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0)); pointer-events: none; line-height: inherit; white-space: pre; } pre[data-line] .line-highlight:before, pre[data-line] .line-highlight[data-end]:after { content: attr(data-start); position: absolute; top: .4em; left: .6em; min-width: 1em; padding: 0 .5em; background-color: hsla(24, 20%, 50%,.4); color: hsl(24, 20%, 95%); font: bold 65%/1.5 sans-serif; text-align: center; vertical-align: .3em; border-radius: 999px; text-shadow: none; box-shadow: 0 1px white; } pre[data-line] .line-highlight[data-end]:after { content: attr(data-end); top: auto; bottom: .4em; }html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none} /* Please visit the URL below for more information: */ /* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */ </style> </head> <body for="html-export"> <div class="mume markdown-preview "> <h2 class="mume-header" id="21-%E6%B0%B4%E5%BA%93%E7%AD%89%E5%87%BA%E5%8A%9B%E8%AE%A1%E7%AE%97%E8%BE%85%E5%8A%A9%E8%BD%AF%E4%BB%B6">21-水库等出力计算辅助软件</h2> <ul> <li>单位:武汉大学水利水电学院</li> <li>专业:水文与水资源工程</li> <li>作者:刘彦龙、白汝冰、何婧源</li> <li>指导教师:艾学山、万飚</li> <li>开发时间:2019年6月</li> </ul> </div> </body></html>''' # self.msgbox_about.setText(''' # --- 水库等出力调节计算软件 --- \n # --- 学校:武汉大学\n # --- 专业:水文与水资源工程\n # --- 作者:刘彦龙、白汝冰、何婧源\n # --- 指导教师:艾学山、万飚\n # ''') self.msgbox_about.setText(about) self.msgbox_about.setWindowTitle("关于") self.action_about = QAction() self.action_about.triggered.connect(lambda: self.msgbox_about.show()) self.action_manul = QAction() self.menubar.addMenu(self.menu_files) self.menubar.addMenu(self.menu_help) self.menubar.addMenu(self.menu_team) self.menu_help.addActions([self.action_manul, self.action_about]) self.menu_files.addMenu(self.menu_open) self.menu_files.addActions([self.action_exit]) self.setMenuBar(self.menubar)
def validation(self): # 先校验输入 try: self.userName = self.ui_3.lineEdit.text() self.password = self.ui_3.lineEdit_2.text() self.passwordAgain = self.ui_3.lineEdit_3.text() self.phone = self.ui_3.lineEdit_4.text() self.secretCode = self.ui_3.textEdit.toPlainText() self.ilegal = False ilegal = ['%', '^', '&', '(', ')', '!', '@', '#'] # 逐个校验 for i in range(len(ilegal)): if ilegal[i] in self.userName: self.ilegal = True print("yes") break if (len(self.userName) >= 2 and len(self.userName) <= 10): self.userFlag = True self.ui_3.label_9.setText("") else: self.userFlag = False self.ui_3.label_9.setText("用户名须为2-10位") self.ui_3.label_9.setStyleSheet("color: red;") if self.userFlag and self.selectUser(self.userName) != 0: print() self.userFlag = False self.ui_3.label_9.setText("用户名已经存在") self.ui_3.label_9.setStyleSheet("color: red;") else: self.userFlag = True self.ui_3.label_9.setText("") if self.ilegal: self.userFlag = False self.ui_3.label_9.setText("用户名含有非法字符") self.ui_3.label_9.setStyleSheet("color: red;") else: self.userFlag = True print("enen") self.ui_3.label_9.setText("") # 验证密码 if (len(self.password) >= 3 and len(self.password) <= 10): self.pwdFlag = True self.ui_3.label_10.setText("") else: self.pwdFlag = False self.ui_3.label_10.setText("密码至少有3位,最长为10位") self.ui_3.label_10.setStyleSheet("color: red;") # 验证再次输入密码 if self.password == self.passwordAgain and self.passwordAgain != "": self.pwdAgainFlag = True self.ui_3.label_11.setText("") else: self.pwdAgainFlag = False self.ui_3.label_11.setText("两次输入的密码不同") self.ui_3.label_11.setStyleSheet("color: red;") # 验证电话 if len(self.phone) == 11: self.phoneFlag = True self.ui_3.label_12.setText("") else: self.phoneFlag = False self.ui_3.label_12.setText("电话长度应该为11位") self.ui_3.label_12.setStyleSheet("color: red;") # 验证注册码 if self.secretCode == "LKKCJ": self.secretFlag = True self.ui_3.label_13.setText("") else: self.secretFlag = False self.ui_3.label_13.setText("注册码不正确,请联系管理员获取注册码") self.ui_3.label_13.setStyleSheet("color: red;") if self.userFlag and self.secretFlag and self.pwdFlag and self.pwdAgainFlag and self.phoneFlag: # print("成功") self.insertUser(self.userName, self.password, self.phone) QMessageBox().information(self, "提示", "注册成功!", QMessageBox.Yes) self.Dialog.close() self.show() else: QMessageBox().information(self, "提示", "注册失败,请检查填入内容!", QMessageBox.Yes) self.Dialog.show() return 0 except Exception as e: print(e)
def openPopUpError(self, mensaje): msgError = QMessageBox() msgError.setText(mensaje) msgError.setIcon(QMessageBox.Warning) x = msgError.exec_()
def doneInfo(self): if self.userStatus == "Create": uname = self.uNameDat.text() elif self.userStatus == "Update": uname = str(self.uNameCmb.currentText()) ustdyName = self.stdyNameDat.text() if len(uname) > 0 and len(ustdyName) > 0: userFolderLoc = self.cwd + "/userSet/" + uname + "/" parentLoc = userFolderLoc + "dataset/" + ustdyName + "/" userIPLoc = parentLoc + "inphase/" userOPLoc = parentLoc + "outphase/" if self.userStatus == "Create": if not os.path.exists(userFolderLoc): if os.path.exists(self.ipLoc) and os.path.exists( self.opLoc): ipFileList = os.listdir(self.ipLoc) opFileList = os.listdir(self.opLoc) if (len(ipFileList) == len(opFileList)) and ( len(ipFileList) > 0) and (len(opFileList) > 0): ## os.makedirs(userIPLoc) ## os.makedirs(userOPLoc) print("File transfer in progress") shutil.copytree(self.ipLoc, userIPLoc) shutil.copytree(self.opLoc, userOPLoc) print(self.ipLoc, userIPLoc) print(self.opLoc, userOPLoc) try: url = userFolderLoc + uname + "_ffc.json" ROICollection = {} with open(url, 'w') as jsonFile: json.dump(ROICollection, jsonFile) jsonFile.close() except OSError: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("Failed creating the file") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setText("All Folders Sucessfully Created") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("Uneven Inphase/Outphase files") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("No such Inphase/Outphase Folder") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("User Exists, please rename the user") x = msg.exec_() if self.userStatus == "Update": if not os.path.exists(parentLoc): if os.path.exists(self.ipLoc) and os.path.exists( self.opLoc): ipFileList = os.listdir(self.ipLoc) opFileList = os.listdir(self.opLoc) if (len(ipFileList) == len(opFileList)) and ( len(ipFileList) > 0) and (len(opFileList) > 0): ## os.makedirs(userIPLoc) ## os.makedirs(userOPLoc) print(self.ipLoc, userIPLoc) print(self.opLoc, userOPLoc) print("File transfer in progress") shutil.copytree(self.ipLoc, userIPLoc) shutil.copytree(self.opLoc, userOPLoc) msg = QMessageBox() msg.setWindowTitle("Message") msg.setText("All Folders Sucessfully Created") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("Uneven Inphase/Outphase files") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("No such Inphase/Outphase Folder") x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText( "User Study Exists, please rename the user study folder" ) x = msg.exec_() else: msg = QMessageBox() msg.setWindowTitle("Message") msg.setIcon(QMessageBox.Critical) msg.setText("Unfilled fields, Please check") x = msg.exec_()
def openPopUpCheck(self, mensaje): msgGood = QMessageBox() msgGood.setText(mensaje) msgGood.setIcon(QMessageBox.Information) y = msgGood.exec_()
def show_about(self): about = QMessageBox(self) about.setWindowTitle('About') about.setText(deen.constants.about_text) about.resize(100, 75) about.show()
def start_new_window(self, path, uri, app_is_starting=False): '''Raises the window for the wallet if it is open. Otherwise opens the wallet and creates a new window for it''' try: wallet = self.daemon.load_wallet(path, None) except BaseException as e: traceback.print_exc(file=sys.stdout) d = QMessageBox(QMessageBox.Warning, _('Error'), _('Cannot load wallet') + ' (1):\n' + str(e)) d.exec_() if app_is_starting: # do not return so that the wizard can appear wallet = None else: return if not wallet: wizard = InstallWizard(self.config, self.app, self.plugins, None) try: if wizard.select_storage(path, self.daemon.get_wallet): wallet = wizard.run_and_get_wallet() except UserCancelled: pass except GoBack as e: self.print_error( '[start_new_window] Exception caught (GoBack)', e) except (WalletFileException, BitcoinException) as e: traceback.print_exc(file=sys.stderr) d = QMessageBox(QMessageBox.Warning, _('Error'), _('Cannot load wallet') + ' (2):\n' + str(e)) d.exec_() return finally: wizard.terminate() if not wallet: return if not self.daemon.get_wallet(wallet.storage.path): # wallet was not in memory wallet.start_network(self.daemon.network) self.daemon.add_wallet(wallet) try: for w in self.windows: if w.wallet.storage.path == wallet.storage.path: break else: w = self.create_window_for_wallet(wallet) except BaseException as e: traceback.print_exc(file=sys.stdout) d = QMessageBox( QMessageBox.Warning, _('Error'), _('Cannot create window for wallet') + ':\n' + str(e)) d.exec_() if app_is_starting: wallet_dir = os.path.dirname(path) path = os.path.join(wallet_dir, get_new_wallet_name(wallet_dir)) self.start_new_window(path, uri) return if uri: w.pay_to_URI(uri) w.bring_to_top() w.setWindowState(w.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) # this will activate the window w.activateWindow() return w