move delete button to menu

This commit is contained in:
ThomasV 2017-10-22 17:30:24 +02:00
parent 4297270aae
commit 4c88159efb
1 changed files with 6 additions and 8 deletions

View File

@ -453,6 +453,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
file_menu.addAction(_("&Open"), self.open_wallet).setShortcut(QKeySequence.Open) file_menu.addAction(_("&Open"), self.open_wallet).setShortcut(QKeySequence.Open)
file_menu.addAction(_("&New/Restore"), self.new_wallet).setShortcut(QKeySequence.New) file_menu.addAction(_("&New/Restore"), self.new_wallet).setShortcut(QKeySequence.New)
file_menu.addAction(_("&Save Copy"), self.backup_wallet).setShortcut(QKeySequence.SaveAs) file_menu.addAction(_("&Save Copy"), self.backup_wallet).setShortcut(QKeySequence.SaveAs)
file_menu.addAction(_("Delete"), self.remove_wallet)
file_menu.addSeparator() file_menu.addSeparator()
file_menu.addAction(_("&Quit"), self.close) file_menu.addAction(_("&Quit"), self.close)
@ -1854,18 +1855,16 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
show_mpk(0) show_mpk(0)
vbox.addWidget(mpk_text) vbox.addWidget(mpk_text)
vbox.addStretch(1) vbox.addStretch(1)
delete_button = QPushButton(_("Delete")) vbox.addLayout(Buttons(CloseButton(dialog)))
delete_button.clicked.connect(lambda: self.remove_wallet(dialog))
vbox.addLayout(Buttons(delete_button, CloseButton(dialog)))
dialog.setLayout(vbox) dialog.setLayout(vbox)
dialog.exec_() dialog.exec_()
def remove_wallet(self, d): def remove_wallet(self):
if self.question(_('Delete wallet file') + "\n'%s'"%self.wallet.storage.path): if self.question(_('Delete wallet file') + "\n'%s'"%self.wallet.storage.path):
self._delete_wallet(d) self._delete_wallet()
@protected @protected
def _delete_wallet(self, d, password): def _delete_wallet(self, password):
wallet_path = self.wallet.storage.path wallet_path = self.wallet.storage.path
dirname = os.path.dirname(wallet_path) dirname = os.path.dirname(wallet_path)
basename = os.path.basename(wallet_path) basename = os.path.basename(wallet_path)
@ -1873,10 +1872,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
try: try:
self.wallet.check_password(pw) self.wallet.check_password(pw)
except: except:
self.show_error("Invalid PIN") self.show_error("Invalid Password")
return return
self.gui_object.daemon.stop_wallet(wallet_path) self.gui_object.daemon.stop_wallet(wallet_path)
d.close()
self.close() self.close()
os.unlink(wallet_path) os.unlink(wallet_path)
self.show_error("Wallet removed:" + basename) self.show_error("Wallet removed:" + basename)