我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用PyQt4.QtGui.QMessageBox()。
def applyRegex (self): requests=self.controller.getRequests() if str(self.substSrcEdit.text()): indexes=[] n=self.tableWidget.rowCount() for i in range(n): if not self.tableWidget.isRowHidden(i): indexes.append(i) for i in indexes: try: requests[i].Substitute(str(self.substSrcEdit.text()),str(self.substDstEdit.text())) self.tableWidget.setItem(i,1,QtGui.QTableWidgetItem(requests[i].urlWithoutPath)) self.tableWidget.setItem(i,2,QtGui.QTableWidgetItem(requests[i].pathWithVariables)) if requests[i]["Cookie"]: self.tableWidget.setItem(i,3,QtGui.QTableWidgetItem(requests[i]["Cookie"])) except Exception,a: mb = QtGui.QMessageBox ("Error in substitution","ERROR !",QtGui.QMessageBox.Warning,QtGui.QMessageBox.Ok,0,0) mb.exec_() return self.updateAllStats()
def show_bucket_crated_successfully(self, bucket_name): msgBox = QtGui.QMessageBox( QtGui.QMessageBox.Information, 'Success', 'Bucket \'%s\' was created successfully!' % bucket_name, QtGui.QMessageBox.Ok) msgBox.exec_()
def open_mirrors_list_window(self): self.current_bucket_index = self.file_manager_ui.bucket_select_combo_box.currentIndex() self.current_selected_bucket_id = self.bucket_id_list[self.current_bucket_index] tablemodel = self.file_manager_ui.files_list_tableview.model() rows = sorted(set(index.row() for index in self.file_manager_ui.files_list_tableview.selectedIndexes())) i = 0 for row in rows: self.__logger.info('Row %d is selected' % row) index = tablemodel.index(row, 2) # get file ID index_filename = tablemodel.index(row, 0) # get file ID # We suppose data are strings selected_file_id = str(tablemodel.data(index).toString()) selected_file_name = str(tablemodel.data(index_filename).toString()) self.file_mirrors_list_window = FileMirrorsListUI(self, str(self.current_selected_bucket_id), selected_file_id, filename=selected_file_name) self.file_mirrors_list_window.show() i += 1 if i == 0: QtGui.QMessageBox.about(self, 'Warning!', 'Please select file from file list!') self.__logger.debug(1)
def open_single_file_download_window(self): self.current_bucket_index = self.file_manager_ui.bucket_select_combo_box.currentIndex() self.current_selected_bucket_id = self.bucket_id_list[self.current_bucket_index] tablemodel = self.file_manager_ui.files_list_tableview.model() rows = sorted(set(index.row() for index in self.file_manager_ui.files_list_tableview.selectedIndexes())) i = 0 for row in rows: self.__logger.info('Row %d is selected' % row) index = tablemodel.index(row, 2) # get file ID # We suppose data are strings selected_file_id = str(tablemodel.data(index).toString()) self.file_mirrors_list_window = SingleFileDownloadUI(self, str(self.current_selected_bucket_id), selected_file_id) self.file_mirrors_list_window.show() i += 1 if i == 0: QtGui.QMessageBox.about(self, 'Warning!', 'Please select file from file list!') self.__logger.debug(1)
def show_upload_finished_message(self): self.is_upload_active = False self.ui_single_file_upload.connections_onetime.setEnabled(True) self.ui_single_file_upload.start_upload_bt.setStyleSheet(("QPushButton:hover{\n" " background-color: #83bf20;\n" " border-color: #83bf20;\n" "}\n" "QPushButton:active {\n" " background-color: #93cc36;\n" " border-color: #93cc36;\n" "}\n" "QPushButton{\n" " background-color: #88c425;\n" " border: 1px solid #88c425;\n" " color: #fff;\n" " border-radius: 7px;\n" "}")) self.ui_single_file_upload.start_upload_bt.setEnabled(True) self.ui_single_file_upload.file_path.setText("") QMessageBox.information(self, 'Success!', 'File uploaded successfully!')
def open_mirrors_list_window(self): self.current_bucket_index = self.file_manager_ui.bucket_select_combo_box.currentIndex() self.current_selected_bucket_id = self.bucket_id_list[self.current_bucket_index] tablemodel = self.file_manager_ui.files_list_tableview.model() rows = sorted(set(index.row() for index in self.file_manager_ui.files_list_tableview.selectedIndexes())) i = 0 for row in rows: self.__logger.info('Row %d is selected' % row) index = tablemodel.index(row, 3) # get file ID # We suppose data are strings selected_file_id = str(tablemodel.data(index).toString()) self.file_mirrors_list_window = FileMirrorsListUI(self, str(self.current_selected_bucket_id), selected_file_id) self.file_mirrors_list_window.show() i += 1 if i == 0: QtGui.QMessageBox.about( self, 'Warning!', 'Please select file from file list!') self.__logger.debug(1)
def initialize_bucket_select_combobox(self): self.buckets_list = [] self.bucket_id_list = [] self.storj_engine = StorjEngine() # init StorjEngine i = 0 try: for bucket in self.storj_engine.storj_client.bucket_list(): self.buckets_list.append(str(bucket.name)) # append buckets to list self.bucket_id_list.append(str(bucket.id)) # append buckets to list i = i + 1 except sjexc.StorjBridgeApiError as e: QtGui.QMessageBox.about( self, 'Unhandled bucket resolving exception', 'Exception: %s' % e) self.file_manager_ui.bucket_select_combo_box.addItems(self.buckets_list)
def open_single_file_download_window(self): self.current_bucket_index = self.file_manager_ui.bucket_select_combo_box.currentIndex() self.current_selected_bucket_id = self.bucket_id_list[self.current_bucket_index] tablemodel = self.file_manager_ui.files_list_tableview.model() rows = sorted(set(index.row() for index in self.file_manager_ui.files_list_tableview.selectedIndexes())) i = 0 for row in rows: self.__logger.info('Row %d is selected', row) # get file ID index = tablemodel.index(row, 3) # we suppose data are strings selected_file_id = str(tablemodel.data(index).toString()) self.file_mirrors_list_window = SingleFileDownloadUI( self, str(self.current_selected_bucket_id), selected_file_id) self.file_mirrors_list_window.show() i += 1 if i == 0: QtGui.QMessageBox.about(self, 'Warning!', 'Please select file from file list!') self.__logger.debug(1)
def show_download_finished_message(self): self.ui_single_file_download.start_download_bt.setStyleSheet( ('QPushButton:hover{\n' ' background-color: #83bf20;\n' ' border-color: #83bf20;\n' '}\n' 'QPushButton:active {\n' ' background-color: #93cc36;\n' ' border-color: #93cc36;\n' '}\n' 'QPushButton{\n' ' background-color: #88c425;\n' ' border: 1px solid #88c425;\n' ' color: #fff;\n' ' border-radius: 7px;\n' '}')) self.ui_single_file_download.connections_onetime.setEnabled(True) self.ui_single_file_download.start_download_bt.setEnabled(True) QtGui.QMessageBox.information(self, 'Success!', 'File downloaded successfully!')
def saveCode(self): fn = QtGui.QFileDialog.getSaveFileName( self, self.trUtf8('Save QRCode'), filter=self.trUtf8('PNG Images (*.png);; All Files (*.*)') ) if fn: if not fn.toLower().endsWith(u".png"): fn += u".png" self.qrcode.pixmap().save(fn) if NOTIFY: n = pynotify.Notification( unicode(self.trUtf8("Save QR Code")), unicode(self.trUtf8("QR Code succesfully saved to %s")) % fn, "qtqr" ) n.show() else: QtGui.QMessageBox.information( self, unicode(self.trUtf8('Save QRCode')), unicode(self.trUtf8('QRCode succesfully saved to <b>%s</b>.')) % fn )
def descargarPorLink(self): ydl_opts = { 'format': self.format, 'postprocessors': [{ 'key': 'FFmpegVideoConvertor', 'preferedformat': self.preferedformat }] } with YT(ydl_opts) as yt: homedir = os.getenv("HOME") exdir = os.getcwd() #exdir es el directorio actual, se guarda para saber donde volver una vez completada la descarga #print(exdir) if not os.path.exists(homedir+ "/Descargas/GUIYoutube"): os.makedirs(homedir+"/Descargas/GUIYoutube") os.chdir(homedir+"/Descargas/GUIYoutube") #print(os.getcwd()) yt.download([self.link]) os.chdir(exdir) #self.popup = QtGui.QMessageBox.information(self, "Informacion", """Descarga finalizada (revise la carpeta Descargas)""",QtGui.QMessageBox.Ok) subprocess.Popen(["notify-send", "-t","4000", "Descarga finalizada (revise su carpeta de descargas)"])
def show_about(self): """ Shows the about dialog. """ msg = u"""Um gerador de certificados para cursos livres e eventos feito em Python para gerar certificados em PDF e, inclusive, enviá-los por e-mail. É só cadastrar seu evento e logo em seguida seus participantes e, voilà, certificados emitidos!\n\nMais informações em: https://github.com/juliarizza/certificate_generator """ about = QtGui.QMessageBox() about.setGeometry(450, 300, 200, 200) about.setIcon(QtGui.QMessageBox.Information) about.setText(u"Sobre o Certifica!") about.setInformativeText(msg) about.setWindowTitle(u"Sobre o Certifica!") about.setStandardButtons(QtGui.QMessageBox.Ok) about.exec_()
def link(self): channel = self.get_channel() if hasattr(self.locs[channel], 'len'): QtGui.QMessageBox.information(self, 'Link', 'Localizations are already linked. Aborting...') return else: r_max, max_dark, ok = LinkDialog.getParams() if ok: status = lib.StatusDialog('Linking localizations...', self) self.locs[channel] = postprocess.link(self.locs[channel], self.infos[channel], r_max=r_max, max_dark_time=max_dark) status.close() if hasattr(self.locs[channel], 'group'): groups = np.unique(self.locs[channel].group) groups = np.arange(np.max(groups)+1) np.random.shuffle(groups) groups %= N_GROUP_COLORS self.group_color = groups[self.locs[channel].group] self.update_scene()
def get_render_kwargs(self, viewport=None): ''' Returns a dictionary to be used for the keyword arguments of render. ''' blur_button = self.window.display_settings_dialog.blur_buttongroup.checkedButton() optimal_oversampling = self.display_pixels_per_viewport_pixels() if self.window.display_settings_dialog.dynamic_oversampling.isChecked(): oversampling = optimal_oversampling self.window.display_settings_dialog.set_oversampling_silently(optimal_oversampling) else: oversampling = float(self.window.display_settings_dialog.oversampling.value()) if self.window.display_settings_dialog.high_oversampling.isChecked(): print('High oversampling') else: if oversampling > optimal_oversampling: QtGui.QMessageBox.information(self, 'Oversampling too high', 'Oversampling will be adjusted to match the display pixel density.') oversampling = optimal_oversampling self.window.display_settings_dialog.set_oversampling_silently(optimal_oversampling) if viewport is None: viewport = self.viewport return {'oversampling': oversampling, 'viewport': viewport, 'blur_method': self.window.display_settings_dialog.blur_methods[blur_button], 'min_blur_width': float(self.window.display_settings_dialog.min_blur_width.value())}
def device_response(self, sysex, parent): if sysex[5] == 0x3e: dev_man = 'Waldorf Music' else: dev_man = 'Unknown' if sysex[6:8] == [0x13, 0x0]: dev_model = 'Blofeld' else: dev_model = 'Unknown' if sysex[8:10] == [0, 0]: dev_type = 'Blofeld Desktop' else: dev_type = 'Blofeld Keyboard' dev_version = ''.join([str(unichr(l)) for l in sysex[10:14]]).strip() QtGui.QMessageBox.information(parent, 'Device informations', 'Device info:\n\nManufacturer: {}\nModel: {}\nType: {}\nVersion: {}'.format( dev_man, dev_model, dev_type, dev_version))
def closeDetect(self, win=None): if win: win_list = set((self.librarian, self.editor) + tuple(self.wavetable_windows_list)) win_list.discard(win) if any(win.isVisible() for win in win_list): return True if not self.library_changed(): return True msgbox = QtGui.QMessageBox( QtGui.QMessageBox.Question, 'Confirm exit', 'The library has been modified, do you want to quit anyway?', QtGui.QMessageBox.Abort|QtGui.QMessageBox.Save|QtGui.QMessageBox.Cancel, self.librarian ) buttonBox = msgbox.findChild(QtGui.QDialogButtonBox) abort_btn = buttonBox.button(QtGui.QDialogButtonBox.Abort) abort_btn.setText('Ignore and quit') abort_btn.setIcon(QtGui.QIcon.fromTheme('application-exit')) res = msgbox.exec_() if res == QtGui.QMessageBox.Cancel: return False elif res == QtGui.QMessageBox.Abort: return True self.save_library() return True
def zipdb(self): filename = gui.QFileDialog.getSaveFileName(self, _("Save database (keep '.zip' extension)"), "./ecu.zip", "*.zip") filename = str(filename.toAscii()) if not filename.endswith(".zip"): filename += ".zip" if not isWritable(str(os.path.dirname(filename))): mbox = gui.QMessageBox() mbox.setText("Cannot write to directory " + os.path.dirname(filename)) mbox.exec_() return self.logview.append("Zipping XML database... (this can take a few minutes)") core.QCoreApplication.processEvents() parameters.zipConvertXML(filename) self.logview.append("Zip job finished")
def remove_selected(self): if len(self.datatable.selectedItems()) == 0: return r = self.datatable.selectedItems()[-1].row() dataname = unicode(self.datatable.item(r, 0).text().toUtf8(), encoding="UTF-8") # Check if data needed by request for reqname, request in self.ecurequestsparser.requests.iteritems(): for rcvname, rcvdi in request.dataitems.iteritems(): if rcvname == dataname: msgbox = gui.QMessageBox() msgbox.setText(_("Data is used by request %s") % reqname) msgbox.exec_() return for sndname, snddi in request.sendbyte_dataitems.iteritems(): if sndname == dataname: msgbox = gui.QMessageBox() msgbox.setText(_("Data is used by request %s") % reqname) msgbox.exec_() return self.ecurequestsparser.data.pop(dataname) self.reload()
def insertImage(self): # Get image file name filename = QtGui.QFileDialog.getOpenFileName(self, 'Insert image',".","Images (*.png *.xpm *.jpg *.bmp *.gif)") if filename: # Create image object image = QtGui.QImage(filename) # Error if unloadable if image.isNull(): popup = QtGui.QMessageBox(QtGui.QMessageBox.Critical, "Image load error", "Could not load image file!", QtGui.QMessageBox.Ok, self) popup.show() else: cursor = self.text.textCursor() cursor.insertImage(image,filename)
def event(self, e): result = QtGui.QMessageBox.event(self, e) self.setMinimumHeight(0) self.setMaximumHeight(16777215) self.setMinimumWidth(0) self.setMaximumWidth(16777215) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) textEdit = self.findChild(QtGui.QTextEdit) if textEdit != None : textEdit.setMinimumHeight(0) textEdit.setMaximumHeight(16777215) textEdit.setMinimumWidth(0) textEdit.setMaximumWidth(16777215) textEdit.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) return result
def mapInFile (self) : if self.TOP == {} : reply = QtGui.QMessageBox.information(self, "Can't continue.", "Must check inputs first.") return outFileName = QtGui.QFileDialog.getSaveFileName (self, 'Output KML file name.', os.getcwd (), filter='*.kml') #print outFileName if outFileName : if outFileName[-4:] != '.kml' : outFileName += '.kml' self.status.showMessage ("Working on kml...") worker = MyWorker ('qc_map', outfile=outFileName) #worker.finished.connect (self.qcDone) worker.start () worker.wait () #novenqc.qc_map (outFileName)
def delete(self): if len(self.tableWidget.selectedIndexes()) > 0: msgBox = QtGui.QMessageBox() msgBox.setText("The list of Pools has been modified.") self.item_id = self.tableWidget.selectedIndexes()[0].row() self.selectedItem = self.listOfItems[self.item_id] msgBox.setInformativeText( "Do you want to delete Pool?:\n" + self.selectedItem.text()) msgBox.setStandardButtons( QtGui.QMessageBox().Ok | QtGui.QMessageBox().Cancel) msgBox.setDefaultButton(QtGui.QMessageBox().Cancel) msgBox.setIcon(QtGui.QMessageBox.Question) ret = msgBox.exec_() if ret == QtGui.QMessageBox().Ok: self.removeItem(self.item_id) if ret == QtGui.QMessageBox().Cancel: pass
def delete(self): if len(self.tableWidget.selectedIndexes()) > 0: msgBox = QtGui.QMessageBox() msgBox.setText("The list of Macro Servers has been modified.") self.item_id = self.tableWidget.selectedIndexes()[0].row() self.selectedItem = self.listOfItems[self.item_id] msgBox.setInformativeText( "Do you want to delete Macro Server?:\n" + self.selectedItem.text()) msgBox.setStandardButtons( QtGui.QMessageBox().Ok | QtGui.QMessageBox().Cancel) msgBox.setDefaultButton(QtGui.QMessageBox().Cancel) msgBox.setIcon(QtGui.QMessageBox.Question) ret = msgBox.exec_() if ret == QtGui.QMessageBox().Ok: self.removeItem(self.item_id) if ret == QtGui.QMessageBox().Cancel: pass
def _removeColumn(self): value = self.getValue() # stored table rows = len(value) columnIndex = self._getSelectedIndex()[1] if columnIndex is not None: msgBox = QtGui.QMessageBox() msgBox.setText("Confirmation ") msgBox.setStandardButtons( QtGui.QMessageBox().No | QtGui.QMessageBox().Yes) msgBox.setInformativeText( "Remove column {%i} ?" % (columnIndex + 1)) msgBox.setIcon(QtGui.QMessageBox.Question) ret = msgBox.exec_() if (rows > 0) and (columnIndex is not None) and (ret == QtGui.QMessageBox().Yes): columns = len(value[0]) if columns == 1: self.setValue([], undo=False) else: for i in range(len(value)): value[i] = value[i][:columnIndex] + \ value[i][columnIndex + 1:] self.setValue(value, undo=True)
def warning(self,message): QtGui.QMessageBox.warning(self,QtGui.qApp.applicationName(),message)
def excepthook(*exception_info): logger.error('unexpected error',exc_info=exception_info) message = QtGui.QMessageBox(None) message.setWindowTitle(QtGui.qApp.applicationName()) message.setIcon(QtGui.QMessageBox.Critical) message.setText('An unexpected error occurred.') message.setDetailedText(logging_stream.getvalue()) message.setStandardButtons(QtGui.QMessageBox.Ok) message.setDefaultButton(QtGui.QMessageBox.Ok) message.exec_() QtGui.qApp.exit()
def deleteRequests(self,indexes): requests=self.controller.getRequests() mb = QtGui.QMessageBox ("Deleting Requests","Are you sure you want to delete selected requests ?",QtGui.QMessageBox.Warning,QtGui.QMessageBox.Cancel,QtGui.QMessageBox.Ok,0) if mb.exec_()==QtGui.QMessageBox.Ok: for i in indexes: del requests[i] self.tableWidget.removeRow(i) self.updateAllStats()
def applyConfig (self): getsign=str(self.getsignEdit.text()) headersign=str(self.headersignEdit.text()) valuesign=str(self.valuesignEdit.text()) limitpath=str(self.pathlimitEdit.text()) proxy=str(self.proxyEdit.text()) proxyport=self.portSpin.value() try: Proxynet.changePort(proxyport) except Exception,a: Proxynet.changePort(8008) Proxynet.init() self.portSpin.setValue(8008) mb = QtGui.QMessageBox ("Error",str(a),QtGui.QMessageBox.Critical,QtGui.QMessageBox.Ok,0,0) mb.exec_() Proxynet.signGET(getsign) Proxynet.signHeaders(headersign, valuesign) Proxynet.limitPath(limitpath) if proxy: Proxynet.setProxy(proxy) Attacker.setProxy(proxy) else: Proxynet.setProxy(None) Attacker.setProxy(None) ######################################################################################################################################## ######################################################################################################################################## ######################################################################################################################################## ######################################### Attacker ################################################### ######################################################################################################################################## ########################################################################################################################################
def reset (self): """Reset dialog and restart update check.""" self.thread.reset() self.thread.start() self.setIcon(QtGui.QMessageBox.Information) self.setText(_('Checking for updates...'))
def update (self): """Display update thread result (which must be available).""" result, value = self.thread.result, self.thread.value if result: if value is None: # no update available: display info text = _('Congratulations: the latest version ' '%(app)s is installed.') attrs = dict(app=configuration.App) else: version, url = value if url is None: # current version is newer than online version text = _('Detected local or development version %(currentversion)s. ' 'Available version of %(app)s is %(version)s.') else: # display update link text = _('A new version %(version)s of %(app)s is ' 'available for <a href="%(url)s">download</a>.') attrs = dict(version=version, app=configuration.AppName, url=url, currentversion=configuration.Version) else: # value is an error message or None if UpdateThread has been # terminated if value is None: value = _('update thread has been terminated') self.setIcon(QtGui.QMessageBox.Warning) text = _('An error occured while checking for an ' 'update of %(app)s: %(error)s.') attrs = dict(error=value, app=configuration.AppName) self.setText(text % attrs)
def wants_save (self): """Ask user if he wants to save changes. Return True if user wants to save, else False.""" dialog = QtGui.QMessageBox(parent=self) dialog.setIcon(QtGui.QMessageBox.Question) dialog.setWindowTitle(_("Save file?")) dialog.setText(_("The document has been modified.")) dialog.setInformativeText(_("Do you want to save your changes?")) dialog.setStandardButtons(QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard) dialog.setDefaultButton(QtGui.QMessageBox.Save) return dialog.exec_() == QtGui.QMessageBox.Save
def save (self): """Save editor contents to file.""" if not self.filename: title = _("Save File As") res = QtGui.QFileDialog.getSaveFileName(self, title, self.basedir) if not res: # user canceled return self.filename = res self.setWindowTitle(self.filename) else: if not os.path.isfile(self.filename): return if not os.access(self.filename, os.W_OK): return fh = None saved = False try: try: fh = QtCore.QFile(self.filename) if not fh.open(QtCore.QIODevice.WriteOnly): raise IOError(fh.errorString()) stream = QtCore.QTextStream(fh) stream.setCodec("UTF-8") stream << self.editor.text() self.editor.setModified(False) saved = True except (IOError, OSError) as e: err = QtGui.QMessageBox(self) err.setText(str(e)) err.exec_() finally: if fh is not None: fh.close() if saved: self.saved.emit(self.filename) return saved
def load (self, filename): """Load editor contents from file.""" if not os.path.isfile(filename): return if not os.access(filename, os.R_OK): return self.filename = filename if not os.access(filename, os.W_OK): title = u"%s (%s)" % (self.filename, _(u"readonly")) else: title = self.filename self.setWindowTitle(title) fh = None loaded = False try: try: fh = QtCore.QFile(self.filename) if not fh.open(QtCore.QIODevice.ReadOnly): raise IOError(fh.errorString()) stream = QtCore.QTextStream(fh) stream.setCodec("UTF-8") self.setText(stream.readAll()) loaded = True except (IOError, OSError) as e: err = QtGui.QMessageBox(self) err.setText(str(e)) err.exec_() finally: if fh is not None: fh.close() if loaded: self.loaded.emit(self.filename)
def show(self, title, iconType, text, infoText, closeType, closeVal): msg = QtGui.QMessageBox() msg.setIcon(iconType) msg.setWindowIcon(QtGui.QIcon(GlobalVars.IconPath)) msg.setText(text) msg.setInformativeText(infoText) msg.setWindowTitle(title) msg.setStandardButtons(closeType) msg.exec_() if closeVal != 0: sys.exit(closeVal)
def setOutputFile(self): if self.isSetFile == False: msgBox = QtGui.QMessageBox() msgBox.setText("Please choose the source file. \n Menbe hujitini tallang.") msgBox.exec_() return self.output_file = self.selectFile() print 'Input: ', self.input_file print 'Output: ', self.output_file
def __init__(self, table_dbview, btn_exec_sql, btn_set_flows, text_db_sql, splitter_db,dbname): self.table_dbview = table_dbview self.btn_exec_sql = btn_exec_sql self.btn_set_flows = btn_set_flows self.text_db_sql = text_db_sql self.splitter_db = splitter_db self.current_model = None self.bufferview = BufferView(self) # Set initial splitter sizes self.splitter_db.setSizes([200, 100]) try: self.db = QtSql.QSqlDatabase.addDatabase("QSQLITE") NoSqlite = False except: NoSqlite = True if NoQtSql or NoSqlite: warn = QtGui.QMessageBox.Warning title = "Missing dependencies" text = MISSING_DEPS_TEXT self.msgbox = QtGui.QMessageBox(warn, title, text) self.msgbox.show() return self.connect_handlers() self.db.setDatabaseName("../db/%s" % (dbname)) open = self.db.open()
def handle_send(self): #print "OK DATA: " + self.main.textstream.toPlainText() #print "OK DATA: " + repr(str(self.main.textstream.toPlainText())) # Send the current debug event if self.main.btnauto.isChecked(): warn = QtGui.QMessageBox.Warning title = "Autosend is enabled" text = "Disable autosend before manually editing and sending events" self.msgbox = QtGui.QMessageBox(warn, title, text) self.msgbox.show() return if self.send_cur_de(self.curdebugevent): print "GUI sending debug event:%s" % (self.curdebugevent)
def autoIdentifySearch(self): if self.comic_archive is None: QtGui.QMessageBox.warning(self, self.tr("Automatic Identify Search"), self.tr("You need to load a comic first!")) return self.queryOnline( autoselect=True )
def commitMetadata(self): if ( self.metadata is not None and self.comic_archive is not None): reply = QtGui.QMessageBox.question(self, self.tr("Save Tags"), self.tr("Are you sure you wish to save " + MetaDataStyle.name[self.save_data_style] + " tags to this archive?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No ) if reply == QtGui.QMessageBox.Yes: QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) self.formToMetadata() success = self.comic_archive.writeMetadata( self.metadata, self.save_data_style ) self.comic_archive.loadCache( [ MetaDataStyle.CBI, MetaDataStyle.CIX ] ) QtGui.QApplication.restoreOverrideCursor() if not success: QtGui.QMessageBox.warning(self, self.tr("Save failed"), self.tr("The tag save operation seemed to fail!")) else: self.clearDirtyFlag() self.updateInfoBox() self.updateMenus() #QtGui.QMessageBox.information(self, self.tr("Yeah!"), self.tr("File written.")) self.fileSelectionList.updateCurrentRow() else: QtGui.QMessageBox.information(self, self.tr("Whoops!"), self.tr("No data to commit!"))
def dirtyFlagVerification( self, title, desc): if self.dirtyFlag: reply = QtGui.QMessageBox.question(self, self.tr(title), self.tr(desc), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No ) if reply != QtGui.QMessageBox.Yes: return False return True
def displayDialog(self,txt=''): """ Show a pop up dialog with a message """ QtGui.QMessageBox.about(self, 'Message', txt)
def __init__(self,**args): super(utilitiesClass.gainIcon, self).__init__() self.setupUi(self) self.func = args.get('FUNC',None) self.linkFunc = args.get('LINK',None) self.msg = QtGui.QMessageBox() self.msg.setIcon(QtGui.QMessageBox.Information) self.msg.setWindowTitle("Set Input Attenuation") self.msg.setText("Note :"); self.msg.setInformativeText("Please connect a 10MOhm resistor in series with this input") self.msg.setDetailedText("Connecting a 10MOhm resistor in series with the channel causes an 11x attenuation.\nThe software automatically compensates for this, and assumes a +/-160V range \n")
def setGains(self,g): if (g==8): msg = QtGui.QMessageBox() msg.setIcon(QtGui.QMessageBox.Information) msg.setWindowTitle("Set Input Attenuation") msg.setText("Note :"); msg.setInformativeText("Please connect a 10MOhm resistor in series on both inputs") msg.setDetailedText("Connecting a 10MOhm resistor in series with the channel causes an 11x attenuation.\nThe software automatically compensates for this, and assumes a +/-160V range \n") msg.exec_() self.func('CH1',g) retval=self.func('CH2',g) if self.linkFunc: self.linkFunc(retval)
def __init__(self, parent=None,**kwargs): super(AppWindow, self).__init__(parent) self.setupUi(self) self.I=kwargs.get('I',None) self.setWindowTitle('iPython Console : '+self.I.H.version_string.decode("utf-8")) self.msg = QtGui.QLabel() self.statusbar.addWidget(self.msg) self.msg.setText('Hi!') self.timer = QtCore.QTimer() self.showSplash();self.updateSplash(10,'Importing iPython Widgets...') try: from PSL_Apps.iPythonEmbed import QIPythonWidget self.updateSplash(10,'Creating Dock Widget...') except: self.splash.finish(self); errbox = QtGui.QMessageBox() errbox.setStyleSheet('background:#fff;') print (errbox.styleSheet()) errbox.about(self, "Error", "iPython-qtconsole not found.\n Please Install the module") return self.updateSplash(10,'Embedding IPython Widget...') #--------instantiate the iPython class------- self.ipyConsole = QIPythonWidget(customBanner="An interactive Python Console!\n");self.updateSplash(10) self.layout.addWidget(self.ipyConsole);self.updateSplash(10,'Preparing default command dictionary...') from PSL.analyticsClass import analyticsClass self.analytics = analyticsClass() cmdDict = {"analytics":self.analytics} #if self.graphContainer1_enabled:cmdDict["graph"]=self.graph if self.I : cmdDict["I"]=self.I self.ipyConsole.printText("Access hardware using the Instance 'I'. e.g. I.get_average_voltage('CH1')") self.ipyConsole.pushVariables(cmdDict);self.updateSplash(10,'Winding up...') self.console_enabled=True self.splash.finish(self);self.updateSplash(10)
def __init__(self,**kwargs): super(AppWindow.customSensorMonitorHandler, self).__init__() self.setupUi(self) self.SEN = kwargs.get('sen',None) if not hasattr(self.SEN,'getRaw'): raise Exception#QtGui.QMessageBox.about(self, 'Error', 'This Sensor does not have a read option') self.evalGlobals = kwargs.get('evalGlobals',None) self.title.setText('%s|%s'%(hex(self.SEN.ADDRESS),self.SEN.name)) self.dataOptions.addItems(self.SEN.PLOTNAMES)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.bucket_create_ui = Ui_BucketCreate() self.bucket_create_ui.setupUi(self) # Create bucket action QtCore.QObject.connect(self.bucket_create_ui.create_bucket_bt, QtCore.SIGNAL('clicked()'), self.createNewBucketCreateThread) # Delete bucket action QtCore.QObject.connect(self.bucket_create_ui.cancel_bt, QtCore.SIGNAL('clicked()'), self.close) self.connect(self, QtCore.SIGNAL('showBucketCreatingException'), self.show_bucket_creating_exception_dialog) self.connect(self, QtCore.SIGNAL('showBucketCreatedSuccessfully'), self.show_bucket_crated_successfully) self.connect(self, QtCore.SIGNAL('showBucketCreationMissingFields'), lambda: QtGui.QMessageBox.about( self, 'Warning', 'Please fill out all fields!')) self.storj_engine = StorjEngine() # init StorjEngine
def show_bucket_creating_exception_dialog(self, exception): QtGui.QMessageBox.about( self, 'Unhandled exception while creating bucket', 'Exception: %s' % str(exception))
def handle_logout_action(self): msgBox = QtGui.QMessageBox( QtGui.QMessageBox.Question, 'Question', 'Are you sure that you want to logout?', (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) result = msgBox.exec_() if result == QtGui.QMessageBox.Yes: logged_out = self.account_manager.logout() if logged_out: QtGui.QMessageBox.about(self, 'Success', 'Successfully logged out!')