gui: drop the relative_time() helper, no longer used
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a63355a03e
commit
37d22dfaad
|
@ -17,8 +17,6 @@ from gi.repository import GObject, Gtk, GdkPixbuf, Gdk
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .svg import JsonSvg
|
from .svg import JsonSvg
|
||||||
|
|
||||||
import datetime
|
|
||||||
import time
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
|
|
||||||
|
|
|
@ -26,31 +26,6 @@ logging.basicConfig(level=logging.DEBUG)
|
||||||
logger = logging.getLogger('tuhi.gui.drawingperspective')
|
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")
|
@Gtk.Template(resource_path="/org/freedesktop/Tuhi/ui/Flowbox.ui")
|
||||||
class Flowbox(Gtk.Box):
|
class Flowbox(Gtk.Box):
|
||||||
__gtype_name__ = "Flowbox"
|
__gtype_name__ = "Flowbox"
|
||||||
|
|
Loading…
Reference in New Issue