|
|
@ -103,7 +103,10 @@ class HelpLabel(QLabel): |
|
|
|
self.font = QFont() |
|
|
|
|
|
|
|
def mouseReleaseEvent(self, x): |
|
|
|
QMessageBox.information(self, 'Help', self.help_text) |
|
|
|
custom_message_box(icon=QMessageBox.Information, |
|
|
|
parent=self, |
|
|
|
title=_('Help'), |
|
|
|
text=self.help_text) |
|
|
|
|
|
|
|
def enterEvent(self, event): |
|
|
|
self.font.setUnderline(True) |
|
|
@ -127,7 +130,10 @@ class HelpButton(QPushButton): |
|
|
|
self.clicked.connect(self.onclick) |
|
|
|
|
|
|
|
def onclick(self): |
|
|
|
QMessageBox.information(self, 'Help', self.help_text) |
|
|
|
custom_message_box(icon=QMessageBox.Information, |
|
|
|
parent=self, |
|
|
|
title=_('Help'), |
|
|
|
text=self.help_text) |
|
|
|
|
|
|
|
|
|
|
|
class InfoButton(QPushButton): |
|
|
@ -139,7 +145,10 @@ class InfoButton(QPushButton): |
|
|
|
self.clicked.connect(self.onclick) |
|
|
|
|
|
|
|
def onclick(self): |
|
|
|
QMessageBox.information(self, 'Info', self.help_text) |
|
|
|
custom_message_box(icon=QMessageBox.Information, |
|
|
|
parent=self, |
|
|
|
title=_('Info'), |
|
|
|
text=self.help_text) |
|
|
|
|
|
|
|
|
|
|
|
class Buttons(QHBoxLayout): |
|
|
@ -217,10 +226,23 @@ class MessageBoxMixin(object): |
|
|
|
return self.msg_box(QMessageBox.Information, parent, |
|
|
|
title or _('Information'), msg, **kwargs) |
|
|
|
|
|
|
|
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok, |
|
|
|
defaultButton=QMessageBox.NoButton, *, rich_text=False, |
|
|
|
def msg_box(self, icon, parent, title, text, *, buttons=QMessageBox.Ok, |
|
|
|
defaultButton=QMessageBox.NoButton, rich_text=False, |
|
|
|
checkbox=None): |
|
|
|
parent = parent or self.top_level_window() |
|
|
|
return custom_message_box(icon=icon, |
|
|
|
parent=parent, |
|
|
|
title=title, |
|
|
|
text=text, |
|
|
|
buttons=buttons, |
|
|
|
defaultButton=defaultButton, |
|
|
|
rich_text=rich_text, |
|
|
|
checkbox=checkbox) |
|
|
|
|
|
|
|
|
|
|
|
def custom_message_box(*, icon, parent, title, text, buttons=QMessageBox.Ok, |
|
|
|
defaultButton=QMessageBox.NoButton, rich_text=False, |
|
|
|
checkbox=None): |
|
|
|
if type(icon) is QPixmap: |
|
|
|
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent) |
|
|
|
d.setIconPixmap(icon) |
|
|
@ -229,7 +251,7 @@ class MessageBoxMixin(object): |
|
|
|
d.setWindowModality(Qt.WindowModal) |
|
|
|
d.setDefaultButton(defaultButton) |
|
|
|
if rich_text: |
|
|
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse| Qt.LinksAccessibleByMouse) |
|
|
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse | Qt.LinksAccessibleByMouse) |
|
|
|
d.setTextFormat(Qt.RichText) |
|
|
|
else: |
|
|
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse) |
|
|
@ -238,6 +260,7 @@ class MessageBoxMixin(object): |
|
|
|
d.setCheckBox(checkbox) |
|
|
|
return d.exec_() |
|
|
|
|
|
|
|
|
|
|
|
class WindowModalDialog(QDialog, MessageBoxMixin): |
|
|
|
'''Handy wrapper; window modal dialogs are better for our multi-window |
|
|
|
daemon model as other wallet windows can still be accessed.''' |
|
|
|