本文整理匯總了Python中winpython.qt.QtGui.QMessageBox類的典型用法代碼示例。如果您正苦於以下問題:Python QMessageBox類的具體用法?Python QMessageBox怎麽用?Python QMessageBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QMessageBox類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: add_packages
def add_packages(self, fnames):
"""Add packages"""
notsupported = []
notcompatible = []
dist = self.distribution
for fname in fnames:
bname = osp.basename(fname)
try:
package = wppm.Package(fname)
if package.is_compatible_with(dist):
self.add_package(package)
else:
notcompatible.append(bname)
except NotImplementedError:
notsupported.append(bname)
# PyQt4 old SIGNAL: self.emit(SIGNAL('package_added()'))
self.package_added.emit()
if notsupported:
QMessageBox.warning(
self,
"Warning",
"The following packages filenaming are <b>not "
"recognized</b> by %s:\n\n%s" % (self.winname, "<br>".join(notsupported)),
QMessageBox.Ok,
)
if notcompatible:
QMessageBox.warning(
self,
"Warning",
"The following packages "
"are <b>not compatible</b> with "
"Python <u>%s %dbit</u>:\n\n%s" % (dist.version, dist.architecture, "<br>".join(notcompatible)),
QMessageBox.Ok,
)
示例2: about
def about(self):
"""About this program"""
QMessageBox.about(
self,
"About %s" % self.NAME,
"""<b>%s %s</b>
<br>Package Manager and Advanced Tasks
<p>Copyright © 2012 Pierre Raybaut
<br>Licensed under the terms of the MIT License
<p>Created, developed and maintained by Pierre Raybaut
<p><a href="%s">WinPython at Github.io</a>: downloads, bug reports,
discussions, etc.</p>
<p>This program is executed by:<br>
<b>%s</b><br>
Python %s, Qt %s, %s %s"""
% (
self.NAME,
__version__,
__project_url__,
python_distribution_infos(),
platform.python_version(),
winpython.qt.QtCore.__version__,
winpython.qt.API_NAME,
winpython.qt.__version__,
),
)
示例3: about
def about(self):
"""About this program"""
QMessageBox.about(
self,
"About %s" % self.NAME,
"""<b>%s %s</b>
<br>Package Manager and Advanced Tasks
<p>Copyright © 2012 Pierre Raybaut
<br>Licensed under the terms of the MIT License
<p>Created, developed and maintained by Pierre Raybaut
<p>WinPython's community:
<ul><li>Bug reports and feature requests:
<a href="%s">Google Code</a>
</li><li>Discussions around the project:
<a href="%s">Google Group</a>
</li></ul>
<p>This program is executed by:<br>
<b>%s</b><br>
Python %s, Qt %s, %s %s"""
% (
self.NAME,
__version__,
__project_url__,
__forum_url__,
python_distribution_infos(),
platform.python_version(),
winpython.qt.QtCore.__version__,
winpython.qt.API_NAME,
winpython.qt.__version__,
),
)
示例4: process_packages
def process_packages(self, action):
"""Install/uninstall packages"""
if action == "install":
text, table = "Installing", self.table
if not self.get_packages_to_be_installed():
return
elif action == "uninstall":
text, table = "Uninstalling", self.untable
else:
raise AssertionError
packages = table.get_selected_packages()
if not packages:
return
func = getattr(self.distribution, action)
thread = Thread(self)
for widget in self.children():
if isinstance(widget, QWidget):
widget.setEnabled(False)
try:
status = self.statusBar()
except AttributeError:
status = self.parent().statusBar()
progress = QProgressDialog(self, Qt.FramelessWindowHint)
progress.setMaximum(len(packages)) # old vicious bug:len(packages)-1
for index, package in enumerate(packages):
progress.setValue(index)
progress.setLabelText("%s %s %s..." % (text, package.name, package.version))
QApplication.processEvents()
if progress.wasCanceled():
break
if package in table.model.actions:
try:
thread.callback = lambda: func(package)
thread.start()
while thread.isRunning():
QApplication.processEvents()
if progress.wasCanceled():
status.setEnabled(True)
status.showMessage("Cancelling operation...")
table.remove_package(package)
error = thread.error
except Exception as error:
error = to_text_string(error)
if error is not None:
pstr = package.name + " " + package.version
QMessageBox.critical(
self,
"Error",
"<b>Unable to %s <i>%s</i></b>" "<br><br>Error message:<br>%s" % (action, pstr, error),
)
progress.setValue(progress.maximum())
status.clearMessage()
for widget in self.children():
if isinstance(widget, QWidget):
widget.setEnabled(True)
thread = None
for table in (self.table, self.untable):
table.refresh_distribution(self.distribution)
示例5: select_directory
def select_directory(self):
"""Select directory"""
basedir = to_text_string(self.line_edit.text())
if not osp.isdir(basedir):
basedir = getcwd()
while True:
directory = getexistingdirectory(self, self.TITLE, basedir)
if not directory:
break
if not utils.is_python_distribution(directory):
QMessageBox.warning(self, self.TITLE,
"The following directory is not a Python distribution.",
QMessageBox.Ok)
basedir = directory
continue
directory = osp.abspath(osp.normpath(directory))
self.set_distribution(directory)
self.emit(SIGNAL('selected_distribution(QString)'), directory)
break
示例6: unregister_distribution
def unregister_distribution(self):
"""Unregister distribution"""
answer = QMessageBox.warning(self, "Unregister distribution",
"This will remove file extensions associations, icons and "
"Windows explorer's context menu entries ('Edit with IDLE', ...) "
"with selected Python distribution in Windows registry. "
"<br>Shortcuts for all WinPython launchers will be removed "
"from <i>WinPython</i> Start menu group."
"<br>If <i>pywin32</i> is installed (it should be on any "
"WinPython distribution), the Python ActiveX Scripting client "
"will also be unregistered."
"<br><br>Do you want to continue?",
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
associate.unregister(self.distribution.target)
示例7: register_distribution
def register_distribution(self):
"""Register distribution"""
answer = QMessageBox.warning(self, "Register distribution",
"This will associate file extensions, icons and "
"Windows explorer's context menu entries ('Edit with IDLE', ...) "
"with selected Python distribution in Windows registry. "
"<br>Shortcuts for all WinPython launchers will be installed "
"in <i>WinPython</i> Start menu group (replacing existing "
"shortcuts)."
"<br>If <i>pywin32</i> is installed (it should be on any "
"WinPython distribution), the Python ActiveX Scripting client "
"will also be registered."
"<br><br><u>Warning</u>: the only way to undo this change is to "
"register another Python distribution to Windows registry."
"<br><br><u>Note</u>: these actions are exactly the same as those "
"performed when installing Python with the official installer "
"for Windows.<br><br>Do you want to continue?",
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
associate.register(self.distribution.target)