diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py index 35abd7aaf..d6ff3f9be 100644 --- a/gui/qt/paytoedit.py +++ b/gui/qt/paytoedit.py @@ -31,8 +31,9 @@ frozen_style = "QWidget { background-color:none; border:none;}" normal_style = "QPlainTextEdit { }" class PayToEdit(ScanQRTextEdit): + def __init__(self, win): - super(PayToEdit,self).__init__(win=win) + ScanQRTextEdit.__init__(self) self.amount_edit = win.amount_e self.document().contentsChanged.connect(self.update_size) self.heightMin = 0 @@ -42,7 +43,7 @@ class PayToEdit(ScanQRTextEdit): self.outputs = [] self.errors = [] self.is_pr = False - self.scan_f = self.win.pay_from_URI + self.scan_f = win.pay_from_URI self.update_size() self.payto_address = None diff --git a/gui/qt/qrtextedit.py b/gui/qt/qrtextedit.py index e23700a9a..b182c0274 100644 --- a/gui/qt/qrtextedit.py +++ b/gui/qt/qrtextedit.py @@ -7,8 +7,9 @@ from util import ButtonsTextEdit class ShowQRTextEdit(ButtonsTextEdit): + def __init__(self, text=None): - super(ShowQRTextEdit, self).__init__(text) + ButtonsTextEdit__init__(self, text) self.setReadOnly(1) self.addButton(":icons/qrcode.png", self.qr_show, _("Show as QR code")) run_hook('show_text_edit', self) @@ -28,13 +29,10 @@ class ShowQRTextEdit(ButtonsTextEdit): class ScanQRTextEdit(ButtonsTextEdit): - def __init__(self, win, text=""): - super(ScanQRTextEdit,self).__init__(text) + + def __init__(self, text=""): + ButtonsTextEdit.__init__(self, text) self.setReadOnly(0) - self.win = win - assert win, "You must pass a window with access to the config to ScanQRTextEdit constructor." - if win: - assert hasattr(win,"config"), "You must pass a window with access to the config to ScanQRTextEdit constructor." self.addButton(":icons/file.png", self.file_input, _("Read file")) self.addButton(":icons/qrcode.png", self.qr_input, _("Read QR code")) run_hook('scan_text_edit', self) @@ -48,9 +46,9 @@ class ScanQRTextEdit(ButtonsTextEdit): self.setText(data) def qr_input(self): - from electrum import qrscanner + from electrum import qrscanner, get_config try: - data = qrscanner.scan_qr(self.win.config) + data = qrscanner.scan_qr(get_config()) except BaseException, e: QMessageBox.warning(self, _('Error'), _(e), _('OK')) return "" diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py index cc7794380..b9d5a5375 100644 --- a/gui/qt/seed_dialog.py +++ b/gui/qt/seed_dialog.py @@ -23,7 +23,6 @@ from electrum.i18n import _ from electrum import mnemonic from util import * -from qrcodewidget import QRCodeWidget, QRDialog from qrtextedit import ShowQRTextEdit, ScanQRTextEdit class SeedDialog(QDialog): @@ -73,7 +72,7 @@ def enter_seed_box(msg, window, sid=None, text=None): label = QLabel(msg) label.setWordWrap(True) if not text: - seed_e = ScanQRTextEdit(win=window) + seed_e = ScanQRTextEdit() seed_e.setTabChangesFocus(True) else: seed_e = ShowQRTextEdit(text=text) diff --git a/gui/qt/util.py b/gui/qt/util.py index 6e38c2c74..ae5fd4b78 100644 --- a/gui/qt/util.py +++ b/gui/qt/util.py @@ -200,7 +200,7 @@ def text_dialog(parent, title, label, ok_label, default=None): l = QVBoxLayout() dialog.setLayout(l) l.addWidget(QLabel(label)) - txt = ScanQRTextEdit(parent) + txt = ScanQRTextEdit() if default: txt.setText(default) l.addWidget(txt)