def main(): app = QApplication(sys.argv) # check if the target in supported try: platform = sys.argv[1] PLATFORMS[platform.replace('.', '_')]() except KeyError: warn_box = QMessageBox() warn_box.setIcon(QMessageBox.Information) warn_box.setText("Unknown platform: {}".format(platform)) warn_box.exec_() return 1 except IndexError: print("You must specify the target in the command line") except NotImplementedError as exc: install_it, = exc.args if query_user(platform): install_it() else: warn_box = QMessageBox() warn_box.setIcon(QMessageBox.Information) warn_box.setText( "You can install the platform later by typing:\n" + str(install_it.__doc__)) warn_box.exec_() else: print("Platform {} is installed".format(platform)) sys.exit(0)
def save(self): mainlog.debug("EditTimeTracksDialog.save()") errors = self.controller.model.validate() if errors: showTableEntryErrorBox(errors) return False tt_start_time = datetime(self.edit_date.year, self.edit_date.month, self.edit_date.day, 6, 0, 0) edited_proxy_tts = self.controller.model.model_to_objects( lambda: TimetrackProxy()) employee_id = self.current_employee_id_selected # for tt in edited_proxy_tts: # mainlog.debug(type(tt)) # mainlog.debug(str(tt)) try: save_proxy_timetracks(edited_proxy_tts, tt_start_time, employee_id) return True except Exception as e: msgBox = QMessageBox(self) msgBox.setIcon(QMessageBox.Critical) msgBox.setText("There was an error while saving your data") msgBox.setInformativeText(str(e)) msgBox.setStandardButtons(QMessageBox.Ok) # msgBox.setDefaultButton(QMessageBox.Ok); ret = msgBox.exec_() return False
def verify_user(self, profileid=None): if profileid is None: profileid=self.current_profileid if len(profileid) == 0: return False try: username = gameslist.username_from_profile_id(profileid) except gameslist.NoSuchProfileError: return False if windows.desura_running(username): return True verify_dialog = QMessageBox() verify_dialog.setText("<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity".format(username)) verify_dialog.setInformativeText("<i>Waiting for Desura sign-in...</i>") verify_dialog.setWindowTitle("Sign into Desura to continue") verify_dialog.setStandardButtons(QMessageBox.Cancel) verify_dialog.setIcon(QMessageBox.Information) verify_dialog.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) desurawaiter = DesuraWaiter(username) desurawaiter.finished.connect(verify_dialog.close) desurawaiter.start() verify_dialog.exec_() if windows.desura_running(username): return True else: desurawaiter.terminate() return False
def error(self, error): if error == QNetworkSession.UnknownSessionError: msgBox = QMessageBox(self.parent()) msgBox.setText('This application requires network access to function.') msgBox.setInformativeText('Press Cancel to quit the application.') msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel) msgBox.setIcon(QMessageBox.Information) msgBox.setDefaultButton(QMessageBox.Retry) ret = msgBox.exec_() if ret == QMessageBox.Retry: QTimer.singleShot(0, self.session.open) elif ret == QMessageBox.Cancel: self.close() elif error == QNetworkSession.SessionAbortedError: msgBox = QMessageBox(self.parent()) msgBox.setText('Out of range of network') msgBox.setInformativeText('Move back into range and press Retry, or press Cancel to quit the application') msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel) msgBox.setIcon(QMessageBox.Information) msgBox.setDefaultButton(QMessageBox.Retry) ret = msgBox.exec_() if ret == QMessageBox.Retry: QTimer.singleShot(0, self.session.open) elif ret == QMessageBox.Cancel: self.close()
def check_editor_preferences(): # get preference values of external app path photo_dir = cmds.optionVar(exists='PhotoshopDir') image_dir = cmds.optionVar(exists='EditImageDir') # if there is no external app, request for an app path if not photo_dir and not image_dir: pref_warn = QMessageBox() pref_warn.setWindowTitle(WINDOW_TITLE) pref_warn.setIcon(QMessageBox.Warning) pref_warn.setText( '<b>Applications for Editing Image Files</b> ' 'is not set in your preferences.<br>' 'Maya needs it to send image in the right Image Editor ' 'instead of file system association.') pref_warn.setInformativeText('Do you want to select an application ?') pref_warn.setStandardButtons(QMessageBox.Yes | QMessageBox.No) pref_warn.setDefaultButton(QMessageBox.Yes) pref_warn.setEscapeButton(QMessageBox.Cancel) ret = pref_warn.exec_() if ret == QMessageBox.Yes: app_path = cmds.fileDialog2( fileFilter='Image editor application (*.exe)', caption='Select image editor application', startingDirectory=os.path.expandvars('%ProgramFiles%'), fileMode=1) if app_path is not None: cmds.optionVar(sv=('PhotoshopDir', app_path[0])) cmds.optionVar(sv=('EditImageDir', app_path[0]))
def error_message(text): errorbox = QMessageBox() errorbox.setWindowIcon(QPixmap("../icons/desuratools_256.png")) errorbox.setWindowTitle("Error") errorbox.setText(text) errorbox.setIcon(QMessageBox.Critical) return errorbox
def displayError(self, message, details=None): msgBox = QMessageBox() msgBox.setText(message) msgBox.setIcon(QMessageBox.Critical) if details != None: msgBox.setDetailedText(details) msgBox.exec_()
def help_gpus(self): msg = QMessageBox() msg.setIcon(QMessageBox.Question) msg.setText("Setting the number of GPUs") msg.setWindowTitle("Number of GPUs") if not self.HAVE_CUDA: info = "No GPUs are detected on your system" else: gpu_id = 0 is_available = True while is_available: try: cmt.cuda_set_device(gpu_id) is_available = True except Exception: is_available = False info = "%d GPU is detected on your system" % (gpu_id + 1) msg.setInformativeText("SpyKING CIRCUS can use several GPUs\n" "either locally or on multiple machine\n" "using MPI (see documentation)" "\n" "\n" "%s" % info) msg.setStandardButtons(QMessageBox.Close) msg.setDefaultButton(QMessageBox.Close) answer = msg.exec_()
def editingFinishedHandler(self): settings = QSettings() old = settings.value("computation/reduce",QtReduceDefaults.REDUCE) new = self.reduceBinary.text() if old == new: return self.reduceBinary.blockSignals(True) tit = "Change Binary?" txt = self.tr("Do you really want to change this setting?") itxt = self.tr("If yes, then the binary ") itxt += '"' + new + '" ' itxt += self.tr("will be used at the next restart.") mbox = QMessageBox(self) mbox.setIcon(QMessageBox.Question) mbox.setWindowModality(Qt.WindowModal) mbox.setWindowTitle(tit) mbox.setText(txt) mbox.setInformativeText(itxt) mbox.setStandardButtons(QMessageBox.Yes|QMessageBox.No) button = mbox.exec_() if button == QMessageBox.Yes: settings.setValue("computation/reduce",new) else: self.reduceBinary.setText(old) self.reduceBinary.blockSignals(False)
def confirmationBox(text,info_text,object_name="confirmationBox"): """ Show a confirmation box to the user. :param text: Summary of the confirmation. :param info_text: Detailed message explaining what to confirm :param object_name: Name for Qt's object. :return: True if the user confirmed. False else. """ box = QMessageBox() box.setObjectName(object_name) box.setWindowTitle(_("Please confirm")) box.setIcon(QMessageBox.Question) _setBoxTexts(box,text,info_text) box.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel); # box.show() # from PySide.QtTest import QTest # from PySide.QtGui import QApplication # QTest.qWaitForWindowShown(box) # QApplication.instance().removePostedEvents() r = box.exec_() == QMessageBox.Ok box.deleteLater() return r
def show_error(self, error): err = QMessageBox() err.setWindowTitle("Join error") err.setText(error) err.setIcon(QMessageBox.Critical) err.setModal(True) err.exec_()
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 verify_user(self, profileid=None): if profileid is None: profileid = self.current_profileid if len(profileid) == 0: return False try: username = gameslist.username_from_profile_id(profileid) except gameslist.NoSuchProfileError: return False if windows.desura_running(username): return True verify_dialog = QMessageBox() verify_dialog.setText( "<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity" .format(username)) verify_dialog.setInformativeText( "<i>Waiting for Desura sign-in...</i>") verify_dialog.setWindowTitle("Sign into Desura to continue") verify_dialog.setStandardButtons(QMessageBox.Cancel) verify_dialog.setIcon(QMessageBox.Information) verify_dialog.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) desurawaiter = DesuraWaiter(username) desurawaiter.finished.connect(verify_dialog.close) desurawaiter.start() verify_dialog.exec_() if windows.desura_running(username): return True else: desurawaiter.terminate() return False
def start(self): incomplete = [] if self.google_radio.isChecked(): if not self.username.text(): incomplete.append(self.username) if not self.password.text(): incomplete.append(self.password) if not self.document_id.text(): incomplete.append(self.document_id) elif not self.csv_file.text(): incomplete.append(self.csv_file) if not self.dbf_file.text(): incomplete.append(self.dbf_file) if len(incomplete) > 0: mbox = QMessageBox(self) mbox.setWindowTitle("Warning, incomplete fields!") mbox.setIcon(QMessageBox.Warning) mbox.setWindowIcon(QIcon.fromTheme("dialog-warning")) mbox.setText("%d fields are incomplete" % len(incomplete)) mbox.exec() for field in self.changed_styles: field.setStyleSheet("") for field in incomplete: field.setStyleSheet("border: 1.5px solid red; border-radius: 5px") self.changed_styles = incomplete.copy() return for field in self.changed_styles: field.setStyleSheet("") self.setStatusTip("Working...") self.working_thread = WorkThread(self) self.working_thread.finished.connect(self.finished_start) self.working_thread.start()
def eventFilter(self, obj, event): if not event: return False if event.type() != QEvent.KeyPress: return False if event.key() not in (Qt.Key_Return, Qt.Key_Enter): return False print "Obj", obj if obj == self.loginEdit: print "Changing focus" self.passwordEdit.setFocus(Qt.OtherFocusReason) elif obj == self.passwordEdit: message = "" icon = None if not (self.loginEdit.text() or self.passwordEdit.text()): message = "Please enter your credentials" icon = QMessageBox.Warning else: message = "Login Successfull" icon = QMessageBox.Information messageBox = QMessageBox() messageBox.setText(message) messageBox.addButton("OK", QMessageBox.AcceptRole) messageBox.setIcon(icon) messageBox.exec_() return False
def onSearch(self): try: limit = int(self.tleLimit.text().strip()) except ValueError: msgBox = QMessageBox() msgBox.setWindowTitle('Invalid upper limit') msgBox.setText('Please enter a valid upper limit') msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() return if limit < self.LOWER_LIMIT: msgBox = QMessageBox() msgBox.setWindowTitle('Invalid upper limit') msgBox.setText('Please enter a valid upper limit') msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() return if self.rbAKS.isChecked(): algorithm = aks elif self.rbMR.isChecked(): algorithm = millerRabbin self.search(algorithm, limit - 1)
def showdialog(x, y): msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText(x) msg.setInformativeText(y) msg.setWindowTitle("Alert") msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) return msg.exec_()
def makeInformationBox(text,info_text = None): warningBox = QMessageBox() warningBox.setWindowTitle(_("Information")) warningBox.setIcon(QMessageBox.Information) warningBox.setText(text); warningBox.setInformativeText(info_text) warningBox.setStandardButtons(QMessageBox.Ok); return warningBox
def yesNoBox(text,info_text,object_name="confirmationBox"): warningBox = QMessageBox() warningBox.setObjectName(object_name) warningBox.setWindowTitle(_("Please confirm")) warningBox.setIcon(QMessageBox.Question) _setBoxTexts(warningBox,text,info_text) warningBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel); return warningBox.exec_()
def makeWarningBox(text,info_text,parent=None): warningBox = QMessageBox(parent) warningBox.setObjectName("warning_box") warningBox.setWindowTitle(_("Warning !")) warningBox.setIcon(QMessageBox.Warning) _setBoxTexts(warningBox,text,info_text) warningBox.setStandardButtons(QMessageBox.Ok); return warningBox
def about(self): msg = ''' About this thing ''' mb = QMessageBox(self) mb.setText(msg.strip()) mb.setIcon(QtGui.QMessageBox.Information) mb.setWindowTitle('About') mb.show()
def help(self): msg = ''' Don't Panic! ''' mb = QMessageBox(self) mb.setText(msg.strip()) mb.setIcon(QtGui.QMessageBox.Information) mb.setWindowTitle('About') mb.show()
def make(title, text, icon=QMessageBox.Critical, buttons=QMessageBox.Ok, default_button=QMessageBox.Ok): ntfctn = QMessageBox() ntfctn.setWindowTitle(title) ntfctn.setText(text) ntfctn.setInformativeText(title) ntfctn.setStandardButtons(buttons) ntfctn.setDefaultButton(default_button) ntfctn.setIcon(icon) return ntfctn.exec_()
def user_choice(text, windowtitle, icon, acceptbutton="OK"): choice_dialog = QMessageBox() choice_dialog.setWindowIcon(QPixmap("../icons/desuratools_256.png")) choice_dialog.setText(text) choice_dialog.setIcon(icon) choice_dialog.setStandardButtons(QMessageBox.Cancel) choice_dialog.setWindowTitle(windowtitle) choice_dialog.addButton(acceptbutton, QMessageBox.AcceptRole) return choice_dialog
def showMessageBox(self, msg): warning = QMessageBox(self) warning.setFont(View.labelsFont()) warning.setStyleSheet('QMessageBox {background: white}') warning.setWindowTitle("Error") warning.setText(msg) warning.setIcon(QMessageBox.Warning) warning.addButton("Ok", QMessageBox.AcceptRole).setFont(View.editsFont()) warning.exec_()
def error(title, text, buttons=QMessageBox.Ok, default_button=QMessageBox.Ok): msgBox = QMessageBox() msgBox.setWindowTitle(title) msgBox.setText(text) msgBox.setInformativeText(title) msgBox.setStandardButtons(buttons) msgBox.setDefaultButton(default_button) msgBox.setIcon(QMessageBox.Critical) return msgBox.exec_()
def accept(self): """Overriding accept slot for plausibility checking.""" if len(self.textStart.text()) > 0 and len(self.textEnd.text()) > 0: super(DialogAddConnection, self).accept() else: msg = QMessageBox() msg.setText(self.tr("Start and End fields have to be filled out")) msg.setIcon(QMessageBox.Critical) msg.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 onExit(self): msgBox = QMessageBox(self) msgBox.setIcon(QMessageBox.Question) msgBox.setWindowTitle(_translate("MainWindow", "Pythonthusiast", None)); msgBox.setText(_translate("MainWindow", "Are you sure you want to quit?", None)) msgBox.setStandardButtons(QMessageBox.No|QMessageBox.Yes) msgBox.setDefaultButton(QMessageBox.Yes) msgBox.exec_ if msgBox.exec_() == QMessageBox.Yes: QtGui.qApp.quit()
def help_file_format(self): msg = QMessageBox() msg.setIcon(QMessageBox.Question) msg.setText("Supported file formats") msg.setWindowTitle("File formats") msg.setInformativeText("\n".join(list_all_file_format())) msg.setStandardButtons(QMessageBox.Close) msg.setDefaultButton(QMessageBox.Close) answer = msg.exec_()
def getWarningMessageBox(text, informative_text): 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) message_box.setIcon(QMessageBox.Critical) return message_box
def updateDialog(self): msgBox = QMessageBox() msgBox.setWindowTitle('Update available') msgBox.setText("There is a new version of AssetJet available.\n" \ "Do you want to download and install?") msgBox.setStandardButtons(QMessageBox.Yes | QtGui.QMessageBox.No) msgBox.setIcon(QMessageBox.Question) msgBox.setDefaultButton(QMessageBox.Yes) msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) reply = msgBox.exec_() return reply
def query_user(platform): msg_box = QMessageBox() msg_box.setWindowTitle("This plaform is not installed!") ok = msg_box.addButton("Install now", QMessageBox.AcceptRole) later = msg_box.addButton("Install later", QMessageBox.RejectRole) msg_box.setEscapeButton(later) msg_box.setDefaultButton(ok) msg_box.setIcon(QMessageBox.Warning) msg_box.setText("Do you want to install target\n{} ?".format(platform)) msg_box.exec_() return msg_box.clickedButton() == ok
def _askAreYouSure(self): dialog_sure = QMessageBox(self) dialog_sure.setWindowTitle(self.tr("Confirm")) dialog_sure.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) dialog_sure.setIcon(QMessageBox.Warning) dialog_sure.setText(self.tr("Are you sure")) result = dialog_sure.exec_() if result == QMessageBox.Ok: return True else: return False
def download_button_pressed(self): if self.ui.textEditDownload is not None: if self.check_url(self.ui.textEditDownload.toPlainText()): #subprocess.Popen(self.return_youtube_dl_cmd()) system(self.return_youtube_dl_cmd()) else: msgBox = QMessageBox() msgBox.setIcon(QMessageBox.Critical) msgBox.setText("Error in URL") msgBox.setInformativeText("Please check the URL you provided.") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec_()
def show_dialog(message, title): msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText(title) msg.setInformativeText(message) msg.setWindowTitle("Something wrong occurred") msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) msg.buttonClicked.connect(QDataViewer.msgbtn) retval = msg.exec_() print "value of pressed message box button:", retval
def __savediag(self): diag = QMessageBox(self) msg = 'Do you want to save the changes in your worksheet "' msg += (self.controller.fileName().split('/')[-1] or 'untitled') + '"?' diag.setText(msg) diag.setInformativeText("Otherwise they will get lost") diag.setIcon(QMessageBox.Warning) diag.setStandardButtons(QMessageBox.StandardButton.Discard | QMessageBox.StandardButton.Cancel | QMessageBox.StandardButton.Save) diag.setWindowModality(Qt.WindowModal) return diag.exec_()
def setToolsSettings(legacy, relative): pref = preferences() if legacy: msgBox = QMessageBox() msgBox.setIcon(QMessageBox.Warning) msgBox.setText( translate( "Path", "Legacy tools are deprecated. They will be removed after version 0.20", )) msgBox.exec_() pref.SetBool(UseLegacyTools, legacy) pref.SetBool(UseAbsoluteToolPaths, relative)
def showReportDialog(self): """Shows a dialog that lets the user generate a report.""" d = DialogCreateReport(self._db, self) ret = d.exec_() if ret == DialogCreateReport.Accepted: cons = d.getSelectedConnections() if len(cons) > 0: self.generateReport(cons) else: msg = QMessageBox() msg.setText(self.tr("No connections selected")) msg.setIcon(QMessageBox.Critical) msg.exec_()
def run(app): # Ask user for AssetJet database location dlgDbLocation = DbLocation() # Hide the 'What's This' question mark dlgDbLocation.setWindowFlags(QtCore.Qt.WindowTitleHint) if dlgDbLocation.exec_(): loc = os.path.join(dlgDbLocation.getText(),'assetjet.db') # create directory if it doesn't exist yet if not os.path.exists(dlgDbLocation.getText()): os.mkdir(dlgDbLocation.getText()) cfg.add_entry('Database', 'DbFileName', loc) # Start download thread if database is not existing yet if not os.path.exists(loc): # Check internet connection from assetjet.util import util if util.test_url('http://finance.yahoo.com'): # Start download thread download = download_data.Downloader(loc) download.daemon = True download.start() # Create download progress dialog dlgProgress = QtGui.QProgressDialog( labelText='Downloading 1 year of daily returns for members of the S&P 500. \n This may take a couple of minutes.\n' , minimum = 0, maximum = 500, flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) dlgProgress.setWindowTitle('Downloading...') dlgProgress.setCancelButton(None) dlgProgress.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) dlgProgress.show() # Update progress bar through signal download.downloaded.connect(dlgProgress.setValue) download.finished.connect(dlgProgress.close) app.exec_() # TODO: let it run in parallel with the local server thread download.wait() else: msgBox = QMessageBox() msgBox.setWindowTitle('No Internet Connection') msgBox.setText("To run AssetJet the first time, you need a working \n" \ "internet connection to download the historical returns.") msgBox.setStandardButtons(QMessageBox.Ok) msgBox.setIcon(QMessageBox.Warning) msgBox.setDefaultButton(QMessageBox.Ok) msgBox.setWindowIcon(QtGui.QIcon(':/Pie-chart.ico')) reply = msgBox.exec_() sys.exit()
def show_about(self): msg = QMessageBox() msg.setIcon(QMessageBox.Question) msg.setText("SpyKING CIRCUS v%s" % circus.__version__) msg.setWindowTitle("About") msg.setInformativeText("Documentation can be found at\n" "http://spyking-circus.rtfd.org\n" "\n" "Open a browser to see the online help?") msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No) msg.setDefaultButton(QMessageBox.No) answer = msg.exec_() if answer == QMessageBox.Yes: QDesktopServices.openUrl(QUrl("http://spyking-circus.rtfd.org"))
def on_override_panels(): """ Override HyperShade and NodeEditor creation callback""" override_info_box = QMessageBox() override_info_box.setWindowTitle(WINDOW_TITLE) override_info_box.setIcon(QMessageBox.Information) override_info_box.setText( 'Buttons will be added to HyperShade toolbar and Node Editor toolbar.<br/>' 'Changes will exists during this session.' ) override_info_box.setInformativeText('<i>Read Help to set this settings permanent</i>') override_info_box.setStandardButtons(QMessageBox.Ok) override_info_box.setDefaultButton(QMessageBox.Ok) override_info_box.exec_() mttOverridePanels.override_panels()
def _removeProfile_Dialog(self): """Runs a prompt dialog. Ask the user if he really wants to remove the selected profile. """ confirmationDialog = QMessageBox() confirmationDialog.setText("Do you really want to remove the selected profile ?") confirmationDialog.setInformativeText("Profile deletion can not be undone") confirmationDialog.setIcon(QMessageBox.Question) confirmationDialog.setStandardButtons(QMessageBox.Yes | QMessageBox.No) confirmationDialog.accepted.connect(self._emitRemoveProfile) ret = confirmationDialog.exec_() if ret==QMessageBox.Yes: self._emitRemoveProfile()
def accept(self): if self.userEdit.text() == "" or self.passwordEdit.text() == "": if self.userEdit.text() == "": self.userEdit.setFocus() else: self.passwordEdit.setFocus() # meldung ausgeben, dass das doof ist so err = QMessageBox() err.setWindowTitle(_("Please provide credentials")) err.setText(_("You need to enter a user name and a password!")) err.setIcon(QMessageBox.Critical) err.setModal(True) err.exec_() else: QCoreApplication.quit()
def requestTabClose(self, tabIndex): tab_to_close = self._tab_widget.widget(tabIndex) response = tab_to_close.stop_spider() if response is True: # now make sure the user doesn't want the data confirm_close = QMessageBox(self) confirm_close.setStandardButtons(QMessageBox.Yes | QMessageBox.No) confirm_close.setIcon(QMessageBox.Warning) confirm_close.setText(self.tr("{0} data may be lost".format(self._tab_widget.tabText(tabIndex)))) confirm_close.setInformativeText(self.tr("Are you sure?")) confirm_close.setWindowTitle(self.tr("Warning")) ret = confirm_close.exec_() if ret == QMessageBox.Yes: self._tab_widget.removeTab(tabIndex) return True else: return False else: return False
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 __binary(self): binary = QSettings().value("computation/reduce", QtReduceDefaults.REDUCE) if not os.path.exists(sys.path[0] + "/" + binary): tit = self.tr("Unable to Connect to Reduce") txt = self.tr("The binary ") txt += '"' + binary + '" ' txt += self.tr("does not exist.") itxt = self.tr("Using the default binary ") itxt += '"' + QtReduceDefaults.REDUCE + '"' itxt += self.tr(". ") itxt += self.tr("Please check the Preferences.") mbox = QMessageBox() mbox.setIcon(QMessageBox.Warning) mbox.setWindowModality(Qt.WindowModal) mbox.setWindowTitle(tit) mbox.setText(txt) mbox.setInformativeText(itxt) mbox.exec_() binary = QtReduceDefaults.REDUCE return binary
def open(self,fileName): tempFileName = fileName if tempFileName == '': tempFileName = self.fileName xmlReader = QtReduceXmlReader(self) newModel = xmlReader.readModel(tempFileName) if not newModel: tit = self.tr("Unable to Open File") txt = self.tr("The file ") txt += '"' + fileName + '" ' txt += self.tr("cannot be opened.") mbox = QMessageBox(self) mbox.setIcon(QMessageBox.Information) mbox.setWindowModality(Qt.WindowModal) mbox.setWindowTitle(tit) mbox.setText(txt) mbox.exec_() return False self.removeRows(0,self.rowCount()) self.insertRows(0,len(newModel)) for row in range(len(newModel)): self.setData(self.index(row,0),newModel[row],self.RawDataRole) return True
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 __abortComputationBox(self): tit = self.tr("Aborting Batch Computation") txt = self.tr("Reduce is currently evaluating several groups in " "batch. Do you want to interrupt only the current " "computation or all?") diag = QMessageBox(self.model.controller.mainWindow) diag.setWindowTitle(tit) diag.setIcon(QMessageBox.Question) diag.setText(txt) abortAll = diag.addButton("Abort All",QMessageBox.YesRole) abortCurrent = diag.addButton("Abort Current",QMessageBox.YesRole) cancel = diag.addButton(QMessageBox.StandardButton.Cancel) diag.setDefaultButton(abortAll) diag.setEscapeButton(cancel) diag.setWindowModality(Qt.WindowModal) diag.exec_() ans = diag.clickedButton() if ans == abortAll: return 'all' elif ans == abortCurrent: return 'current' elif ans == cancel: return 'cancel' traceLogger.critical("unidentifiable button %s" % ans)
def errorBox(text): logging.error(text) msgBox = QMessageBox() msgBox.setText('<span style="color: white;">' + text + '</span>') msgBox.setIcon(QMessageBox.Critical) msgBox.exec_()