forked from LBRYCommunity/lbry-sdk
update status bar app
This commit is contained in:
parent
33c1a002da
commit
59d08a92d0
2 changed files with 71 additions and 23 deletions
|
@ -3,23 +3,69 @@ import xmlrpclib
|
|||
import os
|
||||
import webbrowser
|
||||
|
||||
|
||||
class DaemonStatusBarApp(rumps.App):
|
||||
def __init__(self):
|
||||
super(DaemonStatusBarApp, self).__init__("LBRYnet", icon=os.path.join(os.path.expanduser("~"), "Downloads/lbryio//web/img/fav/apple-touch-icon.png"), quit_button=None)
|
||||
self.menu = ["Open UI", "Quit"]
|
||||
icon_path = os.path.join(os.path.expanduser("~"), "Downloads/lbryio/web/img/fav/apple-touch-icon.png")
|
||||
if os.path.isfile(icon_path):
|
||||
rumps.App.__init__(self, name="LBRY", icon=icon_path, quit_button=None,
|
||||
menu=["Open", "Preferences", "View balance", "Quit"])
|
||||
else:
|
||||
rumps.App.__init__(self, name="LBRY", title="LBRY", quit_button=None,
|
||||
menu=["Open", "Preferences", "View balance", "Quit"])
|
||||
|
||||
@rumps.clicked('Open UI')
|
||||
@rumps.clicked('Open')
|
||||
def get_ui(self):
|
||||
webbrowser.open("lbry://lbry")
|
||||
try:
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
daemon.is_running()
|
||||
webbrowser.open("lbry://lbry")
|
||||
except:
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Couldn't connect to lbrynet daemon")
|
||||
|
||||
@rumps.clicked("Preferences")
|
||||
def prefs(self, _):
|
||||
try:
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
daemon.is_running()
|
||||
webbrowser.open("lbry://settings")
|
||||
except:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
|
||||
@rumps.clicked("View balance")
|
||||
def disp_balance(self):
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
try:
|
||||
balance = daemon.get_balance()
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Your balance is " + str(balance), sound=False)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Your balance is " + str(balance))
|
||||
|
||||
except:
|
||||
try:
|
||||
rumps.notification(title='LBRY', subtitle='status', message="Couldn't connect to lbrynet daemon", sound=True)
|
||||
except:
|
||||
rumps.alert(title='LBRY', message="Couldn't connect to lbrynet daemon")
|
||||
|
||||
@rumps.clicked('Quit')
|
||||
def clean_quit(self):
|
||||
daemon = xmlrpclib.ServerProxy('http://localhost:7080')
|
||||
daemon.stop()
|
||||
try:
|
||||
daemon.stop()
|
||||
except:
|
||||
pass
|
||||
|
||||
rumps.quit_application()
|
||||
|
||||
|
||||
def main():
|
||||
DaemonStatusBarApp().run()
|
||||
status_app = DaemonStatusBarApp()
|
||||
status_app.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
36
setup.py
36
setup.py
|
@ -2,29 +2,31 @@
|
|||
|
||||
import ez_setup
|
||||
ez_setup.use_setuptools()
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
import sys
|
||||
|
||||
console_scripts = ['lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
|
||||
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||
'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
||||
'lbrynet-create-network = lbrynet.create_network:main',
|
||||
'lbrynet-launch-node = lbrynet.dht.node:main',
|
||||
'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
||||
'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
||||
'lbrynet-gui = lbrynet.lbrynet_gui.gui:start_gui',
|
||||
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
||||
'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
||||
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:main',
|
||||
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonStopper:main']
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
console_scripts.append('lbrynet-daemon-status = lbrynet.lbrynet_daemon.LBRYOSXStatusBar:main')
|
||||
|
||||
|
||||
setup(name='lbrynet',
|
||||
version='0.0.4',
|
||||
packages=find_packages(),
|
||||
install_requires=['six>=1.9.0', 'pycrypto', 'twisted', 'miniupnpc', 'yapsy', 'seccure', 'python-bitcoinrpc==0.1', 'txJSON-RPC', 'requests>=2.4.2', 'unqlite==0.2.0', 'leveldb', 'lbryum'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'lbrynet-console = lbrynet.lbrynet_console.LBRYConsole:launch_lbry_console',
|
||||
'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
||||
'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
||||
'lbrynet-create-network = lbrynet.create_network:main',
|
||||
'lbrynet-launch-node = lbrynet.dht.node:main',
|
||||
'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
||||
'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
||||
'lbrynet-gui = lbrynet.lbrynet_gui.gui:start_gui',
|
||||
'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
||||
'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
||||
'lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemon:main',
|
||||
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.LBRYDaemonStopper:main',
|
||||
]
|
||||
},
|
||||
entry_points={'console_scripts': console_scripts},
|
||||
data_files=[
|
||||
('lbrynet/lbrynet_console/plugins',
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue