changeset 3:1513c716eef0

- Added total sum of all projects. - Added hint to tac your old worklog config file to keep reversed order.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 30 Jul 2008 01:42:38 +0200
parents 49aa271aa3d0
children 2b2f74f301db
files ChangeLog README getan
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 30 01:02:32 2008 +0200
+++ b/ChangeLog	Wed Jul 30 01:42:38 2008 +0200
@@ -1,3 +1,10 @@
+2008-07-30	Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* getan: Added total sum of all projects.
+
+	* README: Added hint to tac your old worklog config file to keep 
+	  reversed order.
+
 2008-07-30	Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* getan: Added +/- time to tasks. If in pause mode press + or -
--- a/README	Wed Jul 30 01:02:32 2008 +0200
+++ b/README	Wed Jul 30 01:42:38 2008 +0200
@@ -24,6 +24,9 @@
 
     ./contrib/convert-projects </PATH/TO/projects | sqlite3 time.db
 
+	If you want to keep the reverse task order of the original config
+	file you might pipe it through tac first.
+
 3 - starting getan:
 
     $ ./getan 
--- a/getan	Wed Jul 30 01:02:32 2008 +0200
+++ b/getan	Wed Jul 30 01:42:38 2008 +0200
@@ -355,16 +355,23 @@
     def isRunning(self):
         return self.state in (RUNNING, RUNNING_ESC)
 
+    def totalTime(self):
+        sum = timedelta()
+        for p in self.projects:
+            sum += p.total
+        return sum
+
     def render(self, ofs=0):
         ofs = render_header(ofs)
         ml = max([len(p.desc and p.desc or "unknown") for p in self.projects])
         unknown = 0
 
         if self.current_project and self.current_project.start_time:
-            current_delta = datetime.now() - self.current_project.start_time 
+            current_delta      = datetime.now() - self.current_project.start_time 
             current_time_str   = "%s " % human_time(current_delta)
             current_time_space = " " * len(current_time_str)
         else:
+            current_delta      = timedelta()
             current_time_str   = ""
             current_time_space = ""
 
@@ -398,6 +405,14 @@
             if is_current: stdscr.attroff(curses.A_UNDERLINE)
             ofs += 1
 
+        total_str   = "(%s)" % human_time(self.totalTime() + current_delta) 
+        total_x_pos = ml + 8 + len(current_time_space)
+
+        stdscr.addstr(ofs, total_x_pos, "=" * len(total_str))
+        ofs += 1
+        stdscr.addstr(ofs, total_x_pos, total_str)
+        ofs += 1
+
         return ofs
 
     def writeLog(self, description = None):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)