From e408dc14cc7c0883aeeb4b946a8ba4b80ef26833 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 27 Oct 2016 13:08:23 +0100 Subject: [PATCH] [#2417] [GTKUI] Add Last Active and modify layout of Status & Details Tabs --- deluge/ui/gtkui/glade/main_window.tabs.ui | 939 +++++++++++----------- deluge/ui/gtkui/status_tab.py | 42 +- 2 files changed, 510 insertions(+), 471 deletions(-) diff --git a/deluge/ui/gtkui/glade/main_window.tabs.ui b/deluge/ui/gtkui/glade/main_window.tabs.ui index af2fa31ce..b024f9fab 100644 --- a/deluge/ui/gtkui/glade/main_window.tabs.ui +++ b/deluge/ui/gtkui/glade/main_window.tabs.ui @@ -152,100 +152,6 @@ 8 10 5 - - - True - False - 0 - True - word-char - - - 7 - 8 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - Availability: - - - - - - 6 - 7 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - - - 7 - 8 - 1 - 2 - GTK_FILL - - - - - True - False - 0 - Peers: - - - - - - 6 - 7 - 1 - 2 - GTK_FILL - - - - - True - False - 0 - - - 7 - 8 - GTK_FILL - - - - - True - False - 0 - Seeds: - - - - - - 6 - 7 - GTK_FILL - - True @@ -257,7 +163,6 @@ 2 3 4 - GTK_FILL @@ -271,19 +176,6 @@ 2 2 3 - GTK_FILL - - - - - True - False - 0 - - - 1 - 2 - GTK_FILL @@ -297,117 +189,6 @@ 2 1 2 - GTK_FILL - - - - - True - False - 0 - - - 4 - 5 - GTK_FILL - - - - - True - False - 0 - Active: - - - - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - True - False - 0 - - - 4 - 5 - 1 - 2 - GTK_FILL - - - - - True - False - 0 - Seeding: - - - - - - 3 - 4 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - - - 4 - 5 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - Complete Seen: - - - - - - 6 - 7 - 3 - 4 - GTK_FILL - - - - - True - False - 0 - True - char - - - 7 - 8 - 3 - 4 - GTK_FILL @@ -420,6 +201,7 @@ 3 5 GTK_SHRINK + 3 @@ -432,38 +214,7 @@ 6 5 GTK_SHRINK - - - - - True - False - 0 - Seed Rank: - - - - - - 3 - 4 - 3 - 4 - GTK_FILL - - - - - True - False - 0 - - - 1 - 2 - 4 - 5 - GTK_FILL + 3 @@ -539,11 +290,11 @@ False 5 - + True False 0 - ETA: + Seeds: @@ -579,12 +330,282 @@ GTK_FILL + + + True + False + 5 + + + + + + 4 + 5 + GTK_FILL + + + + + True + False + 0 + Complete Seen: + + + + + + 6 + 7 + 4 + 5 + GTK_FILL + + + + + True + False + 0 + True + char + + + 7 + 8 + 4 + 5 + GTK_FILL + + + + + True + False + 0 + Last Activity: + + + + + + 6 + 7 + 3 + 4 + GTK_FILL + + + + + True + False + 0 + True + char + + + 7 + 8 + 3 + 4 + GTK_FILL + + + + + True + False + 0 + Seeding Time: + + + + + + 6 + 7 + 2 + 3 + GTK_FILL + + + + + True + False + 0 + + + 7 + 8 + 2 + 3 + GTK_FILL + + + + + True + False + 0 + Active Time: + + + + + + 6 + 7 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + + + 7 + 8 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + ETA Time: + + + + + + 6 + 7 + GTK_FILL + + + + + True + False + 0 + + + 7 + 8 + GTK_FILL + + + + + True + False + 0 + Peers: + + + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + + + 4 + 5 + + + + + True + False + 0 + + + 4 + 5 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + Seed Rank: + + + + + + 3 + 4 + 4 + 5 + GTK_FILL + + True False 0 + + 4 + 5 + 4 + 5 + GTK_FILL + + + + + True + False + 0 + Availability: + + + + + + 3 + 4 + 3 + 4 + GTK_FILL + + + + + True + False + 0 + True + word-char + 4 5 @@ -594,36 +615,47 @@ - + True False - 5 - - - True - False - 0 - Share Ratio: - - - - - + 0 + Share Ratio: + + + - 4 - 5 + 3 + 4 + 2 + 3 GTK_FILL - + + True + False + 0 + + + 1 + 2 + - - - - + + True + False + 0 + + + 4 + 5 + 2 + 3 + GTK_FILL + @@ -680,7 +712,7 @@ True False - 6 + 7 5 10 5 @@ -696,76 +728,11 @@ 1 - 2 + 5 GTK_SHRINK | GTK_FILL GTK_EXPAND - - - True - False - 0 - Added: - - - - - - 3 - 4 - GTK_FILL - - - - - - 100 - True - False - 0 - - - 4 - 5 - GTK_SHRINK | GTK_FILL - - - - - - True - False - 0 - Completed: - - - - - - 3 - 4 - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - - - 4 - 5 - 1 - 2 - GTK_FILL - - - True @@ -802,112 +769,6 @@ - - - True - False - 0 - Shared: - - - - - - 3 - 4 - 5 - 6 - GTK_FILL - - - - - - True - False - 0 - char - True - - - 4 - 5 - 5 - 6 - GTK_FILL - - - - - - True - False - 0 - Download Folder: - - - - - - 3 - 4 - GTK_FILL - - - - - - True - False - 0 - True - char - True - start - - - 1 - 2 - 3 - 4 - - - - - - True - False - 0 - Hash: - - - - - - 4 - 5 - GTK_FILL - - - - - - True - False - 0 - True - char - True - end - - - 1 - 2 - 4 - 5 - - - True @@ -919,8 +780,8 @@ - 5 - 6 + 6 + 7 GTK_FILL @@ -936,9 +797,9 @@ 1 - 2 - 5 - 6 + 5 + 6 + 7 @@ -950,6 +811,7 @@ 2 3 + 1 6 GTK_SHRINK @@ -1069,6 +931,76 @@ + + + True + False + 0 + Hash: + + + + + + 5 + 6 + GTK_FILL + + + + + + True + False + 0 + Download Folder: + + + + + + 4 + 5 + GTK_FILL + + + + + + True + False + 0 + True + char + True + end + + + 1 + 2 + 5 + 6 + + + + + + True + False + 0 + True + char + True + start + + + 1 + 2 + 4 + 5 + + + True @@ -1079,6 +1011,38 @@ + + 3 + 4 + GTK_FILL + + + + + + True + False + 0 + + + 1 + 2 + 3 + 4 + GTK_SHRINK | GTK_FILL + + + + + + True + False + 0 + Completed: + + + + 3 4 @@ -1089,7 +1053,7 @@ - + True False 0 @@ -1099,10 +1063,81 @@ 5 2 3 + GTK_FILL + + + + + + True + False + 0 + Added: + + + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + + + + 100 + True + False + 0 + + + 4 + 5 + 1 + 2 GTK_SHRINK | GTK_FILL + + + True + False + 0 + Shared: + + + + + + 3 + 4 + 5 + 6 + GTK_FILL + + + + + + True + False + 0 + char + True + + + 4 + 5 + 5 + 6 + GTK_FILL + + + diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index d31e33106..edd485dd3 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -25,11 +25,7 @@ def ftotal_sized(first, second): def fratio(value): - if value < 0: - return "∞" - elif value == 0: - return "0" - return "%.3f" % value + return ("%.3f" % value).rstrip('0').rstrip('.') if value > 0 else "∞" def fpcnt(value, state): @@ -41,36 +37,42 @@ def fpcnt(value, state): def fspeed_max(value, max_value=-1): value = fspeed(value, shortform=True) - if max_value > -1: - return "%s (%s %s)" % (value, max_value, _("K/s")) - else: - return value + return "%s (%s %s)" % (value, max_value, _("K/s")) if max_value > -1 else value def fdate_or_never(value): """Display value as date, eg 05/05/08 or Never""" - if value > 0.0: - return fdate(value) - else: - return "Never" + return fdate(value, date_only=True) if value > 0 else _("Never") def ftime_or_dash(value): """Display value as time, eg 2h 30m or dash""" - if value > 0.0: - return ftime(value) - else: - return "-" + return ftime(value) if value > 0 else "-" def fseed_rank_or_dash(seed_rank, seeding_time): """Display value if seeding otherwise dash""" - if seeding_time > 0.0: - return str(seed_rank) + + if seeding_time > 0: + if seed_rank >= 1000: + return "%ik" % (seed_rank // 1000) + else: + return str(seed_rank) else: return "-" +def flast_active(time_since_download, time_since_upload): + """The last time the torrent was active as time e.g. 2h 30m or dash""" + + try: + last_time_since = min((x for x in (time_since_download, time_since_upload) if x != -1)) + except ValueError: + return "-" + else: + return ftime(last_time_since) + + class StatusTab(Tab): def __init__(self): Tab.__init__(self) @@ -100,6 +102,8 @@ class StatusTab(Tab): (builder.get_object("summary_seed_rank"), fseed_rank_or_dash, ("seed_rank", "seeding_time")), (builder.get_object("progressbar"), fpcnt, ("progress", "state")), (builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)), + (builder.get_object("summary_last_active"), flast_active, ("time_since_download", + "time_since_upload")), (builder.get_object("summary_torrent_status"), str, ("message",)), ]