-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdunnit-menu.py
155 lines (125 loc) · 5.33 KB
/
dunnit-menu.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import rumps
import os
import os.path
import datetime
rumps.debug_mode(True)
nightyfile = "/tmp/dunnit-nighty"
if os.path.isfile(nightyfile): os.remove(nightyfile)
class DunnitStatusBarApp(rumps.App):
# @rumps.clicked("✅🚀 Dunnit (YAY!)")
@rumps.clicked("🚀 Dunnit (YAY!)")
def bubble(self, sender):
# if not sender.state:
os.system("~/dunnit/dunnit-bubble frommenu")
@rumps.clicked("🥅 Goals")
def setgoals(self, _):
os.system("~/dunnit/dunnit-goals frommenu")
@rumps.clicked("💡 Todo")
def todo(self, _):
os.system("~/dunnit/dunnit-todo")
# Use todoist instead
# os.system('cliclick kd:cmd,ctrl t:a ku:cmd,ctrl')
@rumps.clicked("🚧 Blocker")
def blocker(self, sender):
# if not sender.state:
os.system("~/dunnit/dunnit-blocker frommenu")
@rumps.clicked("🏁 EOD")
def eod(self, _):
es = os.system("~/dunnit/dunnit-eod frommenu")
if es != 0: rumps.alert('Summary file already exists! Delete it and try again.')
# @rumps.clicked("🗓 Planning", "🎯 Weekly Objectives")
# def objectives(self, _):
# os.system("~/dunnit/dunnit-objectives")
@rumps.clicked("🗓 Plans")
def showtodos(self, _):
with open('help.txt', 'r') as file: txt = file.read()
prog = os.popen("~/dunnit/dunnit-showtodos frommenu").read()
win = rumps.Window("foo", 'bar', dimensions=(500,600))
win.title = 'Dunnit Todos'
win.message = "These are all the things you planned to do."
win.default_text = prog
resp = win.run()
@rumps.clicked("📒 Ledger", "👀 View")
def progress(self, _):
prog = os.popen("~/dunnit/dunnit-progress frommenu").read()
win = rumps.Window("foo", 'bar', dimensions=(500,600))
win.title = 'Dunnit Progress Today'
win.message = "This is an in-flight view of your day so far. It's just a ledger of raw entries; you'll have a chance to edit it in a better format when you close the day."
win.default_text = prog
resp = win.run()
print(resp)
@rumps.clicked("📒 Ledger", "✏️ Edit (careful!)")
def raw(self, _):
es = os.system("~/dunnit/dunnit-editraw frommenu")
@rumps.clicked("📝 Reports", "📓 Daily Report (html)")
def report(self, _):
os.system("~/dunnit/dunnit-report")
@rumps.clicked("📝 Reports", "📧 Daily Report (email)")
def email(self, _):
os.system("~/dunnit/dunnit-email")
# TODO
@rumps.clicked("📝 Reports", "🎉 Weekly Report")
def weeklyreport(self, _):
today = datetime.datetime.today()
ww = today.strftime("%U")
# ww = datetime.date(2010, 6, 16).isocalendar()[1]
os.system(f"~/dunnit/dunnit-eowsummary w{ww}")
@rumps.clicked("📝 Reports", "🧍♀️ Standup")
def standup(self, _):
os.system("~/dunnit/dunnit-standup frommenu")
@rumps.clicked("📝 Reports", "🤔 Retro")
def retro(self, sender):
# if not sender.state:
os.system("~/dunnit/dunnit-retro frommenu")
@rumps.clicked("⚙️ Misc", "⬆ Push MyDunnits")
def push(self, _):
rumps.notification("Pushing to remote", "...", "...")
os.system("~/dunnit/dunnit-push frommenu")
@rumps.clicked("⚙️ Misc", "⬇ Pull MyDunnits")
def pull(self, _):
rumps.notification("Pulling from remote", "...", "...")
os.system("~/dunnit/dunnit-pull frommenu")
@rumps.clicked("⚙️ Misc", "🍅 Timer")
def pomodoro(self, _):
es = os.system("~/dunnit/dunnit-pomodoro")
@rumps.clicked("⚙️ Misc", "🛠 Preferences")
def preferences(self, _):
os.system("~/dunnit/dunnit-preferences")
@rumps.clicked("⚙️ Misc", "📖 Full Tutorial")
def help(self, _):
with open('help.txt', 'r') as file: txt = file.read()
win = rumps.Window("foo", 'bar', dimensions=(500,600))
win.title = 'Dunnit Help'
win.message = "All about Dunnit and its usage'"
win.default_text = txt
resp = win.run()
@rumps.clicked("⚙️ Misc", "ℹ️ Version")
def verinfo(self, _):
rumps.notification("Version", "0.0.1", "Something")
@rumps.clicked("⚙️ Misc", "✨ Check for Update")
def swupdate(self, _):
os.system("~/dunnit/dunnit-swupdate frommenu")
@rumps.clicked("⚙️ Misc", "❓ What's Dunnit?")
def about(self, _):
rumps.notification("Dunnit is for tracking WTF you did",
"Just write a sentence each hour.",
"You can pop up and record anytime.")
@rumps.clicked("💤 AFK (disable)")
def onoff(self, sender):
if sender.state: # night mode is on
print("Turning off nighty mode")
sender.state = False
self.title = '✔ Dunnit'
if os.path.isfile(nightyfile): os.remove(nightyfile)
# os.system("~/dunnit/dunnit-goals")
else:
print("Turning on nighty mode")
self.title = '💤 Dunnit'
with open(nightyfile, 'a'): pass
sender.state = True
# @rumps.clicked('On')
# def button(self, sender):
# sender.title = 'Off' if sender.title == 'On' else 'On'
# Window("I can't think of a good example app...").run()
if __name__ == "__main__":
DunnitStatusBarApp("✔ Dunnit").run()