gui: drop the relative_time() helper, no longer used

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/145/head
Peter Hutterer 2019-08-08 13:25:01 +10:00
parent a63355a03e
commit 37d22dfaad
2 changed files with 0 additions and 27 deletions

View File

@ -17,8 +17,6 @@ from gi.repository import GObject, Gtk, GdkPixbuf, Gdk
from .config import Config
from .svg import JsonSvg
import datetime
import time
import gi
gi.require_version("Gtk", "3.0")

View File

@ -26,31 +26,6 @@ logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('tuhi.gui.drawingperspective')
def relative_time(seconds):
MIN = 60
H = 60 * MIN
DAY = 24 * H
WEEK = 7 * DAY
if seconds < 30:
return _('just now')
if seconds < 5 * MIN:
return _('a few minutes ago')
if seconds < H:
minutes = int(seconds / MIN / 10) * 10
return _(f'{minutes} minutes ago')
if seconds < DAY:
hours = int(seconds / H)
return _(f'{hours} hours ago')
if seconds < 4 * WEEK:
days = int(seconds / DAY)
return _(f'{days} days ago')
if seconds > 10 * 365 * DAY:
return _('not yet')
return _('a long time ago')
@Gtk.Template(resource_path="/org/freedesktop/Tuhi/ui/Flowbox.ui")
class Flowbox(Gtk.Box):
__gtype_name__ = "Flowbox"