add 'donate to server' menu item
This commit is contained in:
@@ -450,9 +450,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||||||
help_menu.addSeparator()
|
help_menu.addSeparator()
|
||||||
help_menu.addAction(_("&Documentation"), lambda: webbrowser.open("http://docs.electrum.org/")).setShortcut(QKeySequence.HelpContents)
|
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.addAction(_("&Report Bug"), self.show_report_bug)
|
||||||
|
help_menu.addSeparator()
|
||||||
|
help_menu.addAction(_("&Donate to server"), self.donate_to_server)
|
||||||
|
|
||||||
self.setMenuBar(menubar)
|
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):
|
def show_about(self):
|
||||||
QMessageBox.about(self, "Electrum",
|
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."))
|
_("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."))
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ class Network(util.DaemonThread):
|
|||||||
self.recent_servers = self.read_recent_servers()
|
self.recent_servers = self.read_recent_servers()
|
||||||
|
|
||||||
self.banner = ''
|
self.banner = ''
|
||||||
|
self.donation_address = ''
|
||||||
self.fee = None
|
self.fee = None
|
||||||
self.relay_fee = None
|
self.relay_fee = None
|
||||||
self.heights = {}
|
self.heights = {}
|
||||||
@@ -289,6 +290,7 @@ class Network(util.DaemonThread):
|
|||||||
for addr in self.subscribed_addresses:
|
for addr in self.subscribed_addresses:
|
||||||
self.queue_request('blockchain.address.subscribe', [addr])
|
self.queue_request('blockchain.address.subscribe', [addr])
|
||||||
self.queue_request('server.banner', [])
|
self.queue_request('server.banner', [])
|
||||||
|
self.queue_request('server.donation_address', [])
|
||||||
self.queue_request('server.peers.subscribe', [])
|
self.queue_request('server.peers.subscribe', [])
|
||||||
self.queue_request('blockchain.estimatefee', [2])
|
self.queue_request('blockchain.estimatefee', [2])
|
||||||
self.queue_request('blockchain.relayfee', [])
|
self.queue_request('blockchain.relayfee', [])
|
||||||
@@ -318,6 +320,10 @@ class Network(util.DaemonThread):
|
|||||||
host, port, protocol = deserialize_server(self.default_server)
|
host, port, protocol = deserialize_server(self.default_server)
|
||||||
return host, port, protocol, self.proxy, self.auto_connect
|
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):
|
def get_interfaces(self):
|
||||||
'''The interfaces that are in connected state'''
|
'''The interfaces that are in connected state'''
|
||||||
return self.interfaces.keys()
|
return self.interfaces.keys()
|
||||||
@@ -485,6 +491,9 @@ class Network(util.DaemonThread):
|
|||||||
if error is None:
|
if error is None:
|
||||||
self.banner = result
|
self.banner = result
|
||||||
self.notify('banner')
|
self.notify('banner')
|
||||||
|
elif method == 'server.donation_address':
|
||||||
|
if error is None:
|
||||||
|
self.donation_address = result
|
||||||
elif method == 'blockchain.estimatefee':
|
elif method == 'blockchain.estimatefee':
|
||||||
if error is None:
|
if error is None:
|
||||||
self.fee = int(result * COIN)
|
self.fee = int(result * COIN)
|
||||||
|
|||||||
Reference in New Issue
Block a user