Definitely a logic & more error in here, but we're close
This commit is contained in:
parent
3d2e85f2be
commit
3d097e6084
1 changed files with 32 additions and 5 deletions
|
@ -1,12 +1,12 @@
|
||||||
import cmd
|
import csv
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
import zenipy
|
import zenipy
|
||||||
|
|
||||||
WORK_MIN = 25
|
WORK_MIN = .1
|
||||||
SHORT_MIN = 5
|
SHORT_MIN = .1
|
||||||
LONG_MIN = 15
|
LONG_MIN = 15
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,12 +16,39 @@ def pomodoro_prompt_plan(whatdid = ''):
|
||||||
def pomodoro_prompt_report(whatnext):
|
def pomodoro_prompt_report(whatnext):
|
||||||
whatdid = zenipy.zenipy.entry(text="What'd you do?", placeholder='What i said i would do', title='Pomodoro Prompt: Report')
|
whatdid = zenipy.zenipy.entry(text="What'd you do?", placeholder='What i said i would do', title='Pomodoro Prompt: Report')
|
||||||
|
|
||||||
|
def record_task(whatdid, start, end=None):
|
||||||
|
if end is None:
|
||||||
|
end = datetime.now(pytz.utc)
|
||||||
|
with open('timelog.csv', 'w', newline='') as csvfile:
|
||||||
|
timewriter = csv.writer(csvfile)
|
||||||
|
timewriter.writerow([start, end, whatdid])
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
whatnext = pomodoro_prompt_plan()
|
whatnext = pomodoro_prompt_plan()
|
||||||
|
|
||||||
# timelog = Path('timelog.csv')
|
start = datetime.now(pytz.utc)
|
||||||
|
end = start + timedelta(minutes=WORK_MIN, seconds=0)
|
||||||
|
try:
|
||||||
|
print('Task -', line)
|
||||||
|
while True:
|
||||||
|
diff = datetime.now(pytz.utc)-start
|
||||||
|
print('\r', str(diff).split('.')[0], sep='', end='')
|
||||||
|
time.sleep(1)
|
||||||
|
whatdid = pomodoro_prompt_report(whatnext)
|
||||||
|
record_task(whatdid, start)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n{} time spent, save?'.format(str(diff).split('.')[0]))
|
||||||
|
choice = input('[y]/n: ').strip()
|
||||||
|
if choice.lower() in ('y', 'yes', ''):
|
||||||
|
whatdid = pomodoro_prompt_report(whatnext)
|
||||||
|
record_task(whatdid, start)
|
||||||
|
else:
|
||||||
|
print('What did you break?')
|
||||||
|
# If we somehow end up here, try a last-ditch effort to save.
|
||||||
|
record_task('Incomplete, interrupted task:' + whatnext, start)
|
||||||
|
|
||||||
|
|
||||||
# timelog.touch(exist_ok=True)
|
# timelog.touch(exist_ok=True)
|
||||||
# with timelog.open('r+') as f:
|
# with timelog.open('r+') as f:
|
||||||
# pp = PomodoroPrompt(timelog=f)
|
# pp = PomodoroPrompt(timelog=f)
|
||||||
|
|
Loading…
Reference in a new issue