From 56d0e20ccaad5273fe8884e008376209a3ed40d8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 12 Jun 2009 11:50:08 +0900 Subject: [PATCH] include last modified time in description & plugin area --- ankiqt/ui/getshared.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ankiqt/ui/getshared.py b/ankiqt/ui/getshared.py index d1300d024..c2787eed2 100644 --- a/ankiqt/ui/getshared.py +++ b/ankiqt/ui/getshared.py @@ -116,11 +116,14 @@ class GetShared(QDialog): if self.type == 0: cols = (R_TITLE, R_FACTS, R_COUNT) else: - cols = (R_TITLE, R_COUNT) + cols = (R_TITLE, R_COUNT, R_MODIFIED) for rc, r in enumerate(self.curList): for cc, c in enumerate(cols): if c == R_FACTS or c == R_COUNT: txt = unicode("%15d" % r[c]) + elif c == R_MODIFIED: + days = int(((time.time() - r[c])/(24*60*60))) + txt = ngettext("%6d day ago", "%6d days ago", days) % days else: txt = unicode(r[c]) item = QTableWidgetItem(txt) @@ -148,12 +151,14 @@ class GetShared(QDialog): Size: %(size)0.2fKB
Uploader: %(author)s
Downloads: %(count)s
-Description:
%(description)s""") % { +Modified: %(mod)s ago
+
%(description)s""") % { 'title': r[R_TITLE], 'tags': r[R_TAGS], 'size': r[R_SIZE] / 1024.0, 'author': r[R_USERNAME], 'count': r[R_COUNT], + 'mod': fmtTimeSpan(time.time() - r[R_MODIFIED]), 'description': r[R_DESCRIPTION].replace("\n", "
"), }) self.form.scrollAreaWidgetContents.adjustSize() @@ -170,9 +175,9 @@ class GetShared(QDialog): self.form.table.setHorizontalHeaderLabels([ _("Title"), _("Facts"), _("Downloads")]) else: - self.form.table.setColumnCount(2) + self.form.table.setColumnCount(3) self.form.table.setHorizontalHeaderLabels([ - _("Title"), _("Downloads")]) + _("Title"), _("Downloads"), _("Modified")]) self.form.table.horizontalHeader().setResizeMode( 0, QHeaderView.Stretch) self.form.table.verticalHeader().hide()