From: <cl...@us...> - 2002-06-10 04:45:28
|
Update of /cvsroot/todo-manager/todo-manager In directory usw-pr-cvs1:/tmp/cvs-serv6282 Modified Files: Tag: dev-bronze interface.py Log Message: If the calendar is visible then it will effect the due date of new tasks Index: interface.py =================================================================== RCS file: /cvsroot/todo-manager/todo-manager/Attic/interface.py,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -u -d -r1.1.2.31 -r1.1.2.32 --- interface.py 2 Jun 2002 21:12:25 -0000 1.1.2.31 +++ interface.py 10 Jun 2002 04:45:25 -0000 1.1.2.32 @@ -210,10 +210,11 @@ def show_calendar(self, event=None): if self.__view_calendar.get(): if not self._calframe.winfo_children(): - calendar = Calendar(self._calframe, bd=2, relief=SUNKEN, bg='white') - calendar.pack(side=TOP) + self._calendar = Calendar(self._calframe, bd=2, relief=SUNKEN, bg='white') + self._calendar.pack(side=TOP) else: for c in self._calframe.winfo_children(): c.destroy() + self._calendar = None def OnNew(self, event=None): self._app.new_file(ui=self) @@ -353,7 +354,15 @@ def OnDueDateFocus(self, event): if self._nameEntry.get() and not event.widget.get(): # Get the current date and time - t = time.strftime("%m/%d/%y", time.localtime(time.time())) + # If the calendar is visible, get the date from it. + if self.__view_calendar.get() and self._calendar: + y, m, d = self._calendar.GetDate() + y = str(y)[2:] + if len(str(m)) < 2: m = "0%d" %m + if len(str(d)) < 2: d = "0%d" %d + t = "%s/%s/%s" %(m, d, y) + else: + t = time.strftime("%m/%d/%y", time.localtime(time.time())) self.phantom_fields(0) event.widget.insert(0, t) |