def btn_reset_clicked(self): msg_box = QtWidgets.QMessageBox(self) msg_box.setWindowTitle("Reset chain") msg_box.setText("Are you sure you want to clear all Tripwire data?") msg_box.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msg_box.setDefaultButton(QtWidgets.QMessageBox.No) ret = msg_box.exec_() if ret == QtWidgets.QMessageBox.Yes: self.nav.reset_chain() self._trip_message("Not connected to Tripwire, yet", MainWindow.MSG_INFO)
def infomsgbox(self, infomsg, detailedmsg="", iserror=False): msg = QtWidgets.QMessageBox() msg.setFixedSize(QtCore.QSize(450, 350)) msg.setWindowTitle("Matrix Generation") if iserror: msg.setIcon(QtWidgets.QMessageBox.Warning) else: msg.setIcon(QtWidgets.QMessageBox.Information) msg.setText(infomsg) msg.setInformativeText(detailedmsg) msg.exec_()
def btnRegisterReadClicked(self): register_address = Widget.window.txtRegisterAddress.text() try: if register_address.startswith("0x"): register_address = register_address.replace("0x", "") int(register_address, 16) except Exception as e: msgBox = QtWidgets.QMessageBox() msgBox.setText('Invalid register address!') msgBox.exec_() return self.jtag_configuration_engine.readRegister(register_address) return
def keyPressEvent(self, e): key = e.key() if key == QtCore.Qt.Key_F1: self.selected = self.novelBox.textCursor().selectedText() self.text = str(zdic_lookup.get_page(self.selected)) print(self.text) ok = QtWidgets.QMessageBox(self) # self.addToFlashButton = QtWidgets.QMessageBox.standardButton # self.addToFlashButton # self.addToFlashButton.pressed.connect(self.addTermToFlashcards) ok.setText(self.text) # ok.addButton(self.addToFlashButton) ok.show()
def deedLocalhost(self): show_name = os.environ.get("SHOW", "pipe") try: _show = opencue.api.findShow(show_name) except Exception as e: msg = QtWidgets.QMessageBox(self) msg.setText("Error %s, please setshot and rerun cuetopia", e) msg.exec_() return user = os.environ["USER"] try: owner = opencue.api.getOwner(user) except opencue.EntityNotFoundException as e: # Owner does not exist owner = _show.createOwner(user) hostname = gethostname() try: host = opencue.api.findHost(hostname.rsplit(".", 2)[0]) owner.takeOwnership(host.data.name) self.__select_host.addItem(host.data.name) self.__lba_group.setDisabled(False) if self.__deed_button: self.__deed_button.setVisible(False) if self.__msg_widget: self.__msg_widget.setVisible(False) self.__deed_button = None self.__msg_widget = None self.hosts_changed.emit() except Exception as e: msg = QtWidgets.QMessageBox(self) msg.setText("Unable to determine your machine's hostname. " + "It is not setup properly for local booking") msg.exec_()
def Activated(self): selection = FreeCADGui.Selection.getSelection() if len(selection) != 0: obj_select = selection[0] # .Name print_export(obj_select) else: message = QtWidgets.QMessageBox() message.setIcon(QtWidgets.QMessageBox.Icon.Critical) message.setWindowTitle('Error') message.setText("Please, select a object") message.setStandardButtons(QtWidgets.QMessageBox.Ok) message.setDefaultButton(QtWidgets.QMessageBox.Ok) message.exec_()
def show_help(self): """ Show little help dialog box about how to use HelpCardMaker """ message = "Houdini Help card maker, version:" + VERSION + "\n\n" message += "Created by Guillaume Jobst\n\n" message += "More infos:\[email protected]\nwww.cgtoolbox.com" w = QtWidgets.QMessageBox() w.setStyleSheet(hou.ui.qtStyleSheet()) w.setWindowIcon(get_icon("help")) w.setWindowTitle("Help") w.setText(message) w.exec_()
def confirm_(title="Confirmation:", options="Click [Ok] to proceed or [Cancel]"): """Confirm or cancel operation - returns True or False""" msg_box = W.QMessageBox() msg_box.setWindowTitle(title) if options: msg_box.setText(options.ljust(60)) msg_box.addButton(W.QMessageBox.Ok) msg_box.addButton(W.QMessageBox.Cancel) msg_box.setIcon(W.QMessageBox.Question) if msg_box.exec_() == W.QMessageBox.StandardButton.Ok: return True return False
def __call__(self): ''' open qt dialog box for rename shader ''' msgBox = QtWidgets.QMessageBox(self.observer.ui) msgBox.setWindowTitle(dlg_title) msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) msgBox.setStyleSheet("background: rgba(40, 40, 40, 255);") msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setText(dlg_msg) choice = msgBox.exec_() if choice == QtWidgets.QMessageBox.Ok: self.shader.delete() self.observer.main.categoryCC.refreshCategoryTab()
def save_to_cloud(self): if not self.file_buttons.state == cirrus_objects.FileState.LOCAL_ONLY: if not self.file_buttons.is_locked == cirrus_objects.FileLockState.SELF_LOCKED: QtWidgets.QMessageBox.warning(self, "Error", "Can't save object to cloud, you have to lock the file first") return if not os.path.exists(self.local_file_path): QtWidgets.QMessageBox.critical(self, "Error", "File not found: " + self.local_file_path) return confirm_msg = "Send file: {0} on the cloud ?\nSize: {1:.2f} Mb".format(self.local_file_path, self.local_file_size) ask = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question, "Confirm", confirm_msg, buttons = QtWidgets.QMessageBox.StandardButton.Yes|\ QtWidgets.QMessageBox.StandardButton.No, parent=self) geo = ask.frameGeometry() ask.move(QtGui.QCursor.pos() - ( geo.topRight() * 3 )) ask.setStyleSheet("""QMessageBox{background-color: #3e5975} QFrame{background-color: #3e5975} QLabel{background-color: #3e5975}""") if ask.exec_() == QtWidgets.QMessageBox.StandardButton.No: return ask_msg = cirrus_widgets_inputs.MessageInput(parent=self) ask_msg.move(QtGui.QCursor.pos() - ( geo.topRight() * 3 )) ask_msg.exec_() if ask_msg.cancel: return msg = ask_msg.message if msg.strip() == "": return keep_locked = ask_msg.keep_locked self.activity_progress.setVisible(True) s = os.path.getsize(self.local_file_path) self.activity_progress.setMaximum(s) self.worker = cirrus_threading.FileIOThread(self.local_file_path, message=msg, keep_locked=keep_locked) self.worker.signals.start_sgn.connect(self.start_progress) self.worker.signals.end_sgn.connect(self.end_progress) self.worker.signals.update_progress_sgn.connect(self.update_progress) QtCore.QThreadPool.globalInstance().start(self.worker)
def export(self): ''' Export to Flask app via requests module and HTTP Basic auth ''' ENDPOINT = '{}/api/assets/upload'.format(config.Config.APP_HOST_NAME) current_item = self.list_widget.currentItem() if current_item: name = current_item.text() else: return logger.debug('Connecting to {}'.format(ENDPOINT)) # prepare payload data = { "name": name, "area": "Model", "author_name": config.Config.MY_NAME_IN_APP, "tags": "maya, scene", } files = {} logger.debug('Sending data: {}'.format(data)) # prepare files to 'files' part of request if current_item.info['screenshot'] and os.path.exists( current_item.info['screenshot']): logger.debug('Sending file: {}'.format( current_item.info['screenshot'])) files['screenshot_file'] = open(current_item.info['screenshot'], 'rb') if current_item.info['path'] and os.path.exists( current_item.info['path']): logger.debug('Sending file: {}'.format(current_item.info['path'])) files['asset_file'] = open(current_item.info['path'], 'rb') # use HTTP Basic auth for connection response = requests.post(ENDPOINT, data=data, files=files, auth=(config.Config.USER_NAME, config.Config.PASSWORD)) msg_box = QtWidgets.QMessageBox(self) if response.status_code == 200: msg_box.setText("File exported to S3 successfully!") msg_box.setIcon(QtWidgets.QMessageBox.Information) else: json_data = json.loads(response.text) msg_box.setText("File export to S3 failed.\n\n\n" + json_data['message']) msg_box.setIcon(QtWidgets.QMessageBox.Warning) msg_box.setWindowTitle("Export to S3") msg_box.exec_()
def create_widgets(self): """ Creating all the widgets used in the MainWindow """ self.btn_createNote = QtWidgets.QPushButton("Créer une note") self.lw_notes = QtWidgets.QListWidget() self.te_contenu = QtWidgets.QTextEdit() self.splitter = QtWidgets.QSplitter() self.confirmationBox = QtWidgets.QMessageBox(parent=self) self.confirmationBox.setText("Suppression !") self.confirmationBox.setInformativeText( "Les notes sélectionnées seront supprimées, poursuivre ?") self.btn_yes = self.confirmationBox.addButton( "Oui", QtWidgets.QMessageBox.ActionRole) self.btn_no = self.confirmationBox.addButton( "Non", QtWidgets.QMessageBox.ActionRole) self.rc_menu = QtWidgets.QMenu() self.rc_menu_add = QtWidgets.QAction("Ajouter une note") self.rc_menu_delete = QtWidgets.QAction("Supprimer") self.rc_menu_rename = QtWidgets.QAction("Renommer") self.rc_menu_colors = QtWidgets.QMenu("Couleur") self.colors = glob(os.path.join( self.ctx.get_resource(), "*.svg")) # Getting the icons' pathnames self.rc_menu_color_choices = {} for color in self.colors: number = os.path.basename(color)[0:2] self.rc_menu_color_choices[QtWidgets.QAction( icon=QtGui.QIcon(color))] = COLORS[number][1] # rc_menu_color_choices = {RED_MENU_ACTION: RED_COLOR_CODE), PINK_MENU_ACTION: PINK_COLOR_CODE,..} self.fatal_error_message = QtWidgets.QMessageBox() self.fatal_error_message.setWindowTitle("Oops !") self.fatal_error_message.setText("Veuillez redémarrer l'application")
def validate(self, exportItems): """Validate settings in UI. Return False for failure in order to abort export.""" if not NimProcessorUIBase.validate(self, exportItems): return False isValid, message = self._preset.isValid() if not isValid: msgBox = QtWidgets.QMessageBox() msgBox.setTextFormat(QtCore.Qt.RichText) result = msgBox.information(None, "Export", message, QtWidgets.QMessageBox.Ok) return False invalidItems = [] # Look for selected items which arent of the correct type for item in exportItems: if not item.sequence() and not item.trackItem(): invalidItems.append( item.item().name() + " <span style='color: #CC0000'>(Not a Sequence)</span>") # Found invalid items if invalidItems: # Show warning msgBox = QtWidgets.QMessageBox() msgBox.setTextFormat(QtCore.Qt.RichText) result = msgBox.information( None, "Export", "The following items will be ignored by this export:<br/>%s" % str("<br/>".join(invalidItems)), QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel) # Continue if user clicks OK return result == QtWidgets.QMessageBox.Ok # Check existing versions for any of the selected items. if not self._checkExistingVersions(exportItems): return False return True
def pack(self): ''' 消息处理 ''' msg = {} msg["auth"] = self.auth modes = ["broadcast", "solo", "list all users"] mode, ok = QtWidgets.QInputDialog().getItem(self, "mode", "mode: ", modes, 0, False) if ok: if mode == "solo": msg["type"] = "solo" who, ok = QtWidgets.QInputDialog().getText(self, "to who", "to: ", QtWidgets.QLineEdit.Normal, None) if ok: msg["toWho"] = who else: msg["type"] = "" if self.inputEdit.toPlainText() == "": msg["type"] = "" warning = QtWidgets.QMessageBox() warning.setText("say something") warning.exec_() else: msg["text"] = self.inputEdit.toPlainText() elif mode == "broadcast": msg["type"] = "broadcast" if self.inputEdit.toPlainText() == "": msg["type"] = "" warning = QtWidgets.QMessageBox() warning.setText("say something") warning.exec_() else: msg["text"] = self.inputEdit.toPlainText() elif mode == "list all users": msg["type"] = "show" msg = json.dumps(msg) msg = bytes(msg, encoding='utf-8') self.inputEdit.clear() return msg
def checkAndRun(self): if self.logsPath != "" and self.outputLE.text() != "": if self.algComboBox.currentText() == "alpha": alpha = AlphaAlgorithm() alpha.read_log_file(self.logsPath[0]) alpha.build_model() alpha.create_graph(self.outputLE.text()) elif self.algComboBox.currentText() == "heuristic_miner": hminer = HeuristicMiner(float(self.heuristicThreshold1.text()), float(self.heuristicThreshold2.text()), float(self.heuristicThreshold3.text()), float(self.heuristicThreshold4.text())) hminer.read_log_file(self.logsPath[0]) hminer.build_model() hminer.create_graph(self.outputLE.text()) else: dialog = QtWidgets.QMessageBox() dialog.setText("Wybierz algorytm") dialog.exec_() else: dialog = QtWidgets.QMessageBox() dialog.setText("Wybierz scieżki logów i nazwe outputu") dialog.exec_()
def confirm(self, title: str, body: str, firstButton: QtWidgets.QAbstractButton, secondButton: QtWidgets.QAbstractButton, defaultButton: QtWidgets.QAbstractButton) -> QtWidgets.QAbstractButton: msg = QtWidgets.QMessageBox(self) log("[ WARN ] "+body) if(os.path.exists(getPath('zip.ico'))): msg.setIconPixmap(QtGui.QPixmap(getPath("zip.ico")).scaledToHeight(96, QtCore.Qt.SmoothTransformation)) else: msg.setIcon(QtWidgets.QMessageBox.Warning) msg.setWindowTitle(title) msg.setText(body) msg.addButton(firstButton) msg.addButton(secondButton) msg.setDefaultButton(defaultButton) msg.exec_() return msg.standardButton(msg.clickedButton())
def set_default_sequence_framerate(self, event): ''' Compares the frame rate of the shotgun project (see overview page of the project in SG) with the default sequence frame rate in the NukeStudio project for new projects, silently sets the default frame rate to shotgun's framerate for existing projects, compares and warns user to allow him to correct the framerate ''' project = event.project current_nukestudio_fps = project.framerate( ) # returns either integer or float shotgun_project_fps = self.shotgun_project_fps if not shotgun_project_fps: # Shotgun project framerate is not defined, skip return None if event.type == "kAfterNewProjectCreated": project.setFramerate(shotgun_project_fps) if event.type == "kAfterProjectLoad": if str(current_nukestudio_fps) == "Invalid": project.setFramerate(shotgun_project_fps) elif current_nukestudio_fps != shotgun_project_fps: msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setWindowTitle("Project Settings : Frame rate problem") msgBox.setText( "Default sequence frame rate is {}fps.\nFrame rate for this Shotgun project ({}) is {}fps.\nChange default frame rate of sequences ?\n\nNote : This will only affect new sequences.\nExisting sequences will not be modified" .format(current_nukestudio_fps, self.context.project['name'], shotgun_project_fps)) change_button = msgBox.addButton( "Change to {}fps".format(shotgun_project_fps), QtWidgets.QMessageBox.AcceptRole) cancel_button = msgBox.addButton( "Keep {}fps".format(current_nukestudio_fps), QtWidgets.QMessageBox.RejectRole) msgBox.exec_() if msgBox.clickedButton() == change_button: project.setFramerate(shotgun_project_fps) self.log_debug( "Changing the default seq framerate from {} to {}". format(current_nukestudio_fps, shotgun_project_fps)) print('change_button') if msgBox.clickedButton() == cancel_button: pass
def on_sequence_loading_failed(self): """ Callback function for the case that loading of a sequence failed. Resets the cursor and prints and error box. :return: """ QtWidgets.QApplication.restoreOverrideCursor() msg_box = QtWidgets.QMessageBox() msg_box.setIcon(QtWidgets.QMessageBox.Critical) msg_box.setText("Unable to open file.") msg_box.setWindowTitle("File Error") msg_box.setStandardButtons(QtWidgets.QMessageBox.Ok) msg_box.buttonClicked.connect(lambda: msg_box.close) msg_box.exec()
def print_chain(self): if blockchain: chain_window = Chain_Dialog() chain_window.exec_() else: msg = QtWidgets.QMessageBox() msg.setIcon(QtWidgets.QMessageBox.Warning) msg.setText( "No chain: you need to mine the first block or get the chain " "from another peer before seeing the chain") msg.setWindowTitle("No blockchain") msg.exec_()
def warn_user(cls, title, message): """ this method displays a warning to the user :param title: The title of the message box :type: str :param message: a message for the user :type: str """ message_box = QtWidgets.QMessageBox() message_box.setText(message) message_box.setWindowTitle(title) message_box.exec_()
def CloseDialog(self): if self.btnClose.isEnabled() is False: text = "<b>WARNING:</b> If you close this window while a firmware update is still running, it might leave the device in an unbootable state.<br><br>Are you sure you want to close this window?" msgbox = QtWidgets.QMessageBox( parent=self, icon=QtWidgets.QMessageBox.Warning, windowTitle="FlashGBX", text=text, standardButtons=QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msgbox.setDefaultButton(QtWidgets.QMessageBox.No) answer = msgbox.exec() if answer == QtWidgets.QMessageBox.No: return False return True
def closeEvent(self, event): if self.maybe_save: msgBox = QtWidgets.QMessageBox() msgBox.setText("Quit program without saving.") msgBox.setInformativeText( "Do you really want to quit? Unsaved changes maybe lost.") msgBox.setStandardButtons( QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msgBox.setDefaultButton(QtWidgets.QMessageBox.No) ret = msgBox.exec_() if ret == QtWidgets.QMessageBox.No: event.ignore() else: event.accept()
def Ok_pressed(self): # set values to defaults if not changed if len(self.path) > 1: self.resolution_x = self.ui_resolution_x_2.text() self.resolution_y = self.ui_resolution_y_2.text() self.FPS = self.le_fps_2.text() self.shot_number = self.ui_shotNumber_2.text() create_folders(self.shot_number, self.path) store_data(self.path, self.shot_number, [self.resolution_x, self.resolution_y], self.FPS, self.client_name, self.project_name) save_project_info(self.project_name, self.path) else: msgBox = QtWidgets.QMessageBox() msgBox.setText("Please specify a project folder") msgBox.exec_()
def delete_item(self): index = self.pis_treeview.selectedIndexes()[0] row = index.row() ip = self.pis_model.item(row, 1).text() try: self.cursor.execute("DELETE FROM pis WHERE ip = ? LIMIT 1", (ip, )) self.conn.commit() except sqlite3.Error as error: msgbox = QtWidgets.QMessageBox() msgbox.setText(str(error)) msgbox.exec_() finally: self.populate_network_view()
def actionAbout(self) -> QtWidgets.QDialog: dlg = QtWidgets.QMessageBox( QtWidgets.QMessageBox.Information, "About pew²", ("Import, process and export of LA-ICP-MS data.\n" f"Version {__version__}\n" "Developed by the Atomic Medicine Initiative.\n" "https://github.com/djdt/pewpew"), parent=self, ) if self.windowIcon() is not None: dlg.setIconPixmap(self.windowIcon().pixmap(64, 64)) dlg.open() return dlg
def _delete_current_script(self): dialog = QtWidgets.QMessageBox( QtWidgets.QMessageBox.Question, 'Delete {} ?'.format(self._current_script.name), ('{} will be delete.\nThis action cannot be cancelled.\n' 'Are you sure to continue ?').format( self._current_script._jsonpath), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) if dialog.exec_() == 65536: # find the constant with this value return self._view.remove_script(self._current_script) self._current_script.delete()
def closeEvent(self, cevent): if not self.shot.isRunning() or self.shot.isFinished(): cevent.accept() else: msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setWindowIcon(QtGui.QIcon(":/ico/" + self.APPNAME + ".ico")) msgBox.setText(self.tr("ShotList is running")) msgBox.setInformativeText( self.tr("Can't close ShotList while current task.")) msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok) msgBox.exec_() cevent.ignore()
def open_file(self): if len(self.file_absolute_path) > 0: if not hou.hipFile.hasUnsavedChanges(): hou.hipFile.load(self.file_absolute_path) print("\n =============================\n") print ("Opening file at: " + self.file_absolute_path) print("\n =============================\n") else: msgBoxSave = QtWidgets.QMessageBox(self) msgBoxSave.setText("Save your changes first") msgBoxSave.exec_() else: print("Please select a file")
def change(self): # TODO: button change pressed __tol = self.tolerance_value.text() if self.tolerance_value.text() != TOL else None __stol = self.small_tolerance_value.text() if self.small_tolerance_value.text() != STOL else None __mtol = self.metric_tolerance_value.text() if self.metric_tolerance_value.text() != MTOL else None __mltol = self.metric_lower_tolerance_value.text() if self.metric_lower_tolerance_value.text() != MLTOL else None change_configuration_file(_tol=__tol, _stol=__stol, _mtol=__mtol, _mltol=__mltol) message = QtWidgets.QMessageBox() message.setIcon(QtWidgets.QMessageBox.Icon.Information) message.setWindowTitle('Configuration saved') message.setText("Configuration saved") message.setStandardButtons(QtWidgets.QMessageBox.Ok) message.setDefaultButton(QtWidgets.QMessageBox.Ok) message.exec_()
def certificateError(self, error): # Ask the user if we should proceed with an invalid certifacate. msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Warning) msgBox.setWindowTitle("3DfindIT") msgBox.setText( "An invalid certificate was encountered while loading 3DFindIT. Proceed anyway?" ) msgBox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msgBox.setWindowModality(QtCore.Qt.ApplicationModal) if (msgBox.exec_() == QtWidgets.QMessageBox.Yes): return True return False