本文整理汇总了Python中guidata.qt.QtGui.QMessageBox类的典型用法代码示例。如果您正苦于以下问题:Python QMessageBox类的具体用法?Python QMessageBox怎么用?Python QMessageBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMessageBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: about
def about(self):
QMessageBox.about( self, _("About ")+APP_NAME,
"""<b>%s</b> v%s<p>%s Pierre Raybaut
<br>Copyright © 2009-2010 CEA
<p>Python %s, Qt %s, PyQt %s %s %s""" % \
(APP_NAME, VERSION, _("Developped by"), platform.python_version(),
QT_VERSION_STR, PYQT_VERSION_STR, _("on"), platform.system()) )
示例2: about
def about( self ):
QMessageBox.about( self, _("About ")+APP_NAME,
"""<b>%s</b> v%s<p>%s Darko Petrovic
<br>(Lisence goes here)
<p>Python %s, Qt %s, PyQt %s %s %s""" % \
(APP_NAME, VERSION, _("Developped by"), platform.python_version(),
QT_VERSION_STR, PYQT_VERSION_STR, _("on"), platform.system()) )
示例3: showWarning
def showWarning(message):
"""
shows a warning dialog with given message
"""
app = guidata.qapplication()
QMessageBox.warning(None, "Warning", message)
示例4: exec_image_open_dialog
def exec_image_open_dialog(parent, basedir='', app_name=None,
to_grayscale=True, dtype=None):
"""
Executes an image open dialog box (QFileDialog.getOpenFileName)
* parent: parent widget (None means no parent)
* basedir: base directory ('' means current directory)
* app_name (opt.): application name (used as a title for an eventual
error message box in case something goes wrong when saving image)
* to_grayscale (default=True): convert image to grayscale
Returns (filename, data) tuple if dialog is accepted, None otherwise
"""
saved_in, saved_out, saved_err = sys.stdin, sys.stdout, sys.stderr
sys.stdout = None
filename, _filter = getopenfilename(parent, _("Open"), basedir,
io.iohandler.get_filters('load', dtype=dtype))
sys.stdin, sys.stdout, sys.stderr = saved_in, saved_out, saved_err
filename = to_text_string(filename)
try:
data = io.imread(filename, to_grayscale=to_grayscale)
except Exception as msg:
import traceback
traceback.print_exc()
QMessageBox.critical(parent,
_('Error') if app_name is None else app_name,
(_("%s could not be opened:") % osp.basename(filename))+\
"\n"+str(msg))
return
return filename, data
示例5: exec_image_save_dialog
def exec_image_save_dialog(parent, data, template=None,
basedir='', app_name=None):
"""
Executes an image save dialog box (QFileDialog.getSaveFileName)
* parent: parent widget (None means no parent)
* data: image pixel array data
* template: image template (pydicom dataset) for DICOM files
* basedir: base directory ('' means current directory)
* app_name (opt.): application name (used as a title for an eventual
error message box in case something goes wrong when saving image)
Returns filename if dialog is accepted, None otherwise
"""
saved_in, saved_out, saved_err = sys.stdin, sys.stdout, sys.stderr
sys.stdout = None
filename, _filter = getsavefilename(parent, _("Save as"), basedir,
io.iohandler.get_filters('save', dtype=data.dtype, template=template))
sys.stdin, sys.stdout, sys.stderr = saved_in, saved_out, saved_err
if filename:
filename = to_text_string(filename)
kwargs = {}
if osp.splitext(filename)[1].lower() == '.dcm':
kwargs['template'] = template
try:
io.imwrite(filename, data, **kwargs)
return filename
except Exception as msg:
import traceback
traceback.print_exc()
QMessageBox.critical(parent,
_('Error') if app_name is None else app_name,
(_("%s could not be written:") % osp.basename(filename))+\
"\n"+str(msg))
return
示例6: showInformation
def showInformation(message):
"""
shows a information dialog with given message
"""
app = guidata.qapplication()
QMessageBox.information(None, "Information", message)
示例7: inner
def inner(ds, it, value, parent, target=target):
invalidFields = ds.check()
if len(invalidFields):
msg = "The following fields are invalid: \n"
msg += "\n".join(invalidFields)
QMessageBox.warning(parent, "Error", msg)
return
target()
示例8: about
def about(self):
QMessageBox.about( self, _("About ")+APP_NAME,
"""<b>%s</b> v%s<br>%s<p>
<br>Copyright © François Bianco, University of Geneva
<br>[email protected]
<br>Distributed under the GNU GPL License v.3
""" % \
(APP_NAME, VERSION, APP_DESC))
示例9: wrapped
def wrapped(ds, it, value, parent):
# check inputs before callback is executed
invalidFields = ds.check()
if len(invalidFields):
msg = "The following fields are invalid: \n"
msg += "\n".join(invalidFields)
QMessageBox.warning(parent, "Error", msg)
return
callback(ds)
示例10: check
def check(self):
is_ok = True
for edl in self.edit_layout:
if not edl.check_all_values():
is_ok = False
if not is_ok:
QMessageBox.warning(self, self.instance.get_title(),
_("Some required entries are incorrect")+".\n",
_("Please check highlighted fields."))
return False
return True
示例11: on_actionAbout_triggered
def on_actionAbout_triggered(self):
QMessageBox.about(self, "About Zupport GUI",
"""<b>Zupport GUI</b> v %s
<p>Copyright © 2011 Joona Lehtomaki
<[email protected]>.
All rights reserved.
<p>Support zools for Zonation related pre- and post-processing operations.</p>
<p>Python %s - Qt %s - PySide %s on %s</p>""" % (
__version__, platform.python_version(),
QT_VERSION,
PYQT_VERSION, platform.system()))
示例12: on_actionOpen_log_triggered
def on_actionOpen_log_triggered(self):
logfile = os.path.join(USER_DATA_DIR, 'zupport.log')
if os.path.exists(logfile):
import webbrowser
webbrowser.open(logfile)
self.logger.debug('Opened log file %s' % logfile)
else:
msg = "Zupport log file cannot be found in default location %s" % os.path.dirname(logfile)
self.logger.debug(msg)
QMessageBox.warning(self, "File not found",
msg,
buttons=QMessageBox.Ok,
defaultButton=QMessageBox.NoButton)
示例13: edit
def edit(self):
import guidata
from guidata.qt.QtGui import QMessageBox
app = guidata.qapplication()
while True:
aborted = self.parameters.edit(size=(600, 800)) == 0
if not aborted:
ok, msg = self.check_fields()
if not ok:
QMessageBox.warning(None, "Error", msg)
continue
global global_config
global_config = self
break
return aborted
示例14: stop_button
def stop_button( self ):
sel = 0
if self.sessiontype == 'timed':
sel = QMessageBox.warning( self, "Timed Session",
"A Timed Session is currently active!\nIf you stop the session "
"the session will be stored as a free session.", "OK", "Cancel")
if sel == 0:
self.session_stop()
示例15: askYesNo
def askYesNo(message, allow_cancel=False, title="Question"):
"""shows message and asks for "yes" or "no" (or "cancel" if allow_cancel is True).
returns True, False (or None).
"""
app = guidata.qapplication()
flags = QMessageBox.Yes | QMessageBox.No
if allow_cancel:
flags |= QMessageBox.Cancel
reply = QMessageBox.question(None, title, message, flags)
if reply == QMessageBox.Cancel:
return None
else:
return reply == QMessageBox.Yes