1
0

Qt wizard: clean up first page a bit

This commit is contained in:
ThomasV
2025-05-24 11:00:18 +02:00
parent 45c35c0b00
commit 553aef519b

View File

@@ -265,9 +265,14 @@ class WCWalletName(WalletWizardComponent, Logger):
self.name_e = QLineEdit() self.name_e = QLineEdit()
hbox.addWidget(self.name_e) hbox.addWidget(self.name_e)
button = QPushButton(_('Choose...')) button = QPushButton(_('Choose...'))
button_create_new = QPushButton(_('New'))
hbox.addWidget(button) hbox.addWidget(button)
hbox.addWidget(button_create_new)
self.layout().addLayout(hbox) self.layout().addLayout(hbox)
outside_label = WWLabel('')
self.layout().addWidget(outside_label)
self.layout().addSpacing(50)
msg_label = WWLabel('') msg_label = WWLabel('')
self.layout().addWidget(msg_label) self.layout().addWidget(msg_label)
hbox2 = QHBoxLayout() hbox2 = QHBoxLayout()
@@ -278,17 +283,6 @@ class WCWalletName(WalletWizardComponent, Logger):
hbox2.addWidget(self.pw_e) hbox2.addWidget(self.pw_e)
hbox2.addStretch() hbox2.addStretch()
self.layout().addLayout(hbox2) self.layout().addLayout(hbox2)
self.layout().addSpacing(50)
vbox_create_new = QVBoxLayout()
vbox_create_new.addWidget(QLabel(_('Alternatively') + ':'), alignment=Qt.AlignmentFlag.AlignLeft)
button_create_new = QPushButton(_('Create New Wallet'))
button_create_new.setMinimumWidth(120)
vbox_create_new.addWidget(button_create_new, alignment=Qt.AlignmentFlag.AlignLeft)
widget_create_new = QWidget()
widget_create_new.setLayout(vbox_create_new)
vbox_create_new.setContentsMargins(0, 0, 0, 0)
self.layout().addWidget(widget_create_new)
self.layout().addStretch(1) self.layout().addStretch(1)
temp_storage = None # type: Optional[WalletStorage] temp_storage = None # type: Optional[WalletStorage]
@@ -343,8 +337,7 @@ class WCWalletName(WalletWizardComponent, Logger):
+ _("Press 'Next' to create this wallet, or choose another file.") + _("Press 'Next' to create this wallet, or choose another file.")
elif not wallet_from_memory: elif not wallet_from_memory:
if temp_storage.is_encrypted_with_user_pw(): if temp_storage.is_encrypted_with_user_pw():
msg = _("This file is encrypted with a password.") + '\n' \ msg = _("This file is encrypted with a password.")
+ _('Enter your password or choose another file.')
user_needs_to_enter_password = True user_needs_to_enter_password = True
elif temp_storage.is_encrypted_with_hw_device(): elif temp_storage.is_encrypted_with_hw_device():
msg = _("This file is encrypted using a hardware device.") + '\n' \ msg = _("This file is encrypted using a hardware device.") + '\n' \
@@ -358,9 +351,11 @@ class WCWalletName(WalletWizardComponent, Logger):
if msg is None: if msg is None:
msg = _('Cannot read file') msg = _('Cannot read file')
if filename and os.path.isabs(relative_path(_path)): if filename and os.path.isabs(relative_path(_path)):
msg += '\n\n' + _('Note: this wallet file is outside the default wallets folder.') outside_text = _('Note: this wallet file is outside the default wallets folder.')
else:
outside_text = ''
outside_label.setText(outside_text)
msg_label.setText(msg) msg_label.setText(msg)
widget_create_new.setVisible(bool(temp_storage and temp_storage.file_exists()))
if user_needs_to_enter_password: if user_needs_to_enter_password:
pw_label.show() pw_label.show()
self.pw_e.show() self.pw_e.show()