本文整理汇总了Python中KdeQt.KQMessageBox.warning方法的典型用法代码示例。如果您正苦于以下问题:Python KQMessageBox.warning方法的具体用法?Python KQMessageBox.warning怎么用?Python KQMessageBox.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KdeQt.KQMessageBox
的用法示例。
在下文中一共展示了KQMessageBox.warning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __findDuplicates
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def __findDuplicates(self, cond, special, showMessage = False, index = QModelIndex()):
"""
Private method to check, if an entry already exists.
@param cond condition to check (string or QString)
@param special special condition to check (string or QString)
@param showMessage flag indicating a message should be shown,
if a duplicate entry is found (boolean)
@param index index that should not be considered duplicate (QModelIndex)
@return flag indicating a duplicate entry (boolean)
"""
cond = unicode(cond)
special = unicode(special)
idx = self.__model.getWatchPointIndex(cond, special)
duplicate = idx.isValid() and idx.internalPointer() != index.internalPointer()
if showMessage and duplicate:
if not special:
msg = self.trUtf8("""<p>A watch expression '<b>%1</b>'"""
""" already exists.</p>""")\
.arg(Utilities.html_encode(unicode(cond)))
else:
msg = self.trUtf8("""<p>A watch expression '<b>%1</b>'"""
""" for the variable <b>%2</b> already exists.</p>""")\
.arg(special)\
.arg(Utilities.html_encode(unicode(cond)))
KQMessageBox.warning(None,
self.trUtf8("Watch expression already exists"),
msg)
return duplicate
示例2: start
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def start(self, pfn, fn=None):
"""
Public slot to start the calculation of the profile data.
@param pfn basename of the profiling file (string)
@param fn file to display the profiling data for (string)
"""
self.basename = os.path.splitext(pfn)[0]
fname = "%s.profile" % self.basename
if not os.path.exists(fname):
KQMessageBox.warning(None,
self.trUtf8("Profile Results"),
self.trUtf8("""<p>There is no profiling data"""
""" available for <b>%1</b>.</p>""")
.arg(pfn))
self.close()
return
try:
f = open(fname, 'rb')
self.stats = pickle.load(f)
f.close()
except (EnvironmentError, pickle.PickleError, EOFError):
KQMessageBox.critical(None,
self.trUtf8("Loading Profiling Data"),
self.trUtf8("""<p>The profiling data could not be"""
""" read from file <b>%1</b>.</p>""")
.arg(fname))
self.close()
return
self.file = fn
self.__populateLists()
self.__finish()
示例3: __uiStartUp
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def __uiStartUp(self):
"""
Private slot to do some actions after the UI has started and the main loop is up.
"""
for warning in self.__warnings:
KQMessageBox.warning(self,
self.trUtf8("SQL Browser startup problem"),
warning)
if QSqlDatabase.connectionNames().isEmpty():
self.__browser.addConnectionByDialog()
示例4: importBookmarks
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def importBookmarks(self):
"""
Public method to import bookmarks.
"""
supportedFormats = QStringList() \
<< self.trUtf8("XBEL bookmarks").append(" (*.xbel *.xml)") \
<< self.trUtf8("HTML Netscape bookmarks").append(" (*.html *.htm)")
fileName = KQFileDialog.getOpenFileName(\
None,
self.trUtf8("Import Bookmarks"),
QString(),
supportedFormats.join(";;"),
None)
if fileName.isEmpty():
return
reader = XbelReader()
importRootNode = None
if fileName.endsWith(".html"):
inFile = QFile(fileName)
inFile.open(QIODevice.ReadOnly)
if inFile.openMode == QIODevice.NotOpen:
KQMessageBox.warning(None,
self.trUtf8("Import Bookmarks"),
self.trUtf8("""Error opening bookmarks file <b>%1</b>.""")\
.arg(fileName))
return
webpage = QWebPage()
webpage.mainFrame().setHtml(QString(inFile.readAll()))
result = webpage.mainFrame().evaluateJavaScript(extract_js).toByteArray()
buffer_ = QBuffer(result)
buffer_.open(QIODevice.ReadOnly)
importRootNode = reader.read(buffer_)
else:
importRootNode = reader.read(fileName)
if reader.error() != QXmlStreamReader.NoError:
KQMessageBox.warning(None,
self.trUtf8("Import Bookmarks"),
self.trUtf8("""Error when importing bookmarks on line %1, column %2:\n"""
"""%3""")\
.arg(reader.lineNumber())\
.arg(reader.columnNumber())\
.arg(reader.errorString()))
return
importRootNode.setType(BookmarkNode.Folder)
importRootNode.title = self.trUtf8("Imported %1")\
.arg(QDate.currentDate().toString(Qt.SystemLocaleShortDate))
self.addBookmark(self.menu(), importRootNode)
示例5: addConnectionByDialog
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def addConnectionByDialog(self):
"""
Public slot to add a database connection via an input dialog.
"""
dlg = SqlConnectionDialog(self)
if dlg.exec_() == QDialog.Accepted:
driver, dbName, user, password, host, port = dlg.getData()
err = self.addConnection(driver, dbName, user, password, host, port)
if err.type() != QSqlError.NoError:
KQMessageBox.warning(self,
self.trUtf8("Unable to open database"),
self.trUtf8("""An error occurred while opening the connection."""))
示例6: __sslErrors
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def __sslErrors(self, reply, errors):
"""
Private slot to handle SSL errors.
@param reply reference to the reply object (QNetworkReply)
@param errors list of SSL errors (list of QSslError)
"""
errorStrings = QStringList()
for err in errors:
errorStrings.append(err.errorString())
errorString = errorStrings.join('.<br />')
ret = KQMessageBox.warning(self,
self.trUtf8("SSL Errors"),
self.trUtf8("""<p>SSL Errors:</p>"""
"""<p>%1</p>"""
"""<p>Do you want to ignore these errors?</p>""")\
.arg(errorString),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if ret == QMessageBox.Yes:
reply.ignoreSslErrors()
else:
self.__downloadCancelled = True
reply.abort()
示例7: on_deleteButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def on_deleteButton_clicked(self):
"""
Private slot to delete the selected entry.
"""
row = self.groupsList.currentRow()
if row < 0:
return
res = KQMessageBox.warning(None,
self.trUtf8("Delete tool group entry"),
self.trUtf8("""<p>Do you really want to delete the tool group"""
""" <b>"%1"</b>?</p>""")\
.arg(self.groupsList.currentItem().text()),
QMessageBox.StandardButtons(\
QMessageBox.No | \
QMessageBox.Yes),
QMessageBox.No)
if res != QMessageBox.Yes:
return
if row == self.currentGroup:
# set to default group if current group gets deleted
self.currentGroup = -1
del self.toolGroups[row]
itm = self.groupsList.takeItem(row)
del itm
if row >= len(self.toolGroups):
row -= 1
self.groupsList.setCurrentRow(row)
self.on_groupsList_currentRowChanged(row)
示例8: __downloadFileDone
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def __downloadFileDone(self):
"""
Private method called, after the file has been downloaded
from the internet.
"""
self.__updateButton.setEnabled(True)
self.__downloadCancelButton.setEnabled(False)
self.statusLabel.setText(" ")
ok = True
reply = self.sender()
if reply in self.__replies:
self.__replies.remove(reply)
if reply.error() != QNetworkReply.NoError:
ok = False
if not self.__downloadCancelled:
KQMessageBox.warning(None,
self.trUtf8("Error downloading file"),
self.trUtf8(
"""<p>Could not download the requested file from %1.</p>"""
"""<p>Error: %2</p>"""
).arg(self.__downloadURL).arg(reply.errorString())
)
self.downloadProgress.setValue(0)
self.__downloadURL = None
self.__downloadIODevice.remove()
self.__downloadIODevice = None
if self.repositoryList.topLevelItemCount():
if self.repositoryList.currentItem() is None:
self.repositoryList.setCurrentItem(\
self.repositoryList.topLevelItem(0))
else:
self.__downloadButton.setEnabled(len(self.__selectedItems()))
return
self.__downloadIODevice.open(QIODevice.WriteOnly)
self.__downloadIODevice.write(reply.readAll())
self.__downloadIODevice.close()
if QFile.exists(self.__downloadFileName):
QFile.remove(self.__downloadFileName)
self.__downloadIODevice.rename(self.__downloadFileName)
self.__downloadIODevice = None
self.__downloadURL = None
if self.__doneMethod is not None:
self.__doneMethod(ok, self.__downloadFileName)
示例9: on_saveButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def on_saveButton_clicked(self):
"""
Private slot to handle the Save button press.
It saves the diff shown in the dialog to a file in the local
filesystem.
"""
if type(self.filename) is types.ListType:
if len(self.filename) > 1:
fname = self.vcs.splitPathList(self.filename)[0]
else:
dname, fname = self.vcs.splitPath(self.filename[0])
if fname != '.':
fname = "%s.diff" % self.filename[0]
else:
fname = dname
else:
fname = self.vcs.splitPath(self.filename)[0]
selectedFilter = QString("")
fname = KQFileDialog.getSaveFileName(\
self,
self.trUtf8("Save Diff"),
fname,
self.trUtf8("Patch Files (*.diff)"),
selectedFilter,
QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
if fname.isEmpty():
return
ext = QFileInfo(fname).suffix()
if ext.isEmpty():
ex = selectedFilter.section('(*',1,1).section(')',0,0)
if not ex.isEmpty():
fname.append(ex)
if QFileInfo(fname).exists():
res = KQMessageBox.warning(self,
self.trUtf8("Save Diff"),
self.trUtf8("<p>The patch file <b>%1</b> already exists.</p>")
.arg(fname),
QMessageBox.StandardButtons(\
QMessageBox.Abort | \
QMessageBox.Save),
QMessageBox.Abort)
if res != QMessageBox.Save:
return
fname = unicode(Utilities.toNativeSeparators(fname))
try:
f = open(fname, "wb")
f.write(unicode(self.contents.toPlainText()))
f.close()
except IOError, why:
KQMessageBox.critical(self, self.trUtf8('Save Diff'),
self.trUtf8('<p>The patch file <b>%1</b> could not be saved.'
'<br>Reason: %2</p>')
.arg(unicode(fname)).arg(str(why)))
示例10: __showPixmap
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def __showPixmap(self, filename):
"""
Private method to show a file.
@param filename name of the file to be shown (string or QString)
@return flag indicating success
"""
image = QImage(filename)
if image.isNull():
KQMessageBox.warning(self,
self.trUtf8("Pixmap-Viewer"),
self.trUtf8("""<p>The file <b>%1</b> cannot be displayed."""
""" The format is not supported.</p>""").arg(filename))
return False
self.pixmapLabel.setPixmap(QPixmap.fromImage(image))
self.pixmapLabel.adjustSize()
return True
示例11: save
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def save(self):
"""
Public method to save the bookmarks.
"""
if not self.__loaded:
return
writer = XbelWriter()
bookmarkFile = os.path.join(Utilities.getConfigDir(), "browser", "bookmarks.xbel")
# save root folder titles in English (i.e. not localized)
self.__menu.title = BOOKMARKMENU
self.__toolbar.title = BOOKMARKBAR
if not writer.write(bookmarkFile, self.__bookmarkRootNode):
KQMessageBox.warning(None,
self.trUtf8("Saving Bookmarks"),
self.trUtf8("""Error saving bookmarks to <b>%1</b>.""").arg(bookmarkFile))
# restore localized titles
self.__menu.title = self.trUtf8(BOOKMARKMENU)
self.__toolbar.title = self.trUtf8(BOOKMARKBAR)
示例12: changeGroup
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def changeGroup(self, oldname, newname, language = "All"):
"""
Public method to rename a group.
@param oldname old name of the group (string or QString)
@param newname new name of the group (string or QString)
@param language programming language for the group (string or QString)
"""
if oldname != newname:
if self.groups.has_key(newname):
KQMessageBox.warning(self,
self.trUtf8("Edit Template Group"),
self.trUtf8("""<p>A template group with the name"""
""" <b>%1</b> already exists.</p>""")\
.arg(newname))
return
self.groups[newname] = self.groups[oldname]
del self.groups[oldname]
self.groups[newname].setName(newname)
self.groups[newname].setLanguage(language)
self.__resort()
示例13: saveMultiProjectAs
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def saveMultiProjectAs(self):
"""
Public slot to save the current multi project to a different file.
@return flag indicating success
"""
if Preferences.getProject("CompressedProjectFiles"):
selectedFilter = self.trUtf8("Compressed Multiproject Files (*.e4mz)")
else:
selectedFilter = self.trUtf8("Multiproject Files (*.e4m)")
if self.ppath:
defaultPath = self.ppath
else:
defaultPath = Preferences.getMultiProject("Workspace") or \
Utilities.getHomeDir()
fn = KQFileDialog.getSaveFileName(\
self.parent(),
self.trUtf8("Save multiproject as"),
defaultPath,
self.trUtf8("Multiproject Files (*.e4m);;"
"Compressed Multiproject Files (*.e4mz)"),
selectedFilter,
QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
if not fn.isEmpty():
ext = QFileInfo(fn).suffix()
if ext.isEmpty():
ex = selectedFilter.section('(*', 1, 1).section(')', 0, 0)
if not ex.isEmpty():
fn.append(ex)
if QFileInfo(fn).exists():
res = KQMessageBox.warning(None,
self.trUtf8("Save File"),
self.trUtf8("""<p>The file <b>%1</b> already exists.</p>""")
.arg(fn),
QMessageBox.StandardButtons(\
QMessageBox.Abort | \
QMessageBox.Save),
QMessageBox.Abort)
if res != QMessageBox.Save:
return False
self.name = unicode(QFileInfo(fn).baseName())
ok = self.__writeMultiProject(unicode(fn))
self.emit(SIGNAL('multiProjectClosed'))
self.emit(SIGNAL('multiProjectOpened'))
return True
else:
return False
示例14: on_addButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def on_addButton_clicked(self):
"""
Private slot to add documents to the help database.
"""
fileNames = KQFileDialog.getOpenFileNames(\
self,
self.trUtf8("Add Documentation"),
QString(),
self.trUtf8("Qt Compressed Help Files (*.qch)"),
None)
if fileNames.isEmpty():
return
for fileName in fileNames:
ns = QHelpEngineCore.namespaceName(fileName)
if ns.isEmpty():
KQMessageBox.warning(self,
self.trUtf8("Add Documentation"),
self.trUtf8("""The file <b>%1</b> is not a valid Qt Help File.""")\
.arg(fileName)
)
continue
if len(self.documentsList.findItems(ns, Qt.MatchFixedString)):
KQMessageBox.warning(self,
self.trUtf8("Add Documentation"),
self.trUtf8("""The namespace <b>%1</b> is already registered.""")\
.arg(ns)
)
continue
self.__engine.registerDocumentation(fileName)
self.documentsList.addItem(ns)
self.__registeredDocs.append(ns)
if ns in self.__unregisteredDocs:
self.__unregisteredDocs.remove(ns)
示例15: on_saveButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import warning [as 别名]
def on_saveButton_clicked(self):
"""
Private slot to save the regexp to a file.
"""
selectedFilter = QString("")
fname = KQFileDialog.getSaveFileName(\
self,
self.trUtf8("Save regular expression"),
QString(),
self.trUtf8("RegExp Files (*.rx);;All Files (*)"),
selectedFilter,
QFileDialog.Options(QFileDialog.DontConfirmOverwrite))
if not fname.isEmpty():
ext = QFileInfo(fname).suffix()
if ext.isEmpty():
ex = selectedFilter.section('(*', 1, 1).section(')', 0, 0)
if not ex.isEmpty():
fname.append(ex)
if QFileInfo(fname).exists():
res = KQMessageBox.warning(self,
self.trUtf8("Save regular expression"),
self.trUtf8("<p>The file <b>%1</b> already exists.</p>")
.arg(fname),
QMessageBox.StandardButtons(\
QMessageBox.Abort | \
QMessageBox.Save),
QMessageBox.Abort)
if res == QMessageBox.Abort or res == QMessageBox.Cancel:
return
try:
f=open(unicode(Utilities.toNativeSeparators(fname)), "wb")
f.write(unicode(self.regexpLineEdit.text()))
f.close()
except IOError, err:
KQMessageBox.information(self,
self.trUtf8("Save regular expression"),
self.trUtf8("""<p>The regular expression could not be saved.</p>"""
"""<p>Reason: %1</p>""").arg(str(err)))