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")
|
||||
|
||||
Reference in New Issue
Block a user