[GTKUI] Tweaking layout of Status and Details Tabs

This commit is contained in:
Calum Lind 2014-09-02 12:48:02 +01:00
parent 4f3fcac2bf
commit ec8d48f4fd
3 changed files with 41 additions and 31 deletions

View File

@ -20,7 +20,7 @@ def fpeer_size_second(first, second):
return "%s (%s)" % (first, fsize(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""" """Display value as date, eg 05/05/08 or dash"""
if value > 0.0: if value > 0.0:
return fdate(value) return fdate(value)
@ -48,7 +48,7 @@ class DetailsTab(Tab):
(builder.get_object("summary_name"), None, ("name",)), (builder.get_object("summary_name"), None, ("name",)),
(builder.get_object("summary_total_size"), fsize, ("total_size",)), (builder.get_object("summary_total_size"), fsize, ("total_size",)),
(builder.get_object("summary_num_files"), str, ("num_files",)), (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_date_added"), fdate, ("time_added",)),
(builder.get_object("summary_private"), str_yes_no, ("private",)), (builder.get_object("summary_private"), str_yes_no, ("private",)),
(builder.get_object("summary_torrent_path"), None, ("download_location",)), (builder.get_object("summary_torrent_path"), None, ("download_location",)),

View File

@ -434,7 +434,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Active Time:</property> <property name="label" translatable="yes">Active:</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
@ -466,7 +466,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Seeding Time:</property> <property name="label" translatable="yes">Seeding:</property>
<attributes> <attributes>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
</attributes> </attributes>
@ -685,17 +685,18 @@
<property name="row_spacing">5</property> <property name="row_spacing">5</property>
<child> <child>
<object class="GtkLabel" id="summary_name"> <object class="GtkLabel" id="summary_name">
<property name="width_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="wrap_mode">char</property> <property name="wrap_mode">word-char</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="ellipsize">end</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND</property> <property name="y_options">GTK_EXPAND</property>
</packing> </packing>
</child> </child>
@ -743,8 +744,8 @@
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">3</property> <property name="top_attach">1</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -758,8 +759,8 @@
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
<property name="right_attach">5</property> <property name="right_attach">5</property>
<property name="top_attach">3</property> <property name="top_attach">1</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -861,6 +862,7 @@
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="wrap_mode">char</property> <property name="wrap_mode">char</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="ellipsize">start</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -895,6 +897,7 @@
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="wrap_mode">char</property> <property name="wrap_mode">char</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="ellipsize">end</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -923,12 +926,12 @@
</child> </child>
<child> <child>
<object class="GtkLabel" id="summary_comments"> <object class="GtkLabel" id="summary_comments">
<property name="width_request">150</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap_mode">char</property> <property name="wrap_mode">char</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="ellipsize">end</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -984,7 +987,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel" id="summary_total_size"> <object class="GtkLabel" id="summary_total_size">
<property name="width_request">60</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
@ -995,7 +997,6 @@
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -1028,7 +1029,6 @@
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="top_attach">2</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
</child> </child>
@ -1045,8 +1045,8 @@
<packing> <packing>
<property name="left_attach">3</property> <property name="left_attach">3</property>
<property name="right_attach">4</property> <property name="right_attach">4</property>
<property name="top_attach">1</property> <property name="top_attach">3</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>
@ -1062,8 +1062,8 @@
<packing> <packing>
<property name="left_attach">4</property> <property name="left_attach">4</property>
<property name="right_attach">5</property> <property name="right_attach">5</property>
<property name="top_attach">1</property> <property name="top_attach">3</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options"></property> <property name="y_options"></property>
</packing> </packing>

View File

@ -37,7 +37,7 @@
import logging import logging
import deluge.component as component import deluge.component as component
import deluge.common from deluge.common import fsize, fspeed, fdate, fpeer, ftime
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.ui.gtkui.torrentdetails import Tab from deluge.ui.gtkui.torrentdetails import Tab
from deluge.ui.gtkui.piecesbar import PiecesBar from deluge.ui.gtkui.piecesbar import PiecesBar
@ -46,12 +46,14 @@ log = logging.getLogger(__name__)
def fpeer_sized(first, second): 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): def fratio(value):
if value < 0: if value < 0:
return "" return ""
elif value == 0:
return "0"
return "%.3f" % value return "%.3f" % value
@ -61,21 +63,29 @@ def fpcnt(value, state):
return "%s%.2f%%" % (state, value) return "%s%.2f%%" % (state, value)
def fspeed(value, max_value=-1): def fspeed_max(value, max_value=-1):
if 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: else:
return deluge.common.fspeed(value) return fspeed(value)
def fdate_or_never(value): def fdate_or_never(value):
"""Display value as date, eg 05/05/08 or Never""" """Display value as date, eg 05/05/08 or Never"""
if value > 0.0: if value > 0.0:
return deluge.common.fdate(value) return fdate(value)
else: else:
return "Never" 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): class StatusTab(Tab):
def __init__(self): def __init__(self):
Tab.__init__(self) Tab.__init__(self)
@ -98,14 +108,14 @@ class StatusTab(Tab):
(builder.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download", (builder.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download",
"total_payload_download")), "total_payload_download")),
(builder.get_object("summary_total_uploaded"), fpeer_sized, ("total_uploaded", "total_payload_upload")), (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_download_speed"), fspeed_max, ("download_payload_rate", "max_download_speed")),
(builder.get_object("summary_upload_speed"), fspeed, ("upload_payload_rate", "max_upload_speed")), (builder.get_object("summary_upload_speed"), fspeed_max, ("upload_payload_rate", "max_upload_speed")),
(builder.get_object("summary_seeds"), deluge.common.fpeer, ("num_seeds", "total_seeds")), (builder.get_object("summary_seeds"), fpeer, ("num_seeds", "total_seeds")),
(builder.get_object("summary_peers"), deluge.common.fpeer, ("num_peers", "total_peers")), (builder.get_object("summary_peers"), fpeer, ("num_peers", "total_peers")),
(builder.get_object("summary_eta"), deluge.common.ftime, ("eta",)), (builder.get_object("summary_eta"), ftime_or_dash, ("eta",)),
(builder.get_object("summary_share_ratio"), fratio, ("ratio",)), (builder.get_object("summary_share_ratio"), fratio, ("ratio",)),
(builder.get_object("summary_active_time"), deluge.common.ftime, ("active_time",)), (builder.get_object("summary_active_time"), ftime_or_dash, ("active_time",)),
(builder.get_object("summary_seed_time"), deluge.common.ftime, ("seeding_time",)), (builder.get_object("summary_seed_time"), ftime_or_dash, ("seeding_time",)),
(builder.get_object("summary_seed_rank"), str, ("seed_rank",)), (builder.get_object("summary_seed_rank"), str, ("seed_rank",)),
(builder.get_object("progressbar"), fpcnt, ("progress", "state")), (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_seen_complete"), fdate_or_never, ("last_seen_complete",)),