mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
parent
162d81c156
commit
99f9a1b484
3 changed files with 31 additions and 2 deletions
|
@ -198,6 +198,7 @@ class ElectrumGui(PrintError):
|
||||||
self.build_tray_menu()
|
self.build_tray_menu()
|
||||||
# FIXME: Remove in favour of the load_wallet hook
|
# FIXME: Remove in favour of the load_wallet hook
|
||||||
run_hook('on_new_window', w)
|
run_hook('on_new_window', w)
|
||||||
|
w.warn_if_testnet()
|
||||||
w.warn_if_watching_only()
|
w.warn_if_watching_only()
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
|
|
@ -468,7 +468,32 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
_("This means you will not be able to spend Bitcoins with it."),
|
_("This means you will not be able to spend Bitcoins with it."),
|
||||||
_("Make sure you own the seed phrase or the private keys, before you request Bitcoins to be sent to this wallet.")
|
_("Make sure you own the seed phrase or the private keys, before you request Bitcoins to be sent to this wallet.")
|
||||||
])
|
])
|
||||||
self.show_warning(msg, title=_('Information'))
|
self.show_warning(msg, title=_('Watch-only wallet'))
|
||||||
|
|
||||||
|
def warn_if_testnet(self):
|
||||||
|
if not constants.net.TESTNET:
|
||||||
|
return
|
||||||
|
# user might have opted out already
|
||||||
|
if self.config.get('dont_show_testnet_warning', False):
|
||||||
|
return
|
||||||
|
# only show once per process lifecycle
|
||||||
|
if getattr(self.gui_object, '_warned_testnet', False):
|
||||||
|
return
|
||||||
|
self.gui_object._warned_testnet = True
|
||||||
|
msg = ''.join([
|
||||||
|
_("You are in testnet mode."), ' ',
|
||||||
|
_("Testnet coins are worthless."), '\n',
|
||||||
|
_("Testnet is separate from the main Bitcoin network. It is used for testing.")
|
||||||
|
])
|
||||||
|
cb = QCheckBox(_("Don't show this again."))
|
||||||
|
cb_checked = False
|
||||||
|
def on_cb(x):
|
||||||
|
nonlocal cb_checked
|
||||||
|
cb_checked = x == Qt.Checked
|
||||||
|
cb.stateChanged.connect(on_cb)
|
||||||
|
self.show_warning(msg, title=_('Testnet'), checkbox=cb)
|
||||||
|
if cb_checked:
|
||||||
|
self.config.set_key('dont_show_testnet_warning', True)
|
||||||
|
|
||||||
def open_wallet(self):
|
def open_wallet(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -218,7 +218,8 @@ class MessageBoxMixin(object):
|
||||||
title or _('Information'), msg, **kwargs)
|
title or _('Information'), msg, **kwargs)
|
||||||
|
|
||||||
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
|
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
|
||||||
defaultButton=QMessageBox.NoButton, rich_text=False):
|
defaultButton=QMessageBox.NoButton, *, rich_text=False,
|
||||||
|
checkbox=None):
|
||||||
parent = parent or self.top_level_window()
|
parent = parent or self.top_level_window()
|
||||||
if type(icon) is QPixmap:
|
if type(icon) is QPixmap:
|
||||||
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
|
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
|
||||||
|
@ -233,6 +234,8 @@ class MessageBoxMixin(object):
|
||||||
else:
|
else:
|
||||||
d.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
d.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||||
d.setTextFormat(Qt.PlainText)
|
d.setTextFormat(Qt.PlainText)
|
||||||
|
if checkbox is not None:
|
||||||
|
d.setCheckBox(checkbox)
|
||||||
return d.exec_()
|
return d.exec_()
|
||||||
|
|
||||||
class WindowModalDialog(QDialog, MessageBoxMixin):
|
class WindowModalDialog(QDialog, MessageBoxMixin):
|
||||||
|
|
Loading…
Add table
Reference in a new issue