| 1 | Index: common.py |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- common.py (revision 4144) |
|---|
| 4 | +++ common.py (working copy) |
|---|
| 5 | @@ -34,6 +34,7 @@ |
|---|
| 6 | """Common functions for various parts of Deluge to use.""" |
|---|
| 7 | |
|---|
| 8 | import os |
|---|
| 9 | +import time |
|---|
| 10 | import subprocess |
|---|
| 11 | import platform |
|---|
| 12 | |
|---|
| 13 | @@ -211,6 +212,12 @@ |
|---|
| 14 | return '%dw %dd' % (weeks, days) |
|---|
| 15 | return 'unknown' |
|---|
| 16 | |
|---|
| 17 | +def fdate(value): |
|---|
| 18 | + """Returns a date string, eg 05/05/08, given a time in seconds since the Epoch""" |
|---|
| 19 | + if value < 0: |
|---|
| 20 | + return "" |
|---|
| 21 | + return time.strftime("%d/%m/%y", time.localtime(value)) |
|---|
| 22 | + |
|---|
| 23 | def is_url(url): |
|---|
| 24 | """A simple regex test to check if the URL is valid.""" |
|---|
| 25 | import re |
|---|
| 26 | Index: ui/gtkui/statistics_tab.py |
|---|
| 27 | =================================================================== |
|---|
| 28 | --- ui/gtkui/statistics_tab.py (revision 4144) |
|---|
| 29 | +++ ui/gtkui/statistics_tab.py (working copy) |
|---|
| 30 | @@ -33,7 +33,6 @@ |
|---|
| 31 | # statement from all source files in the program, then also delete it here. |
|---|
| 32 | |
|---|
| 33 | import gtk, gtk.glade |
|---|
| 34 | -import time |
|---|
| 35 | |
|---|
| 36 | from deluge.ui.client import aclient as client |
|---|
| 37 | import deluge.component as component |
|---|
| 38 | @@ -61,11 +60,6 @@ |
|---|
| 39 | else: |
|---|
| 40 | return deluge.common.fspeed(value) |
|---|
| 41 | |
|---|
| 42 | -def fdate(value): |
|---|
| 43 | - if value < 0: |
|---|
| 44 | - return "" |
|---|
| 45 | - return time.strftime("%d/%m/%y", time.localtime(value)) |
|---|
| 46 | - |
|---|
| 47 | class StatisticsTab(Tab): |
|---|
| 48 | def __init__(self): |
|---|
| 49 | Tab.__init__(self) |
|---|
| 50 | @@ -95,7 +89,7 @@ |
|---|
| 51 | (glade.get_widget("summary_seed_rank"), str, ("seed_rank",)), |
|---|
| 52 | (glade.get_widget("summary_auto_managed"), str, ("is_auto_managed",)), |
|---|
| 53 | (glade.get_widget("progressbar"), fpcnt, ("progress",)), |
|---|
| 54 | - (glade.get_widget("summary_date_added"), fdate, ("time_added",)) |
|---|
| 55 | + (glade.get_widget("summary_date_added"), deluge.common.fdate, ("time_added",)) |
|---|
| 56 | ] |
|---|
| 57 | |
|---|
| 58 | def update(self): |
|---|
| 59 | Index: ui/gtkui/listview.py |
|---|
| 60 | =================================================================== |
|---|
| 61 | --- ui/gtkui/listview.py (revision 4144) |
|---|
| 62 | +++ ui/gtkui/listview.py (working copy) |
|---|
| 63 | @@ -34,7 +34,6 @@ |
|---|
| 64 | |
|---|
| 65 | import cPickle |
|---|
| 66 | import os.path |
|---|
| 67 | -import time |
|---|
| 68 | |
|---|
| 69 | import pygtk |
|---|
| 70 | pygtk.require('2.0') |
|---|
| 71 | @@ -90,11 +89,9 @@ |
|---|
| 72 | cell.set_property('text', ratio_str) |
|---|
| 73 | |
|---|
| 74 | def cell_data_date(column, cell, model, row, data): |
|---|
| 75 | - """Display value as date, eg 2008/05/05""" |
|---|
| 76 | + """Display value as date, eg 05/05/08""" |
|---|
| 77 | time_val = model.get_value(row, data) |
|---|
| 78 | - time_str = "" |
|---|
| 79 | - if time_val > -1: |
|---|
| 80 | - time_str = time.strftime("%d/%m/%y", time.localtime(time_val)) |
|---|
| 81 | + time_str = deluge.common.fdate(time_val) |
|---|
| 82 | cell.set_property('text', time_str) |
|---|
| 83 | |
|---|
| 84 | class ListViewColumnState: |
|---|