-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert2cc #7700
base: master
Are you sure you want to change the base?
Convert2cc #7700
Changes from all commits
cc903e3
995c253
c5830c2
f5db121
6584a72
e1f08f9
3497b7e
652bc51
2f20d4c
0d3b2f0
6713b1f
9404068
5d4dcbf
bd7bb75
68623c6
6d9b06b
9d64f8f
c048f29
465b129
46ce92f
bc98438
51df1b5
f98e70e
c211f04
01f9006
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,8 @@ | |
import csv | ||
from decimal import Decimal | ||
import base64 | ||
from functools import partial | ||
from functools import partial, reduce | ||
import operator | ||
import queue | ||
import asyncio | ||
from typing import Optional, TYPE_CHECKING, Sequence, List, Union | ||
|
@@ -593,15 +594,16 @@ def on_cb(x): | |
if cb_checked: | ||
self.config.set_key('dont_show_testnet_warning', True) | ||
|
||
def open_wallet(self): | ||
def open_wallet(self, filename=None): | ||
try: | ||
wallet_folder = self.get_wallet_folder() | ||
except FileNotFoundError as e: | ||
self.show_error(str(e)) | ||
return | ||
filename, __ = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) | ||
if not filename: | ||
return | ||
filename, __ = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder) | ||
if not filename: | ||
return | ||
self.gui_object.new_window(filename) | ||
|
||
def select_backup_dir(self, b): | ||
|
@@ -2471,6 +2473,7 @@ def show_wallet_info(self): | |
seed_available += f" ({ks.get_seed_type()})" | ||
keystore_types = [k.get_type_text() for k in self.wallet.get_keystores()] | ||
grid = QGridLayout() | ||
# this can be changed to self.wallet.storage.basename() | ||
basename = os.path.basename(self.wallet.storage.path) | ||
grid.addWidget(WWLabel(_("Wallet name")+ ':'), 0, 0) | ||
grid.addWidget(WWLabel(basename), 0, 1) | ||
|
@@ -2571,17 +2574,21 @@ def label(idx, ks): | |
ks_vbox.addWidget(WWLabel(_("Master Public Key"))) | ||
ks_vbox.addWidget(mpk_text) | ||
ks_vbox.addLayout(der_path_hbox) | ||
|
||
ks_stack.addWidget(ks_w) | ||
|
||
select_ks(0) | ||
vbox.addWidget(ks_stack) | ||
|
||
vbox.addStretch(1) | ||
btn_export_info = run_hook('wallet_info_buttons', self, dialog) | ||
wallet_info_btns = run_hook('wallet_info_buttons', self, dialog) | ||
btn_close = CloseButton(dialog) | ||
btns = Buttons(btn_export_info, btn_close) | ||
vbox.addLayout(btns) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar to https://github.com/spesmilo/electrum/pull/7682/files where we need an ability to add multiple buttons to wallet information dialog |
||
if wallet_info_btns: | ||
# now more than one wallet_info_butons hook, needs concat | ||
wallet_info_btns = reduce(operator.concat, wallet_info_btns) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now we also expect more than one hook to provide data |
||
buttons = Buttons(*wallet_info_btns, btn_close) | ||
else: | ||
buttons = Buttons(btn_close) | ||
vbox.addLayout(buttons) | ||
dialog.setLayout(vbox) | ||
dialog.exec_() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,6 +232,8 @@ def run_hook(name, *args): | |
results.append(r) | ||
|
||
if results: | ||
if name == "wallet_info_buttons": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure If I understand this constraint - why can only one result from hook be accepted? Here I expect more than one hook to provide data |
||
return results | ||
assert len(results) == 1, results | ||
return results[0] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from electrum.i18n import _ | ||
|
||
fullname = _('convert2cc') | ||
description = _('Provides support for converting hardware wallet to Coldcard') | ||
requires = [('ckcc', 'github.com/Coldcard/ckcc-protocol')] | ||
available_for = ['qt'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add ability to skip
getOpenFileName
dialog if filename is provided