-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtimezone.py
40 lines (31 loc) · 1.27 KB
/
timezone.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
37
38
39
40
import rumps
import datetime
import pytz
import os
import sys
import importlib
class TimeZone(object):
def __init__(self):
super(TimeZone, self)
self.config = {
"app_name": "TimeZone",
"ld_current_time" : "London 🇬🇧 " + datetime.datetime.now(pytz.timezone('Europe/London')).strftime('%I:%M:%S %p'),
"ny_current_time" : "New York 🗽 " + datetime.datetime.now(pytz.timezone('US/Eastern')).strftime('%I:%M:%S %p') ,
"la_current_time" : "Los Angeles 🏠 " + datetime.datetime.now(pytz.timezone('US/Pacific')).strftime('%I:%M:%S %p'),
}
self.app = rumps.App(self.config["app_name"],icon='tz.icns')
self.ld = rumps.MenuItem(title=self.config["ld_current_time"],callback='')
self.ny = rumps.MenuItem(title=self.config["ny_current_time"],callback='')
self.la = rumps.MenuItem(title=self.config["la_current_time"],callback='')
self.set_up_menu()
def set_up_menu(self):
self.app.menu = [self.ld,self.ny,self.la]
@rumps.clicked('Restart')
def about(self):
print('restarted')
os.execl(sys.executable, sys.executable, * sys.argv)
def run(self):
self.app.run()
if __name__ == '__main__':
app = TimeZone()
app.run()