Browse Source

Qt: replace QInputDialog with JMInputDialog

add_frost_channel_encryption
zebra-lucky 2 months ago
parent
commit
0691795322
  1. 35
      scripts/joinmarket-qt.py

35
scripts/joinmarket-qt.py

@ -2201,9 +2201,8 @@ class JMMainWindow(QMainWindow):
log.debug('Looking for wallet in: ' + str(filename))
decrypted = False
while not decrypted:
text, ok = QInputDialog.getText(self,
'Decrypt wallet',
'Enter your password:',
text, ok = await JMInputDialog(
self, 'Decrypt wallet', 'Enter your password:',
echo=QLineEdit.Password)
if not ok:
return
@ -2221,10 +2220,10 @@ class JMMainWindow(QMainWindow):
self.close()
else:
if not testnet_seed:
testnet_seed, ok = QInputDialog.getText(self,
'Load Testnet wallet',
'Enter a testnet seed:',
testnet_seed, ok = await JMInputDialog(
self, 'Load Testnet wallet', 'Enter a testnet seed:',
QLineEdit.Normal)
if testnet_seed:
testnet_seed = testnet_seed.strip()
if not ok or not testnet_seed:
await JMQtMessageBox(self, "No seed entered, aborting",
@ -2344,11 +2343,11 @@ class JMMainWindow(QMainWindow):
else:
await self.initWallet()
def checkPassphrase(self):
async def checkPassphrase(self):
match = False
while not match:
text, ok = QInputDialog.getText(self, 'Passphrase check',
'Enter your passphrase:',
text, ok = await JMInputDialog(
self, 'Passphrase check', 'Enter your passphrase:',
echo=QLineEdit.Password)
if not ok:
return False
@ -2367,7 +2366,7 @@ class JMMainWindow(QMainWindow):
mbtype="crit", title="Error")
return
change_res = False
check_res = self.checkPassphrase()
check_res = await self.checkPassphrase()
if check_res:
change_res = await wallet_change_passphrase(
self.wallet_service, self.getPassword)
@ -2381,6 +2380,7 @@ class JMMainWindow(QMainWindow):
async def getTestnetSeed(self):
text, ok = await JMInputDialog(
self, 'Testnet seed', 'Enter a 32 char hex string as seed:')
if text:
text = text.strip()
if not ok or not text:
await JMQtMessageBox(self, "No seed entered, aborting",
@ -2409,9 +2409,9 @@ class JMMainWindow(QMainWindow):
self.textpassword = textpassword = await JMPasswordDialog(parent=self)
return textpassword.encode('utf-8') if textpassword else textpassword
def getWalletFileName(self) -> str:
walletname, ok = QInputDialog.getText(self, 'Choose wallet name',
'Enter wallet file name:',
async def getWalletFileName(self) -> str:
walletname, ok = await JMInputDialog(
self, 'Choose wallet name', 'Enter wallet file name:',
QLineEdit.Normal, "wallet.jmdat")
if not ok:
asyncio.ensure_future(
@ -2419,7 +2419,7 @@ class JMMainWindow(QMainWindow):
# cannot use None for a 'fail' condition, as this is used
# for the case where the default wallet name is to be used in non-Qt.
return "cancelled"
self.walletname = str(walletname)
self.walletname = str(walletname).strip()
return self.walletname
def displayWords(self, words: str, mnemonic_extension: str) -> None:
@ -2446,10 +2446,9 @@ class JMMainWindow(QMainWindow):
mbtype='question')
return reply == QMessageBox.Yes
def promptInputMnemonicExtension(self) -> Optional[str]:
mnemonic_extension, ok = QInputDialog.getText(self,
'Input Mnemonic Extension',
'Enter mnemonic Extension:',
async def promptInputMnemonicExtension(self) -> Optional[str]:
mnemonic_extension, ok = await JMInputDialog(
self, 'Input Mnemonic Extension', 'Enter mnemonic Extension:',
QLineEdit.Normal, "")
if not ok:
return None

Loading…
Cancel
Save