def finished_start(self): self.save_settings() self.start_button.setText("Start") self.setEnabled(True) self.setStatusTip("Ready") if self.working_thread.mbox: data = self.working_thread.mbox mbox = QMessageBox(self) mbox.setWindowTitle(data[0]) mbox.setIcon(data[1]) mbox.setWindowIcon(data[2]) mbox.setText(data[3]) if data[4]: mbox.setDetailedText(data[4]) mbox.exec() # TODO: NEED TO FIX! if self.working_thread.updates: d = TableDialog(self.working_thread.updates, self.working_thread.streetdb) d.exec() else: mbox = QMessageBox(self) mbox.setWindowTitle("Done!") if self.working_thread.updates: mbox.setText("Program is done! {} updated!" .format(len(self.working_thread.updates))) else: mbox.setText("Program is done! Everything was up to date!") mbox.setIcon(QMessageBox.Information) mbox.exec()
def displayError(self, message, details=None): msgBox = QMessageBox() msgBox.setText(message) msgBox.setIcon(QMessageBox.Critical) if details != None: msgBox.setDetailedText(details) msgBox.exec_()
def _detail_error_msg(self, title, error_text, error_detailed_text): msg = QMessageBox(self.new_wallet_ui) msg.setWindowTitle(title) msg.setText(error_text) msg.setInformativeText("Detailed error information below:") msg.setDetailedText(error_detailed_text) msg.setIcon(QMessageBox.Critical) msg.setStandardButtons(QMessageBox.Ok) msg.exec_()
def copy_details_box(icon, title, text, details): """Shows a QMessageBox with a detail box and a 'Copy details' button """ box = QMessageBox(icon, title, text) box.setDetailedText(details) copy_button = box.addButton('Copy details', QMessageBox.HelpRole) # QMessageBox connects the clicked signal of the new button to a close # action - disconnect this and connect to copy_to_clipboard copy_button.clicked.disconnect() copy_button.clicked.connect(partial(copy_to_clipboard, details)) box.addButton('OK', QMessageBox.AcceptRole) return box.exec_()
def show_alert_dialog(exception): msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setText("Something wrong occurred") msg.setInformativeText(str(exception.message)) msg.setWindowTitle("Something wrong occurred") msg.setDetailedText("The details are as follows:\n" + exception.message) print "The details are as follows:\n" + exception.message msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msg.buttonClicked.connect(QDataViewer.msgbtn) retval = msg.exec_() print "value of pressed message box button:", retval
def exception(parent, ex, buttons=QMessageBox.Ok, defaultButton=QMessageBox.NoButton): title = type(ex).__name__ message = str(ex) tb = StringIO() if hasattr(ex, '__traceback__'): exc_traceback = ex.__traceback__ else: exc_traceback = sys.exc_info()[2] traceback.print_tb(exc_traceback, file=tb) msgbox = QMessageBox(QMessageBox.Icon.Critical, title, message, buttons, parent) msgbox.setDefaultButton(defaultButton) msgbox.setDetailedText(tb.getvalue()) msgbox.exec_()
def removeUnusedClips(self): # Get selected items item = self.selectedItem proj = item.project() # Build a list of Projects SEQS = hiero.core.findItems(proj, "Sequences") # Build a list of Clips CLIPSTOREMOVE = hiero.core.findItems(proj, "Clips") # For each sequence, iterate through each track Item, see if the Clip is in the CLIPS list. # Remaining items in CLIPS will be removed for seq in SEQS: # Loop through selected and make folders... for track in seq: for trackitem in track: if trackitem.source() in CLIPSTOREMOVE: CLIPSTOREMOVE.remove(trackitem.source()) # If there are no Clips to remove, return if len(CLIPSTOREMOVE) == 0: return # Present Dialog Asking if User wants to remove Clips msgBox = QMessageBox() msgBox.setWindowTitle("Remove Unused Clips") msgBox.setText("Remove %i unused Clips from Project %s?" % (len(CLIPSTOREMOVE), proj.name())) msgBox.setDetailedText("Remove:\n %s" % (str(CLIPSTOREMOVE))) msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msgBox.setDefaultButton(QMessageBox.Ok) ret = msgBox.exec_() if ret == QMessageBox.Cancel: return elif ret == QMessageBox.Ok: BINS = [] with proj.beginUndo('Remove Unused Clips'): # Delete the rest of the Clips for clip in CLIPSTOREMOVE: BI = clip.binItem() B = BI.parentBin() BINS += [B] B.removeItem(BI)
def stop_spider(self): if self._spider_id is None: # do not stop the the spider before receiving data pass else: if self._queue_check_timer.isActive(): confirm_stop = QMessageBox(self) confirm_stop.setIcon(QMessageBox.Warning) confirm_stop.setStandardButtons(QMessageBox.Yes | QMessageBox.No) confirm_stop.setText(self.tr("Scraping process still running")) confirm_stop.setDetailedText(self.tr("Are you sure you want to stop it?")) confirm_stop.setWindowTitle(self.tr("Spider still running")) ret = confirm_stop.exec_() if ret == QMessageBox.Yes: self.stop_spider_signal.emit(self._spider_id) return True else: return False # I won't whip you if you stop it accidentally else: return True # already over
def removeUnusedClips(self) : # Get selected items item = self.selectedItem proj = item.project() # Build a list of Projects SEQS = hiero.core.findItems(proj,"Sequences") # Build a list of Clips CLIPSTOREMOVE = hiero.core.findItems(proj,"Clips") # For each sequence, iterate through each track Item, see if the Clip is in the CLIPS list. # Remaining items in CLIPS will be removed for seq in SEQS: # Loop through selected and make folders... for track in seq: for trackitem in track: if trackitem.source() in CLIPSTOREMOVE: CLIPSTOREMOVE.remove(trackitem.source()) # If there are no Clips to remove, return if len(CLIPSTOREMOVE)==0: return # Present Dialog Asking if User wants to remove Clips msgBox = QMessageBox() msgBox.setWindowTitle("Remove Unused Clips"); msgBox.setText("Remove %i unused Clips from Project %s?" % (len(CLIPSTOREMOVE),proj.name())); msgBox.setDetailedText("Remove:\n %s" % (str(CLIPSTOREMOVE))); msgBox.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel); msgBox.setDefaultButton(QMessageBox.Ok); ret = msgBox.exec_() if ret == QMessageBox.Cancel: return elif ret == QMessageBox.Ok: BINS = [] with proj.beginUndo('Remove Unused Clips'): # Delete the rest of the Clips for clip in CLIPSTOREMOVE: BI = clip.binItem() B = BI.parentBin() BINS+=[B] B.removeItem(BI)
def getCriticalMessageBox(text, informative_text, detailed_text=None): message_box = QMessageBox() h_spacer = QSpacerItem(500, 0) gl = message_box.layout() gl.addItem(h_spacer, gl.rowCount(), 0, 1, gl.columnCount()) message_box.setWindowTitle(constants.APPLICATION_TITLE) message_box.addButton(QMessageBox.Ok) message_box.setText('<b>{}'.format(text)) message_box.setInformativeText(informative_text) if detailed_text is not None: message_box.setDetailedText(detailed_text) else: excType, excValue, tracebackobj = sys.exc_info() tb_list = traceback.format_exception(excType, excValue, tracebackobj) tb_str = ''.join(tb_list) message_box.setDetailedText(tb_str) message_box.setIcon(QMessageBox.Critical) return message_box
def showVersionUpdateReportFromShotManifest(self,sequenceShotManifest): """This just displays an info Message box, based on a Sequence[Shot] manifest dictionary""" # Now present an info dialog, explaining where shots were updated updateReportString = "The following Versions were updated:\n" for seq in sequenceShotManifest.keys(): updateReportString+="%s:\n Shots:\n" % (seq.name()) for shot in sequenceShotManifest[seq]: updateReportString+=' %s\n (New Version: %s)\n' % (shot.name(), shot.currentVersion().name()) updateReportString+='\n' infoBox = QMessageBox(hiero.ui.mainWindow()) infoBox.setIcon(QMessageBox.Information) if len(sequenceShotManifest)<=0: infoBox.setText("No Shot Versions were updated") infoBox.setInformativeText("Clip could not be found in any Shots in this Project") else: infoBox.setText("Versions were updated in %i Sequences of this Project." % (len(sequenceShotManifest))) infoBox.setInformativeText("Show Details for more info.") infoBox.setDetailedText(updateReportString) infoBox.exec_()
def _closeOntology_(self, ontology, ontologyMenu): """ QT Slot which handles the close ontology action when it is triggered. Parameter : - ontology : The ontology to delete. - ontologyMenu : The QMenu where the ontology could be managed. It should be remove too. """ changed, diff = self.ontologyChanged(ontology) if changed: msgBox = QMessageBox(self) msgBox.setText("The ontology file \"" + ontology.name + "\" has been modified.") msgBox.setInformativeText("Do you want to save your changes?") msgBox.setDetailedText(diff) msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard) msgBox.setDefaultButton(QMessageBox.Save) ret = msgBox.exec_() if ret == QMessageBox.Save: ontology.save() self.removeOntology(ontology) # remove ontology in active ones. ontologyMenu.deleteLater()
def closeEvent(self, event): """ Called when the main window is closing, and meaning that the application is exiting. The application then saves the layout, and then check for unsaved documents. Override from QWidget. """ self.userLayout.saveLayout() # check for unsaved files. for o in PySUMOWidget.IA.ontologies: changed, diff = self.ontologyChanged(o) if changed: msgBox = QMessageBox(self) msgBox.setText("The ontology file \"" + o.name + "\" has been modified.") msgBox.setInformativeText("Do you want to save your changes?") msgBox.setDetailedText(diff) msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard) msgBox.setDefaultButton(QMessageBox.Save) ret = msgBox.exec_() if ret == QMessageBox.Save: o.save() super(MainWindow, self).closeEvent(event)