diff --git a/gui/qt/console.py b/gui/qt/console.py index 2b49d93c6..d0b10a30d 100644 --- a/gui/qt/console.py +++ b/gui/qt/console.py @@ -7,6 +7,7 @@ from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5 import QtWidgets from electrum import util +from electrum.i18n import _ if platform.system() == 'Windows': @@ -17,6 +18,33 @@ else: MONOSPACE_FONT = 'monospace' +class OverlayLabel(QtWidgets.QLabel): + STYLESHEET = ''' + QLabel, QLabel link { + color: rgb(0, 0, 0); + background-color: rgb(248, 240, 200); + border: 1px solid; + border-color: rgb(255, 114, 47); + padding: 2px; + } + ''' + def __init__(self, text, parent): + super().__init__(text, parent) + self.setMinimumHeight(150) + self.setGeometry(0, 0, self.width(), self.height()) + self.setStyleSheet(self.STYLESHEET) + self.setMargin(0) + parent.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.setWordWrap(True) + + def mousePressEvent(self, e): + self.hide() + + def on_resize(self, w): + padding = 2 # px, from the stylesheet above + self.setFixedWidth(w - padding) + + class Console(QtWidgets.QPlainTextEdit): def __init__(self, prompt='>> ', startup_message='', parent=None): QtWidgets.QPlainTextEdit.__init__(self, parent) @@ -35,6 +63,18 @@ class Console(QtWidgets.QPlainTextEdit): self.updateNamespace({'run':self.run_script}) self.set_json(False) + warning_text = "