[hamster-applet] if we can't parse either start or end times, still do the preview, focusing on current time



commit 3909eb76d20f0cc1bd43b103be888da626f2cd57
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Aug 11 13:15:40 2009 +0300

    if we can't parse either start or end times, still do the preview, focusing on current time

 hamster/edit_activity.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/hamster/edit_activity.py b/hamster/edit_activity.py
index be83839..61b9ddd 100644
--- a/hamster/edit_activity.py
+++ b/hamster/edit_activity.py
@@ -647,14 +647,16 @@ class CustomFactController:
             if ((end_time - start_time).days > 0): 
                 end_time -= dt.timedelta(days=1)
                 self.update_time(start_time, end_time)
-    
-            if start_time and end_time:
-                self.draw_preview(start_time.date(), [start_time, end_time])
-    
+
             # if end time is not in proper distance, do the brutal +30 minutes reset
             if (end_time < start_time or (end_time - start_time).days > 0):
                 end_time = start_time + dt.timedelta(minutes = 30)
                 self.update_time(start_time, end_time)
+    
+            self.draw_preview(start_time.date(), [start_time, end_time])    
+        else:
+            self.draw_preview(dt.datetime.today().date(), [dt.datetime.now(),
+                                                           dt.datetime.now()])
 
         looks_good = False
         if activity_text != "" and start_time and end_time and \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]