From 6b484c13083e9dd23936023a2cf2b10d09fff961 Mon Sep 17 00:00:00 2001 From: AndrewButer Date: Fri, 18 Mar 2011 13:39:42 -0400 Subject: [PATCH] Added update of task table cells with hours --- Window.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Window.py b/Window.py index 78f5528..1f965cf 100644 --- a/Window.py +++ b/Window.py @@ -189,6 +189,7 @@ class Window: self.projects_table.show_all() self.updateProjectHours() + self.updateTaskHours() def updateProjectHours(self): totals = {} @@ -206,6 +207,23 @@ class Window: if p in self.project_hour_labels: self.project_hour_labels[p][7].set_text(str(totals[p])) + def updateTaskHours(self): + totals = {} + for day in range(7): + dt = str(self.monday + timedelta(day)) + day_hours = self.ds.getDailyHours(dt) + if self.currProject in day_hours: + for t in day_hours[self.currProject]: + if t in self.task_hour_labels: + hrs = self.hoursFromSeconds(day_hours[self.currProject][t]) + if not t in totals: + totals[t] = 0 + totals[t] += float(hrs) + self.task_hour_labels[t][day].set_text(hrs) + for t in totals: + if t in self.task_hour_labels: + self.task_hour_labels[t][7].set_text(str(totals[t])) + def getProjectWeekHours(self): proj_week_hours = {} for day in range(7):