From d7515b936e32efc02f6b4b0dd97b8520b5c447a7 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 22 Jan 2021 14:37:08 +0100 Subject: [PATCH] Qt: download and show bitcoin whitepaper. fixes #6970 --- electrum/gui/qt/main_window.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index add864746..bef6e574f 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -766,6 +766,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): help_menu.addAction(_("&Official website"), lambda: webopen("https://electrum.org")) help_menu.addSeparator() help_menu.addAction(_("&Documentation"), lambda: webopen("http://docs.electrum.org/")).setShortcut(QKeySequence.HelpContents) + help_menu.addAction(_("&Bitcoin Paper"), self.show_bitcoin_paper) help_menu.addAction(_("&Report Bug"), self.show_report_bug) help_menu.addSeparator() help_menu.addAction(_("&Donate to server"), self.donate_to_server) @@ -790,6 +791,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): "servers that handle the most complicated parts of the Bitcoin system.") + "\n\n" + _("Uses icons from the Icons8 icon pack (icons8.com)."))) + def show_bitcoin_paper(self): + filename = os.path.join(self.config.path, 'bitcoin.pdf') + if not os.path.exists(filename): + s = self.network.run_from_another_thread( + self.network.get_transaction("54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713")) + s = s.split("0100000000000000")[1:-1] + out = ''.join(x[6:136] + x[138:268] + x[270:400] if len(x) > 136 else x[6:] for x in s)[16:-20] + with open(filename, 'wb') as f: + f.write(bytes.fromhex(out)) + webopen('file:///' + filename) + def show_update_check(self, version=None): self.gui_object._update_check = UpdateCheck(latest_version=version)