Skip to content

Commit c58ff7c

Browse files
committed
qt: wrap show_bitcoin_paper() in WaitingDialog
i noticed that the `show_bitcoin_paper()` call can be a bit slow on some machines blocking the gui for multiple seconds without giving feedback. Wrapping it in a waiting dialog gives the user some feedback that something is happening.
1 parent 56d5025 commit c58ff7c

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

electrum/gui/qt/main_window.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -874,13 +874,22 @@ def show_about(self):
874874
def show_bitcoin_paper(self):
875875
filename = os.path.join(self.config.path, 'bitcoin.pdf')
876876
if not os.path.exists(filename):
877-
s = self._fetch_tx_from_network("54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713")
878-
if not s:
879-
return
880-
s = s.split("0100000000000000")[1:-1]
881-
out = ''.join(x[6:136] + x[138:268] + x[270:400] if len(x) > 136 else x[6:] for x in s)[16:-20]
882-
with open(filename, 'wb') as f:
883-
f.write(bytes.fromhex(out))
877+
def fetch_bitcoin_paper():
878+
s = self._fetch_tx_from_network("54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713")
879+
if not s:
880+
return
881+
s = s.split("0100000000000000")[1:-1]
882+
out = ''.join(x[6:136] + x[138:268] + x[270:400] if len(x) > 136 else x[6:] for x in s)[16:-20]
883+
with open(filename, 'wb') as f:
884+
f.write(bytes.fromhex(out))
885+
WaitingDialog(
886+
self,
887+
_("Fetching Bitcoin Paper..."),
888+
fetch_bitcoin_paper,
889+
on_success=lambda _: webopen('file:///' + filename),
890+
on_error=self.on_error,
891+
)
892+
return
884893
webopen('file:///' + filename)
885894

886895
def show_update_check(self, version=None):

0 commit comments

Comments
 (0)