From 0152ec28b316aa0abe9b0df8c4342885996bcbf2 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Sun, 27 Feb 2011 13:20:09 +0000 Subject: [PATCH] 4700: add timestamps to the session log svn: r16724 --- src/plugins/gramplet/SessionLogGramplet.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/gramplet/SessionLogGramplet.py b/src/plugins/gramplet/SessionLogGramplet.py index 71e1e1580..3f9f024fe 100644 --- a/src/plugins/gramplet/SessionLogGramplet.py +++ b/src/plugins/gramplet/SessionLogGramplet.py @@ -23,6 +23,9 @@ # GRAMPS modules # #------------------------------------------------------------------------ +import locale +import time + from gen.plug import Gramplet from gen.ggettext import sgettext as _ from gen.display.name import displayer as name_displayer @@ -33,14 +36,19 @@ from gen.display.name import displayer as name_displayer # #------------------------------------------------------------------------ class LogGramplet(Gramplet): + _t_fmt = locale.nl_langinfo(locale.T_FMT) + def init(self): self.set_tooltip(_("Click name to change active\nDouble-click name to edit")) - self.set_text(_("Log for this Session")) + self.set_text(_("Log for this Session") + "\n") self.gui.force_update = True # will always update, even if minimized self.last_log = None - self.append_text("\n") + + def timestamp(self): + self.append_text(time.strftime(LogGramplet._t_fmt) + " ") def db_changed(self): + self.timestamp() self.append_text(_("Opened data base -----------\n")) # List of translated strings used here (translated in self.log ). _('Added'), _('Deleted'), _('Edited') # Dead code for l10n @@ -65,7 +73,8 @@ class LogGramplet(Gramplet): if self.last_log == (ltype, action, handle): continue self.last_log = (ltype, action, handle) - self.append_text("%s: " % _(action)) + self.timestamp() + self.append_text("%s: " % _(action) ) if ltype == 'Person': person = self.dbstate.db.get_person_from_handle(handle) name = name_displayer.display(person)