config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now either get passed a config instance, or they try to get a reference to something else that has a reference to a config. (see lnsweep, qt/qrcodewidget, qt/qrtextedit)
This commit is contained in:
@@ -4,7 +4,7 @@ from electrum.i18n import _
|
||||
from electrum.plugin import run_hook
|
||||
from electrum.simple_config import SimpleConfig
|
||||
|
||||
from .util import ButtonsTextEdit, MessageBoxMixin, ColorScheme
|
||||
from .util import ButtonsTextEdit, MessageBoxMixin, ColorScheme, get_parent_main_window
|
||||
|
||||
|
||||
class ShowQRTextEdit(ButtonsTextEdit):
|
||||
@@ -23,7 +23,7 @@ class ShowQRTextEdit(ButtonsTextEdit):
|
||||
s = str(self.toPlainText())
|
||||
except:
|
||||
s = self.toPlainText()
|
||||
QRDialog(s).exec_()
|
||||
QRDialog(s, parent=self).exec_()
|
||||
|
||||
def contextMenuEvent(self, e):
|
||||
m = self.createStandardContextMenu()
|
||||
@@ -56,8 +56,11 @@ class ScanQRTextEdit(ButtonsTextEdit, MessageBoxMixin):
|
||||
|
||||
def qr_input(self):
|
||||
from electrum import qrscanner
|
||||
main_window = get_parent_main_window(self)
|
||||
assert main_window
|
||||
config = main_window.config
|
||||
try:
|
||||
data = qrscanner.scan_barcode(SimpleConfig.get_instance().get_video_device())
|
||||
data = qrscanner.scan_barcode(config.get_video_device())
|
||||
except BaseException as e:
|
||||
self.show_error(repr(e))
|
||||
data = ''
|
||||
|
||||
Reference in New Issue
Block a user