-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathosx_statusbar_app.py
36 lines (33 loc) · 1.2 KB
/
osx_statusbar_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import webbrowser
import os
import rumps
def restart():
os.popen("./start_mac.sh")
# os.popen("pkill -f ServerBIT")
# os.popen("pkill -f Python")
# rumps.quit_application()
def init_rumps_osx():
class ServerBIT_statusbar_app(rumps.App):
def __init__(self):
super(ServerBIT_statusbar_app, self).__init__("", icon="static/images/BITalino.icns", quit_button=None)
self.menu = ["Preferences", "localhost:9001/config", "ServerBIT Directory", "relaunch", "close"]
@rumps.clicked("Preferences")
def prefs(self, _):
webbrowser.open('http://localhost:9001/config', new=2)
@rumps.clicked("ServerBIT Directory")
def prefs(self, _):
os.popen("open ~/ServerBIT/")
@rumps.clicked("relaunch")
def relaunch(self, _):
os.popen("./start_mac.sh")
# os.popen("pkill -f ServerBIT")
rumps.quit_application()
@rumps.clicked("close")
def kill(self, _):
os.popen("pkill -f Python")
# os.popen("pkill -f ServerBIT")
rumps.quit_application()
ServerBIT_statusbar_app().run()
if __name__ == '__main__':
import rumps
init_rumps_osx();