本文整理汇总了Python中KdeQt.KQMessageBox.critical方法的典型用法代码示例。如果您正苦于以下问题:Python KQMessageBox.critical方法的具体用法?Python KQMessageBox.critical怎么用?Python KQMessageBox.critical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KdeQt.KQMessageBox
的用法示例。
在下文中一共展示了KQMessageBox.critical方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_newButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def on_newButton_clicked(self):
"""
Private slot to create a new toolbar.
"""
name, ok = KQInputDialog.getText(\
self,
self.trUtf8("New Toolbar"),
self.trUtf8("Toolbar Name:"),
QLineEdit.Normal)
if ok and not name.isEmpty():
if self.toolbarComboBox.findText(name) != -1:
# toolbar with this name already exists
KQMessageBox.critical(self,
self.trUtf8("New Toolbar"),
self.trUtf8("""A toolbar with the name <b>%1</b> already exists.""")\
.arg(name),
QMessageBox.StandardButtons(\
QMessageBox.Abort))
return
tbItem = E4ToolBarItem(None, [], False)
tbItem.title = name
tbItem.isChanged = True
self.__toolbarItems[id(tbItem)] = tbItem
self.__toolBarItemToWidgetActionID[id(tbItem)] = []
self.toolbarComboBox.addItem(name, QVariant(long(id(tbItem))))
self.toolbarComboBox.model().sort(0)
self.toolbarComboBox.setCurrentIndex(self.toolbarComboBox.findText(name))
示例2: __importStyles
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __importStyles(self, lexers):
"""
Private method to import the styles of the given lexers.
@param lexers dictionary of lexer objects for which to import the styles
"""
fn = KQFileDialog.getOpenFileName(\
self,
self.trUtf8("Import Highlighting Styles"),
QString(),
self.trUtf8("eric4 highlighting styles file (*.e4h)"),
None)
if fn.isEmpty():
return
fn = unicode(fn)
try:
f = open(fn, "rb")
try:
line = f.readline()
dtdLine = f.readline()
finally:
f.close()
except IOError, err:
KQMessageBox.critical(self,
self.trUtf8("Import Highlighting Styles"),
self.trUtf8("""<p>The highlighting styles could not be read"""
""" from file <b>%1</b>.</p><p>Reason: %2</p>""")\
.arg(fn)\
.arg(str(err))
)
return
示例3: on_validateButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def on_validateButton_clicked(self):
"""
Private slot to validate the entered regexp.
"""
regex = self.regexpLineEdit.text()
if not regex.isEmpty():
re = QRegExp(regex)
if self.caseSensitiveCheckBox.isChecked():
re.setCaseSensitivity(Qt.CaseSensitive)
else:
re.setCaseSensitivity(Qt.CaseInsensitive)
re.setMinimal(self.minimalCheckBox.isChecked())
if self.wildcardCheckBox.isChecked():
re.setPatternSyntax(QRegExp.Wildcard)
else:
re.setPatternSyntax(QRegExp.RegExp)
if re.isValid():
KQMessageBox.information(None,
self.trUtf8(""),
self.trUtf8("""The regular expression is valid."""))
else:
KQMessageBox.critical(None,
self.trUtf8("Error"),
self.trUtf8("""Invalid regular expression: %1""")
.arg(re.errorString()))
return
else:
KQMessageBox.critical(None,
self.trUtf8("Error"),
self.trUtf8("""A regular expression must be given."""))
示例4: on_renameButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def on_renameButton_clicked(self):
"""
Private slot to rename a custom toolbar.
"""
oldName = self.toolbarComboBox.currentText()
newName, ok = KQInputDialog.getText(\
self,
self.trUtf8("Rename Toolbar"),
self.trUtf8("New Toolbar Name:"),
QLineEdit.Normal,
oldName)
if ok and not newName.isEmpty():
if oldName == newName:
return
if self.toolbarComboBox.findText(newName) != -1:
# toolbar with this name already exists
KQMessageBox.critical(self,
self.trUtf8("Rename Toolbar"),
self.trUtf8("""A toolbar with the name <b>%1</b> already exists.""")\
.arg(newName),
QMessageBox.StandardButtons(\
QMessageBox.Abort))
return
index = self.toolbarComboBox.currentIndex()
self.toolbarComboBox.setItemText(index, newName)
tbItem = \
self.__toolbarItems[self.toolbarComboBox.itemData(index).toULongLong()[0]]
tbItem.title = newName
tbItem.isChanged = True
示例5: __checkPluginsDownloadDirectory
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __checkPluginsDownloadDirectory(self):
"""
Private slot to check for the existance of the plugins download directory.
"""
downloadDir = unicode(Preferences.getPluginManager("DownloadPath"))
if not downloadDir:
downloadDir = self.__defaultDownloadDir
if not os.path.exists(downloadDir):
try:
os.mkdir(downloadDir, 0755)
except (OSError, IOError), err:
# try again with (possibly) new default
downloadDir = self.__defaultDownloadDir
if not os.path.exists(downloadDir):
try:
os.mkdir(downloadDir, 0755)
except (OSError, IOError), err:
KQMessageBox.critical(self.__ui,
self.trUtf8("Plugin Manager Error"),
self.trUtf8("""<p>The plugin download directory <b>%1</b> """
"""could not be created. Please configure it """
"""via the configuration dialog.</p>"""
"""<p>Reason: %2</p>""")\
.arg(downloadDir).arg(str(err)))
downloadDir = ""
示例6: __generateTSFileDone
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __generateTSFileDone(self, exitCode, exitStatus):
"""
Private slot to handle the finished signal of the pylupdate process.
@param exitCode exit code of the process (integer)
@param exitStatus exit status of the process (QProcess.ExitStatus)
"""
if exitStatus == QProcess.NormalExit and exitCode == 0:
KQMessageBox.information(None,
self.trUtf8("Translation file generation"),
self.trUtf8("The generation of the translation files (*.ts)"
" was successful."))
else:
KQMessageBox.critical(None,
self.trUtf8("Translation file generation"),
self.trUtf8("The generation of the translation files (*.ts) has failed."))
proc = self.sender()
for index in range(len(self.__pylupdateProcesses)):
if proc == self.__pylupdateProcesses[index][0]:
try:
os.remove(self.__pylupdateProcesses[index][1])
except EnvironmentError:
pass
del self.__pylupdateProcesses[index]
break
if not self.__pylupdateProcesses:
# all done
self.pylupdateProcRunning = False
示例7: on_changeButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def on_changeButton_clicked(self):
"""
Private slot to change an entry.
"""
row = self.groupsList.currentRow()
if row < 0:
return
groupName = self.nameEdit.text()
if groupName.isEmpty():
KQMessageBox.critical(self,
self.trUtf8("Add tool group entry"),
self.trUtf8("You have to give a name for the group to add."))
return
if len(self.groupsList.findItems(groupName, Qt.MatchFlags(Qt.MatchExactly))):
KQMessageBox.critical(self,
self.trUtf8("Add tool group entry"),
self.trUtf8("An entry for the group name %1 already exists.")\
.arg(groupName))
return
self.toolGroups[row][0] = unicode(groupName)
self.groupsList.currentItem().setText(groupName)
示例8: start
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [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()
示例9: __writeXMLMultiProject
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __writeXMLMultiProject(self, fn = None):
"""
Private method to write the multi project data to an XML file.
@param fn the filename of the multi project file (string)
"""
try:
if fn.lower().endswith("e4mz"):
try:
import gzip
except ImportError:
KQMessageBox.critical(None,
self.trUtf8("Save multiproject file"),
self.trUtf8("""Compressed multiproject files not supported."""
""" The compression library is missing."""))
return False
f = gzip.open(fn, "wb")
else:
f = open(fn, "wb")
MultiProjectWriter(self, f, os.path.splitext(os.path.basename(fn))[0])\
.writeXML()
f.close()
except IOError:
KQMessageBox.critical(None,
self.trUtf8("Save multiproject file"),
self.trUtf8("<p>The multiproject file <b>%1</b> could not be "
"written.</p>").arg(fn))
return False
return True
示例10: on_saveButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [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)))
示例11: on_deleteButton_clicked
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def on_deleteButton_clicked(self):
"""
Private slot to delete the selected search engines.
"""
if self.enginesTable.model().rowCount() == 1:
KQMessageBox.critical(self,
self.trUtf8("Delete selected engines"),
self.trUtf8("""You must have at least one search engine."""))
self.enginesTable.removeSelected()
示例12: __generatePythonCode
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __generatePythonCode(self):
"""
Private slot to generate Python code as requested by the user.
"""
# init some variables
sourceImpl = []
appendAtIndex = -1
indentStr = " "
slotsCode = []
if self.__module is None:
# new file
try:
if self.project.getProjectLanguage() == "Python3":
tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
"impl_pyqt.py3.tmpl")
else:
if self.project.getProjectType() == "PySide":
tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
"impl_pyside.py.tmpl")
else:
tmplName = os.path.join(getConfig('ericCodeTemplatesDir'),
"impl_pyqt.py.tmpl")
tmplFile = open(tmplName, 'rb')
template = tmplFile.read()
tmplFile.close()
except IOError, why:
KQMessageBox.critical(self,
self.trUtf8("Code Generation"),
self.trUtf8("""<p>Could not open the code template file "%1".</p>"""
"""<p>Reason: %2</p>""")\
.arg(tmplName)\
.arg(str(why)),
QMessageBox.StandardButtons(\
QMessageBox.Ok))
return
objName = self.__objectName()
if not objName.isEmpty():
template = template\
.replace("$FORMFILE$",
os.path.splitext(os.path.basename(self.formFile))[0])\
.replace("$FORMCLASS$", unicode(objName))\
.replace("$CLASSNAME$", unicode(self.classNameCombo.currentText()))\
.replace("$SUPERCLASS$", unicode(self.__className()))
sourceImpl = template.splitlines(True)
appendAtIndex = -1
# determine indent string
for line in sourceImpl:
if line.lstrip().startswith("def __init__"):
indentStr = line.replace(line.lstrip(), "")
break
示例13: start
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def start(self, path):
"""
Public slot to populate the data.
@param path directory name to show change lists for (string)
"""
self.changeListsDict = {}
self.filesLabel.setText(self.trUtf8("Files (relative to %1):").arg(path))
self.errorGroup.hide()
self.intercept = False
self.path = path
self.currentChangelist = ""
self.process = QProcess()
self.process.finished.connect(self.__procFinished)
self.process.readyReadStandardOutput.connect(self.__readStdout)
self.process.readyReadStandardError.connect(self.__readStderr)
args = []
args.append('status')
self.vcs.addArguments(args, self.vcs.options['global'])
self.vcs.addArguments(args, self.vcs.options['status'])
if '--verbose' not in self.vcs.options['global'] and \
'--verbose' not in self.vcs.options['status']:
args.append('--verbose')
if isinstance(path, list):
self.dname, fnames = self.vcs.splitPathList(path)
self.vcs.addArguments(args, fnames)
else:
self.dname, fname = self.vcs.splitPath(path)
args.append(fname)
self.process.setWorkingDirectory(self.dname)
self.process.start('svn', args)
procStarted = self.process.waitForStarted()
if not procStarted:
self.inputGroup.setEnabled(False)
self.inputGroup.hide()
KQMessageBox.critical(self,
self.trUtf8('Process Generation Error'),
self.trUtf8(
'The process %1 could not be started. '
'Ensure, that it is in the search path.'
).arg('svn'))
else:
self.inputGroup.setEnabled(True)
self.inputGroup.show()
示例14: __getLogEntries
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def __getLogEntries(self, startRev = None):
"""
Private method to retrieve log entries from the repository.
@param startRev revision number to start from (integer, string or QString)
"""
self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
QApplication.processEvents()
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
QApplication.processEvents()
self.intercept = False
self.process.kill()
self.buf = QStringList()
self.cancelled = False
self.errors.clear()
args = QStringList()
args.append('log')
self.vcs.addArguments(args, self.vcs.options['global'])
self.vcs.addArguments(args, self.vcs.options['log'])
args.append('--verbose')
args.append('--limit')
args.append('%d' % self.limitSpinBox.value())
if startRev is not None:
args.append('--revision')
args.append('%s:0' % startRev)
if self.stopCheckBox.isChecked():
args.append('--stop-on-copy')
args.append(self.fname)
self.process.setWorkingDirectory(self.dname)
self.inputGroup.setEnabled(True)
self.inputGroup.show()
self.process.start('svn', args)
procStarted = self.process.waitForStarted()
if not procStarted:
self.inputGroup.setEnabled(False)
self.inputGroup.hide()
KQMessageBox.critical(None,
self.trUtf8('Process Generation Error'),
self.trUtf8(
'The process %1 could not be started. '
'Ensure, that it is in the search path.'
).arg('svn'))
示例15: start
# 需要导入模块: from KdeQt import KQMessageBox [as 别名]
# 或者: from KdeQt.KQMessageBox import critical [as 别名]
def start(self, args, fn):
"""
Public slot to start the ericapi command.
@param args commandline arguments for ericapi program (QStringList)
@param fn filename or dirname to be processed by ericapi program
@return flag indicating the successful start of the process
"""
self.errorGroup.hide()
self.filename = unicode(fn)
if os.path.isdir(self.filename):
dname = os.path.abspath(self.filename)
fname = "."
if os.path.exists(os.path.join(dname, "__init__.py")):
fname = os.path.basename(dname)
dname = os.path.dirname(dname)
else:
dname = os.path.dirname(self.filename)
fname = os.path.basename(self.filename)
self.contents.clear()
self.errors.clear()
program = args[0]
del args[0]
args.append(fname)
self.process = QProcess()
self.process.setWorkingDirectory(dname)
self.connect(self.process, SIGNAL('readyReadStandardOutput()'),
self.__readStdout)
self.connect(self.process, SIGNAL('readyReadStandardError()'),
self.__readStderr)
self.connect(self.process, SIGNAL('finished(int, QProcess::ExitStatus)'),
self.__finish)
self.setWindowTitle(self.trUtf8('%1 - %2').arg(self.cmdname).arg(self.filename))
self.process.start(program, args)
procStarted = self.process.waitForStarted()
if not procStarted:
KQMessageBox.critical(None,
self.trUtf8('Process Generation Error'),
self.trUtf8(
'The process %1 could not be started. '
'Ensure, that it is in the search path.'
).arg(program))
return procStarted