From ec8d48f4fd7c8c5f842630f3e683c2f60de42899 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 2 Sep 2014 12:48:02 +0100 Subject: [PATCH] [GTKUI] Tweaking layout of Status and Details Tabs --- deluge/ui/gtkui/details_tab.py | 4 +-- deluge/ui/gtkui/glade/main_window.tabs.ui | 32 ++++++++++---------- deluge/ui/gtkui/status_tab.py | 36 +++++++++++++++-------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index de5989eeb..e051ba0cc 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -20,7 +20,7 @@ def fpeer_size_second(first, second): return "%s (%s)" % (first, fsize(second)) -def fdate_blank(value): +def fdate_or_dash(value): """Display value as date, eg 05/05/08 or dash""" if value > 0.0: return fdate(value) @@ -48,7 +48,7 @@ class DetailsTab(Tab): (builder.get_object("summary_name"), None, ("name",)), (builder.get_object("summary_total_size"), fsize, ("total_size",)), (builder.get_object("summary_num_files"), str, ("num_files",)), - (builder.get_object("summary_completed"), fdate_blank, ("completed_time",)), + (builder.get_object("summary_completed"), fdate_or_dash, ("completed_time",)), (builder.get_object("summary_date_added"), fdate, ("time_added",)), (builder.get_object("summary_private"), str_yes_no, ("private",)), (builder.get_object("summary_torrent_path"), None, ("download_location",)), diff --git a/deluge/ui/gtkui/glade/main_window.tabs.ui b/deluge/ui/gtkui/glade/main_window.tabs.ui index 5de0985f6..5451340bb 100644 --- a/deluge/ui/gtkui/glade/main_window.tabs.ui +++ b/deluge/ui/gtkui/glade/main_window.tabs.ui @@ -434,7 +434,7 @@ True False 0 - Active Time: + Active: @@ -466,7 +466,7 @@ True False 0 - Seeding Time: + Seeding: @@ -685,17 +685,18 @@ 5 - 200 True False 0 True - char + word-char True + end 1 2 + GTK_SHRINK | GTK_FILL GTK_EXPAND @@ -743,8 +744,8 @@ 3 4 - 3 - 4 + 1 + 2 GTK_FILL @@ -758,8 +759,8 @@ 4 5 - 3 - 4 + 1 + 2 GTK_FILL @@ -861,6 +862,7 @@ True char True + start 1 @@ -895,6 +897,7 @@ True char True + end 1 @@ -923,12 +926,12 @@ - 150 True False 0 char True + end 1 @@ -984,7 +987,6 @@ - 60 True False 0 @@ -995,7 +997,6 @@ 2 1 2 - GTK_SHRINK | GTK_FILL @@ -1028,7 +1029,6 @@ 2 2 3 - GTK_SHRINK | GTK_FILL @@ -1045,8 +1045,8 @@ 3 4 - 1 - 2 + 3 + 4 GTK_FILL @@ -1062,8 +1062,8 @@ 4 5 - 1 - 2 + 3 + 4 GTK_FILL diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index f199d744f..58776050c 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -37,7 +37,7 @@ import logging import deluge.component as component -import deluge.common +from deluge.common import fsize, fspeed, fdate, fpeer, ftime from deluge.configmanager import ConfigManager from deluge.ui.gtkui.torrentdetails import Tab from deluge.ui.gtkui.piecesbar import PiecesBar @@ -46,12 +46,14 @@ log = logging.getLogger(__name__) def fpeer_sized(first, second): - return "%s (%s)" % (deluge.common.fsize(first), deluge.common.fsize(second)) + return "%s (%s)" % (fsize(first), fsize(second)) def fratio(value): if value < 0: return "∞" + elif value == 0: + return "0" return "%.3f" % value @@ -61,21 +63,29 @@ def fpcnt(value, state): return "%s%.2f%%" % (state, value) -def fspeed(value, max_value=-1): +def fspeed_max(value, max_value=-1): if max_value > -1: - return "%s (%s %s)" % (deluge.common.fspeed(value), max_value, _("KiB/s")) + return "%s (%s %s)" % (fspeed(value), max_value, _("KiB/s")) else: - return deluge.common.fspeed(value) + return fspeed(value) def fdate_or_never(value): """Display value as date, eg 05/05/08 or Never""" if value > 0.0: - return deluge.common.fdate(value) + return fdate(value) else: return "Never" +def ftime_or_dash(value): + """Display value as time, eg 2h 30m or dash""" + if value > 0.0: + return ftime(value) + else: + return "-" + + class StatusTab(Tab): def __init__(self): Tab.__init__(self) @@ -98,14 +108,14 @@ class StatusTab(Tab): (builder.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download", "total_payload_download")), (builder.get_object("summary_total_uploaded"), fpeer_sized, ("total_uploaded", "total_payload_upload")), - (builder.get_object("summary_download_speed"), fspeed, ("download_payload_rate", "max_download_speed")), - (builder.get_object("summary_upload_speed"), fspeed, ("upload_payload_rate", "max_upload_speed")), - (builder.get_object("summary_seeds"), deluge.common.fpeer, ("num_seeds", "total_seeds")), - (builder.get_object("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")), - (builder.get_object("summary_eta"), deluge.common.ftime, ("eta",)), + (builder.get_object("summary_download_speed"), fspeed_max, ("download_payload_rate", "max_download_speed")), + (builder.get_object("summary_upload_speed"), fspeed_max, ("upload_payload_rate", "max_upload_speed")), + (builder.get_object("summary_seeds"), fpeer, ("num_seeds", "total_seeds")), + (builder.get_object("summary_peers"), fpeer, ("num_peers", "total_peers")), + (builder.get_object("summary_eta"), ftime_or_dash, ("eta",)), (builder.get_object("summary_share_ratio"), fratio, ("ratio",)), - (builder.get_object("summary_active_time"), deluge.common.ftime, ("active_time",)), - (builder.get_object("summary_seed_time"), deluge.common.ftime, ("seeding_time",)), + (builder.get_object("summary_active_time"), ftime_or_dash, ("active_time",)), + (builder.get_object("summary_seed_time"), ftime_or_dash, ("seeding_time",)), (builder.get_object("summary_seed_rank"), str, ("seed_rank",)), (builder.get_object("progressbar"), fpcnt, ("progress", "state")), (builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)),