electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 04c7d2b4552862de0d6a985d2859d7ebbdcdb993
parent 4dd479cf59a82066faedd8c0f0f816419ab31746
Author: ThomasV <thomasv@electrum.org>
Date:   Mon, 15 Feb 2016 16:17:07 +0100

add 'donate to server' menu item

Diffstat:
Mgui/qt/main_window.py | 8++++++++
Mlib/network.py | 9+++++++++
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -450,9 +450,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): help_menu.addSeparator() help_menu.addAction(_("&Documentation"), lambda: webbrowser.open("http://docs.electrum.org/")).setShortcut(QKeySequence.HelpContents) help_menu.addAction(_("&Report Bug"), self.show_report_bug) + help_menu.addSeparator() + help_menu.addAction(_("&Donate to server"), self.donate_to_server) self.setMenuBar(menubar) + def donate_to_server(self): + if self.network.is_connected(): + d = self.network.get_donation_address() + host = self.network.get_parameters()[0] + self.pay_to_URI('bitcoin:%s?message=donation for %s'%(d, host)) + def show_about(self): QMessageBox.about(self, "Electrum", _("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" + _("Electrum's focus is speed, with low resource usage and simplifying Bitcoin. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjunction with high-performance servers that handle the most complicated parts of the Bitcoin system.")) diff --git a/lib/network.py b/lib/network.py @@ -167,6 +167,7 @@ class Network(util.DaemonThread): self.recent_servers = self.read_recent_servers() self.banner = '' + self.donation_address = '' self.fee = None self.relay_fee = None self.heights = {} @@ -289,6 +290,7 @@ class Network(util.DaemonThread): for addr in self.subscribed_addresses: self.queue_request('blockchain.address.subscribe', [addr]) self.queue_request('server.banner', []) + self.queue_request('server.donation_address', []) self.queue_request('server.peers.subscribe', []) self.queue_request('blockchain.estimatefee', [2]) self.queue_request('blockchain.relayfee', []) @@ -318,6 +320,10 @@ class Network(util.DaemonThread): host, port, protocol = deserialize_server(self.default_server) return host, port, protocol, self.proxy, self.auto_connect + def get_donation_address(self): + if self.is_connected(): + return self.donation_address + def get_interfaces(self): '''The interfaces that are in connected state''' return self.interfaces.keys() @@ -485,6 +491,9 @@ class Network(util.DaemonThread): if error is None: self.banner = result self.notify('banner') + elif method == 'server.donation_address': + if error is None: + self.donation_address = result elif method == 'blockchain.estimatefee': if error is None: self.fee = int(result * COIN)