This commit is contained in:
Philipp 2019-05-30 16:12:51 +02:00
parent abc2a2c02d
commit 29e3234b1e
3 changed files with 24 additions and 20 deletions

View File

@ -1,4 +1,5 @@
def hoursSpent(day_start, day_end, break_start, break_end):
duration_whole = day_end - day_start
print("duration_whole", duration_whole)

18
day.py
View File

@ -47,15 +47,11 @@ class Day:
self.date: str = datetime.now().date()
self.begin: datetime = datetime.__init__
self.end: datetime = datetime.__init__
self.begin_break: datetime = datetime.__init__
self.end_break: datetime = datetime.__init__
self.duration: datetime = datetime.__init__
self.begin = 0
self.end = 0
self.begin_break = 0
self.end_break = 0
self.duration = 0
self.isDayStarted: bool = False
self.isBreakDone: bool = False
@ -63,7 +59,7 @@ class Day:
def beginDay(self):
'''Saves the time where a new day was started.'''
self.begin = datetime.now()
self.begin_break = datetime.now()
self.isDayStarted = True
def make_break(self):
@ -74,7 +70,7 @@ class Day:
raise AssertionError(
"You are already in break or have done your break already")
self.beingin_break = datetime.now()
self.begin = datetime.now()
self.isInBreak = True
def stop_break(self):

25
ui.py
View File

@ -19,32 +19,39 @@ class Application(tk.Frame):
self.quit.pack(side="bottom")
self.begin_day = tk.Button(
self, text="begin day", command=self.bd)
self, text="begin day", command=self.day_begin)
self.begin_day.pack(side="left")
self.end_day = tk.Button(self, text="end day", command=self.ed)
self.end_day = tk.Button(self, text="end day", command=self.day_end)
self.end_day.pack(side="right")
self.begin_pause = tk.Button(self, text="begin pause", command=self.mb)
self.begin_pause = tk.Button(
self, text="begin pause", command=self.make_brake)
self.begin_pause.pack(side="left")
self.end_pause = tk.Button(self, text="end pause", command=self.go)
self.end_pause = tk.Button(
self, text="end pause", command=self.stop_break)
self.end_pause.pack(side="right")
def bd(self):
def day_begin(self):
self.day.beginDay()
self.hi_there["text"] = "Started day"
def ed(self):
def day_end(self):
if not self.day.is_day_started():
'''change field to: du musst erst day starten'''
return
self.day.endDay()
self.hi_there["text"] = "Good Bye"
self.day = Day()
def mb(self):
def make_brake(self):
self.day.make_break()
self.hi_there["text"] = "Have a nice lunch"
def go(self):
self.day.go_on()
def stop_break(self):
self.day.stop_break()
self.hi_there["text"] = "Welcome back"