mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Added support for custom icons in MessageBox
This commit is contained in:
parent
327e0ae35a
commit
85e1100db3
@ -19,17 +19,23 @@ class MessageBox(QDialog, Ui_Dialog): # {{{
|
||||
INFO = 2
|
||||
QUESTION = 3
|
||||
|
||||
def __init__(self, type_, title, msg, det_msg='', show_copy_button=True,
|
||||
parent=None):
|
||||
def __init__(self, type_, title, msg,
|
||||
det_msg='',
|
||||
q_icon=None,
|
||||
show_copy_button=True,
|
||||
parent=None):
|
||||
QDialog.__init__(self, parent)
|
||||
icon = {
|
||||
self.ERROR : 'error',
|
||||
self.WARNING: 'warning',
|
||||
self.INFO: 'information',
|
||||
self.QUESTION: 'question',
|
||||
}[type_]
|
||||
icon = 'dialog_%s.png'%icon
|
||||
self.icon = QIcon(I(icon))
|
||||
if q_icon is None:
|
||||
icon = {
|
||||
self.ERROR : 'error',
|
||||
self.WARNING: 'warning',
|
||||
self.INFO: 'information',
|
||||
self.QUESTION: 'question',
|
||||
}[type_]
|
||||
icon = 'dialog_%s.png'%icon
|
||||
self.icon = QIcon(I(icon))
|
||||
else:
|
||||
self.icon = q_icon
|
||||
self.setupUi(self)
|
||||
|
||||
self.setWindowTitle(title)
|
||||
@ -44,7 +50,6 @@ class MessageBox(QDialog, Ui_Dialog): # {{{
|
||||
self.bb.ActionRole)
|
||||
self.ctc_button.clicked.connect(self.copy_to_clipboard)
|
||||
|
||||
|
||||
self.show_det_msg = _('Show &details')
|
||||
self.hide_det_msg = _('Hide &details')
|
||||
self.det_msg_toggle = self.bb.addButton(self.show_det_msg, self.bb.ActionRole)
|
||||
|
Loading…
x
Reference in New Issue
Block a user