Show last downloaded date for news in human readable form

This commit is contained in:
Kovid Goyal 2009-01-28 09:18:13 -08:00
parent e2a2701e23
commit 38925cc86c
2 changed files with 8 additions and 3 deletions

View File

@ -350,9 +350,11 @@ class SchedulerDialog(QDialog, Ui_Dialog):
self.username.blockSignals(False)
self.password.blockSignals(False)
d = datetime.utcnow() - recipe.last_downloaded
ld = '%.2f'%(d.days + d.seconds/(24.*3600))
def hm(x): return (x-x%3600)//3600, (x%3600 - (x%3600)%60)//60
hours, minutes = hm(d.seconds)
tm = _('%d days, %d hours and %d minutes ago')%(d.days, hours, minutes)
if d < timedelta(days=366):
self.last_downloaded.setText(_('Last downloaded: %s days ago')%ld)
self.last_downloaded.setText(_('Last downloaded')+': '+tm)
else:
self.last_downloaded.setText(_('Last downloaded: never'))

View File

@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>726</width>
<width>738</width>
<height>575</height>
</rect>
</property>
@ -194,6 +194,9 @@
<property name="text" >
<string/>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>