Browse Source

Qt: fix dialogs/wizards parent/modality

add_frost_channel_encryption
zebra-lucky 1 month ago
parent
commit
d6953f2ca4
  1. 15
      scripts/joinmarket-qt.py
  2. 22
      scripts/qtsupport.py

15
scripts/joinmarket-qt.py

@ -132,14 +132,15 @@ class JMOpenWalletDialog(QDialog, Ui_OpenWalletDialog):
DEFAULT_WALLET_FILE_TEXT = "wallet.jmdat"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.result_fut = asyncio.get_event_loop().create_future()
self.setupUi(self)
self.errorMessageLabel.setWordWrap(True);
self.passphraseEdit.setFocus()
self.chooseWalletButton.clicked.connect(lambda:
asyncio.ensure_future(self.chooseWalletFile()))
self.setModal(True)
async def chooseWalletFile(self, error_text: str = ""):
d = JMFileDialog(self)
@ -473,7 +474,7 @@ class SpendTab(QWidget):
return
#needs a set of tumbler options and destination addresses, so needs
#a wizard
wizard = ScheduleWizard()
wizard = ScheduleWizard(mainWindow)
wizard.open()
wizard_return = await wizard.result()
if wizard_return == QDialog.Rejected:
@ -785,7 +786,7 @@ class SpendTab(QWidget):
#which needs new dynamic option values. The rationale for using input
#is in case the user can increase success probability by changing them.
if self.tumbler_options == True:
wizard = TumbleRestartWizard()
wizard = TumbleRestartWizard(mainWindow)
wizard.open()
wizard_return = await wizard.result()
if wizard_return == QDialog.Rejected:
@ -1872,7 +1873,7 @@ class JMMainWindow(QMainWindow):
title="Error"))
return
self.receiver_bip78_dialog = ReceiveBIP78Dialog(
self.startReceiver, self.stopReceiver)
self, self.startReceiver, self.stopReceiver)
async def startReceiver(self):
""" Initializes BIP78 Receiving object and
@ -2059,7 +2060,7 @@ class JMMainWindow(QMainWindow):
async def seedEntry(self) -> Tuple[Optional[str], Optional[str]]:
d = QDialog(self)
d.setModal(1)
d.setModal(True)
d.setWindowTitle('Recover from mnemonic phrase')
layout = QGridLayout(d)
message_e = QTextEdit()
@ -2161,7 +2162,7 @@ class JMMainWindow(QMainWindow):
filename_text = JMOpenWalletDialog.DEFAULT_WALLET_FILE_TEXT
while not wallet_loaded:
openWalletDialog = JMOpenWalletDialog()
openWalletDialog = JMOpenWalletDialog(self)
openWalletDialog.finished.connect(openWalletDialog.on_finished)
# Set default wallet file name and verify its lock status
openWalletDialog.walletFileEdit.setText(filename_text)

22
scripts/qtsupport.py

@ -158,6 +158,7 @@ async def JMInputDialog(parent, title, label, echo_mode=QLineEdit.Normal,
def __init__(self, parent):
QInputDialog.__init__(self, parent)
self.result_fut = asyncio.get_event_loop().create_future()
self.setModal(True)
@QtCore.Slot(QMessageBox.StandardButton)
def on_finished(self, button):
@ -195,6 +196,7 @@ async def JMQtMessageBox(parent, msg, mbtype='info', title='',
self.setSizeGripEnabled(True)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.layout().setSizeConstraint(QLayout.SetMaximumSize)
self.setModal(True)
def resizeEvent(self, event):
self.setMinimumHeight(0)
@ -434,6 +436,7 @@ class JMExportPrivkeysDialog(QDialog):
super().__init__(parent=parent)
self.result_fut = asyncio.get_event_loop().create_future()
self.initUI()
self.setModal(True)
def initUI(self):
self.setWindowTitle('Private keys')
@ -470,6 +473,7 @@ async def JMPasswordDialog(parent):
super().__init__(parent=parent)
self.result_fut = asyncio.get_event_loop().create_future()
self.initUI()
self.setModal(True)
def initUI(self):
@ -949,9 +953,8 @@ class SchIntroPage(QWizardPage):
class ScheduleWizard(QWizard):
def __init__(self):
super().__init__()
self.setModal(True)
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.result_fut = asyncio.get_event_loop().create_future()
self.finished.connect(self.on_finished)
self.setWindowTitle("Joinmarket schedule generator")
@ -960,6 +963,7 @@ class ScheduleWizard(QWizard):
self.setPage(2, SchDynamicPage2(self))
#self.setPage(3, SchStaticPage(self))
self.setPage(3, SchFinishPage(self))
self.setModal(True)
@QtCore.Slot(QMessageBox.StandardButton)
def on_finished(self, button):
@ -1011,13 +1015,13 @@ class ScheduleWizard(QWizard):
class TumbleRestartWizard(QWizard):
def __init__(self):
super().__init__()
self.setModal(True)
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.result_fut = asyncio.get_event_loop().create_future()
self.finished.connect(self.on_finished)
self.setWindowTitle("Restart tumbler schedule")
self.setPage(0, RestartSettingsPage(self))
self.setModal(True)
@QtCore.Slot(QMessageBox.StandardButton)
def on_finished(self, button):
@ -1136,14 +1140,14 @@ class ReceiveBIP78Dialog(QDialog):
parameter_types = ["btc", int]
parameter_settings = ["", 0]
def __init__(self, action_fn, cancel_fn, parameter_settings=None):
def __init__(self, parent, action_fn, cancel_fn, parameter_settings=None):
""" Parameter action_fn:
each time the user opens the dialog they will
pass a function to be connected to the action-button.
Signature: no arguments, return value False if action initiation
is aborted, otherwise True.
"""
super().__init__()
super().__init__(parent)
if parameter_settings:
self.parameter_settings = parameter_settings
# these QLineEdit or QLabel objects will contain the
@ -1154,9 +1158,9 @@ class ReceiveBIP78Dialog(QDialog):
self.cancel_fn = cancel_fn
self.updates_final = False
self.initUI()
self.setModal(True)
def initUI(self):
self.setModal(1)
self.setWindowTitle("Receive Payjoin")
self.setLayout(self.get_receive_bip78_dialog())
self.show()

Loading…
Cancel
Save