[hamster-applet] DateInput now always returns date instead of datetime; size input element to the length of date with



commit 1830fae46420b4c0db0d8a0e9643ecff348d5106
Author: Toms Bauģis <toms baugis gmail com>
Date:   Thu May 6 00:46:24 2010 +0100

    DateInput now always returns date instead of datetime; size input element to the length of date with default format

 src/hamster/overview.py          |    4 ++--
 src/hamster/widgets/dateinput.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/hamster/overview.py b/src/hamster/overview.py
index 9383a04..9e8b6c2 100644
--- a/src/hamster/overview.py
+++ b/src/hamster/overview.py
@@ -258,12 +258,12 @@ class Overview(object):
 
 
     def on_start_date_entered(self, input):
-        self.start_date = input.get_date().date()
+        self.start_date = input.get_date()
         self.view_date = self.start_date
         self.search()
 
     def on_end_date_entered(self, input):
-        self.end_date = input.get_date().date()
+        self.end_date = input.get_date()
         self.search()
 
     def _chosen_range(self):
diff --git a/src/hamster/widgets/dateinput.py b/src/hamster/widgets/dateinput.py
index da38703..a8953b6 100644
--- a/src/hamster/widgets/dateinput.py
+++ b/src/hamster/widgets/dateinput.py
@@ -34,7 +34,7 @@ class DateInput(gtk.Entry):
     def __init__(self, date = None):
         gtk.Entry.__init__(self)
 
-        self.set_width_chars(12) #12 is enough for 12-oct-2009, which is verbose
+        self.set_width_chars(len(dt.datetime.now().strftime("%x"))) # size to default format length
         self.date = date
         if date:
             self.set_date(date)
@@ -76,7 +76,7 @@ class DateInput(gtk.Entry):
 
     def _figure_date(self, date_str):
         try:
-            return dt.datetime.strptime(date_str, "%x")
+            return dt.datetime.strptime(date_str, "%x").date()
         except:
             return self.date
 



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