qt: rm some usages of get_parent_main_window
instead, pass around the main window or config (whichever is actually needed) fixes #6342
This commit is contained in:
@@ -5,8 +5,9 @@ import copy
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtWidgets import QPushButton, QLabel, QVBoxLayout, QWidget, QGridLayout
|
||||
|
||||
from electrum.gui.qt.util import WindowModalDialog, CloseButton, get_parent_main_window, Buttons
|
||||
from electrum.gui.qt.util import WindowModalDialog, CloseButton, Buttons
|
||||
from electrum.gui.qt.transaction_dialog import TxDialog
|
||||
from electrum.gui.qt.main_window import ElectrumWindow
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum.plugin import hook
|
||||
@@ -92,7 +93,7 @@ class Coldcard_Handler(QtHandlerBase):
|
||||
|
||||
class CKCCSettingsDialog(WindowModalDialog):
|
||||
|
||||
def __init__(self, window, plugin, keystore):
|
||||
def __init__(self, window: ElectrumWindow, plugin, keystore):
|
||||
title = _("{} Settings").format(plugin.device)
|
||||
super(CKCCSettingsDialog, self).__init__(window, title)
|
||||
self.setMaximumWidth(540)
|
||||
@@ -104,6 +105,8 @@ class CKCCSettingsDialog(WindowModalDialog):
|
||||
#handler = keystore.handler
|
||||
self.thread = thread = keystore.thread
|
||||
self.keystore = keystore
|
||||
assert isinstance(window, ElectrumWindow), f"{type(window)}"
|
||||
self.window = window
|
||||
|
||||
def connect_and_doit():
|
||||
# Attempt connection to device, or raise.
|
||||
@@ -188,7 +191,7 @@ class CKCCSettingsDialog(WindowModalDialog):
|
||||
|
||||
def start_upgrade(self, client):
|
||||
# ask for a filename (must have already downloaded it)
|
||||
mw = get_parent_main_window(self)
|
||||
mw = self.window
|
||||
dev = client.dev
|
||||
|
||||
fileName = mw.getOpenFileName("Select upgraded firmware file", "*.dfu")
|
||||
|
||||
@@ -43,7 +43,7 @@ from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QLineEdit,
|
||||
QInputDialog)
|
||||
|
||||
from electrum.gui.qt.util import (EnterButton, Buttons, CloseButton, OkButton,
|
||||
WindowModalDialog, get_parent_main_window)
|
||||
WindowModalDialog)
|
||||
from electrum.gui.qt.main_window import ElectrumWindow
|
||||
|
||||
from electrum.plugin import BasePlugin, hook
|
||||
@@ -176,8 +176,7 @@ class Plugin(BasePlugin):
|
||||
#main_window.invoice_list.update()
|
||||
|
||||
@hook
|
||||
def receive_list_menu(self, menu, addr):
|
||||
window = get_parent_main_window(menu)
|
||||
def receive_list_menu(self, window: ElectrumWindow, menu, addr):
|
||||
menu.addAction(_("Send via e-mail"), lambda: self.send(window, addr))
|
||||
|
||||
def send(self, window: ElectrumWindow, addr):
|
||||
|
||||
@@ -116,7 +116,7 @@ class Plugin(RevealerPlugin):
|
||||
bcreate.setMaximumWidth(181)
|
||||
bcreate.setDefault(True)
|
||||
vbox.addWidget(bcreate, Qt.AlignCenter)
|
||||
self.load_noise = ScanQRTextEdit()
|
||||
self.load_noise = ScanQRTextEdit(config=self.config)
|
||||
self.load_noise.setTabChangesFocus(True)
|
||||
self.load_noise.textChanged.connect(self.on_edit)
|
||||
self.load_noise.setMaximumHeight(33)
|
||||
@@ -253,7 +253,7 @@ class Plugin(RevealerPlugin):
|
||||
self.vbox.addWidget(cprint)
|
||||
self.vbox.addSpacing(1)
|
||||
self.vbox.addWidget(WWLabel("<b>"+_("OR")+"</b> "+_("type a custom alphanumerical secret below:")))
|
||||
self.text = ScanQRTextEdit()
|
||||
self.text = ScanQRTextEdit(config=self.config)
|
||||
self.text.setTabChangesFocus(True)
|
||||
self.text.setMaximumHeight(70)
|
||||
self.text.textChanged.connect(self.customtxt_limits)
|
||||
|
||||
Reference in New Issue
Block a user