forked from LBRYCommunity/lbry-sdk
update status bar app
This commit is contained in:
parent
a243ac7a01
commit
2fc3ec7224
4 changed files with 29 additions and 10 deletions
BIN
app.icns
Normal file
BIN
app.icns
Normal file
Binary file not shown.
|
@ -7,6 +7,7 @@ import xmlrpclib
|
|||
import subprocess
|
||||
import logging
|
||||
import argparse
|
||||
import pwd
|
||||
|
||||
from twisted.web import xmlrpc, server
|
||||
from twisted.internet import defer, threads, reactor, error
|
||||
|
@ -69,8 +70,6 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
self.db_dir = os.path.join(os.path.expanduser("~"), ".lbrynet")
|
||||
else:
|
||||
self.db_dir = os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrynet")
|
||||
# from lbrynet.lbrynet_daemon.LBRYOSXStatusBar import DaemonStatusBarApp
|
||||
# self.status_app = DaemonStatusBarApp()
|
||||
self.blobfile_dir = os.path.join(self.db_dir, "blobfiles")
|
||||
self.peer_port = 3333
|
||||
self.dht_node_port = 4444
|
||||
|
@ -813,6 +812,7 @@ class LBRYDaemon(xmlrpc.XMLRPC):
|
|||
|
||||
d = defer.Deferred()
|
||||
d.addCallback(lambda _: _make_file(html, path))
|
||||
d.addCallback(lambda _: os.chown(path, pwd.getpwuid(os.getuid()).pw_uid, pwd.getpwuid(os.getuid()).pw_gid))
|
||||
d.addCallback(lambda _: webbrowser.open('file://' + path))
|
||||
d.addErrback(_disp_err)
|
||||
d.callback(None)
|
||||
|
|
|
@ -8,13 +8,7 @@ import argparse
|
|||
|
||||
class DaemonStatusBarApp(rumps.App):
|
||||
def __init__(self):
|
||||
#detect if being run as root, if so find the correct icon path
|
||||
if os.path.expanduser("~") != '/var/root':
|
||||
icon_path = os.path.join(os.path.expanduser("~"), "Downloads/lbryio/web/img/fav/apple-touch-icon.png")
|
||||
else:
|
||||
icon_path = os.path.join("/Users",
|
||||
subprocess.check_output('echo $SUDO_USER', shell=True)[:-1],
|
||||
"Downloads/lbryio/web/img/fav/apple-touch-icon.png")
|
||||
icon_path = 'app.icns'
|
||||
|
||||
if os.path.isfile(icon_path):
|
||||
rumps.App.__init__(self, name="LBRY", icon=icon_path, quit_button=None,
|
||||
|
@ -80,7 +74,10 @@ def main():
|
|||
args = parser.parse_args()
|
||||
|
||||
if str(args.startdaemon).lower() == "true":
|
||||
subprocess.Popen("screen -dmS lbrynet bash -c 'lbrynet-daemon'", shell=True)
|
||||
subprocess.Popen("screen -dmS lbrynet bash -c "
|
||||
"'PYTHONPATH=$PYTHONPATH:`cat /Users/${USER}/Library/Application\ Support/lbrynet/.python_path`; "
|
||||
"PATH=$PATH:`cat /Users/${USER}/Library/Application\ Support/lbrynet/.lbry_bin_path`; "
|
||||
"lbrynet-daemon --update=False'", shell=True)
|
||||
|
||||
status_app = DaemonStatusBarApp()
|
||||
status_app.run()
|
||||
|
|
22
setup_osx.py
Normal file
22
setup_osx.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import os
|
||||
from setuptools import setup
|
||||
|
||||
APP = [os.path.join('lbrynet', 'lbrynet_daemon', 'LBRYOSXStatusBar.py')]
|
||||
DATA_FILES = []
|
||||
OPTIONS = {
|
||||
'argv_emulation': True,
|
||||
'iconfile': 'app.icns',
|
||||
'plist': {
|
||||
'LSUIElement': True,
|
||||
},
|
||||
'includes': ['rumps']
|
||||
}
|
||||
|
||||
|
||||
setup(
|
||||
name='LBRY',
|
||||
app=APP,
|
||||
data_files=DATA_FILES,
|
||||
options={'py2app': OPTIONS},
|
||||
setup_requires=['py2app'],
|
||||
)
|
Loading…
Reference in a new issue