diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index ffdeadf27..c31d04b44 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -36,11 +36,29 @@ import logging import deluge.component as component -from deluge.common import fsize, is_url +from deluge.common import fsize, is_url, fdate from deluge.ui.gtkui.torrentdetails import Tab log = logging.getLogger(__name__) + +def fpeer_size_second(first, second): + return "%s (%s)" % (first, fsize(second)) + + +def fdate_blank(value): + """Display value as date, eg 05/05/08 or blank""" + if value > 0.0: + return fdate(value) + else: + return "" + + +def str_yes_no(value): + """Return Yes or No to bool value""" + return _("Yes") if value else _("No") + + class DetailsTab(Tab): def __init__(self): Tab.__init__(self) @@ -56,13 +74,15 @@ 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_tracker"), None, ("tracker",)), + (builder.get_object("summary_completed"), fdate_blank, ("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, ("save_path",)), - (builder.get_object("summary_message"), str, ("message",)), (builder.get_object("summary_hash"), str, ("hash",)), (builder.get_object("summary_comments"), str, ("comment",)), (builder.get_object("summary_owner"), str, ("owner",)), - (builder.get_object("summary_shared"), str, ("shared",)) + (builder.get_object("summary_shared"), str_yes_no, ("shared",)), + (builder.get_object("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")), ] def update(self): @@ -78,9 +98,9 @@ class DetailsTab(Tab): return # Get the torrent status - status_keys = ["name", "total_size", "num_files", "tracker", - "save_path", "message", "hash", "comment", "owner", - "shared"] + status_keys = ["name", "total_size", "num_files", "time_added", "completed_time", + "save_path", "hash", "comment", "owner", "num_pieces", "piece_length", + "shared", "private"] session = component.get("SessionProxy") session.get_torrent_status(selected, status_keys).addCallback(self._on_get_torrent_status) @@ -92,7 +112,7 @@ class DetailsTab(Tab): # Update all the label widgets for widget in self.label_widgets: - if widget[1] != None: + if widget[1] is not None: args = [] try: for key in widget[2]: diff --git a/deluge/ui/gtkui/glade/main_window.tabs.ui b/deluge/ui/gtkui/glade/main_window.tabs.ui index 0cf4fea21..8319b4cb9 100644 --- a/deluge/ui/gtkui/glade/main_window.tabs.ui +++ b/deluge/ui/gtkui/glade/main_window.tabs.ui @@ -98,7 +98,7 @@ True False - 5 + 6 8 10 5 @@ -209,55 +209,6 @@ GTK_FILL - - - True - False - 0 - - - 3 - 4 - 3 - 4 - GTK_FILL - - - - - True - False - 0 - True - char - True - - - 1 - 4 - 4 - 5 - GTK_FILL - - - - - True - False - 0 - 0 - Tracker Status: - - - - - - 4 - 5 - GTK_FILL - GTK_FILL - - True @@ -293,20 +244,6 @@ GTK_FILL - - - True - False - 0 - - - 3 - 4 - 2 - 3 - GTK_FILL - - True @@ -388,15 +325,7 @@ 15 5 - - True - False - 0 - Pieces: - - - - + @@ -625,70 +554,6 @@ GTK_FILL - - - True - False - 0 - Date Added: - - - - - - 6 - 7 - 3 - 4 - GTK_FILL - - - - - True - False - 0 - - - 7 - 8 - 3 - 4 - GTK_FILL - - - - - True - False - 0 - Seed Rank: - - - - - - 4 - 5 - 4 - 5 - GTK_FILL - - - - - True - False - 0 - - - 5 - 6 - 4 - 5 - GTK_FILL - - True @@ -726,11 +591,11 @@ - + True False 0 - Completed: + Seed Rank: @@ -738,13 +603,13 @@ 6 7 - 4 - 5 + 3 + 4 GTK_FILL - + True False 0 @@ -752,11 +617,148 @@ 7 8 - 4 - 5 + 3 + 4 GTK_FILL + + + True + False + 0 + char + True + + + 1 + 4 + 5 + 6 + + + + + + True + False + 0 + True + char + True + + + 5 + 8 + 5 + 6 + GTK_FILL + + + + + True + False + 0 + 0 + Tracker Status: + + + + + + 4 + 5 + 5 + 6 + GTK_FILL + GTK_FILL + + + + + True + False + 5 + + + True + False + 0 + 1 + Tracker: + + + + + + + + 5 + 6 + GTK_FILL + + + + + True + False + 0 + 1 + Torrent Status: + + + + + + 4 + 5 + + + + + True + False + 0 + True + + + 1 + 4 + 4 + 5 + + + + + + True + False + 0 + + + 3 + 4 + 2 + 3 + GTK_FILL + + + + + + + + + + + + + + + + + False @@ -828,13 +830,30 @@ 15 15 - + True False - 10 - 4 - 5 - 2 + 7 + 2 + 10 + 6 + + + True + False + 0 + Comments: + + + + + + 6 + 7 + GTK_SHRINK | GTK_FILL + GTK_FILL + + True @@ -843,155 +862,11 @@ char True - - 1 - 4 - 5 - 6 - - - - - - True - False - 0 - 1 - Comments: - - - - - - 5 - 6 - GTK_FILL - - - - - - True - False - 0 - True - 1 2 - 4 - 5 - - - - - - True - False - 0 - 1 - # of files: - - - - - - 4 - 5 - GTK_FILL - - - - - - True - False - 0 - True - char - True - - - 1 - 4 - 1 - 2 - - - - - - True - False - 0 - Hash: - - - - - - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - char - True - - - 1 - 4 - 7 - 8 - - - - - - True - False - 0 - 1 - Tracker: - - - - - - 7 - 8 - GTK_FILL - - - - - - True - False - 5 - - - True - False - 0 - 1 - Total Size: - - - - - - - - 3 - 4 - GTK_FILL + 6 + 7 @@ -1006,56 +881,374 @@ 1 - 4 + 2 - + True False - 5 + 0 + 1 + Name: + + + + + + GTK_SHRINK | GTK_FILL + GTK_FILL + + + + + True + False + 0 + Hash: + + + + + + 5 + 6 + GTK_SHRINK | GTK_FILL + + + + + + True + False + 0 + True + char + True + + + 1 + 2 + 5 + 6 + + + + + + True + False + 3 + 6 + 10 + 5 - + True False 0 - 0 1 - Name: + Total Files: + + 2 + 3 + GTK_FILL + + + + + True + False + 0 + 1 + Total Size: + + + + + + GTK_SHRINK | GTK_FILL + + + + + True + False + 0 + True + + + 1 + 2 + GTK_FILL + + + + + + True + False + 0 + True + + + 3 + 4 + GTK_FILL + + + + + + True + False + 0 + Pieces: + + + + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + + + 5 + 6 + GTK_FILL + + + + + True + False + 0 + 1 + Private: + + + + + + 4 + 5 + 1 + 2 + GTK_SHRINK | GTK_FILL + + + + + + True + False + 0 + char + True + + + 5 + 6 + 1 + 2 + GTK_FILL + + + + + + True + False + 0 + Added: + + + + + + 1 + 2 + GTK_SHRINK | GTK_FILL + + + + + True + False + 0 + Completed: + + + + + + 2 + 3 + GTK_SHRINK | GTK_FILL + + + + + True + False + 0 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + False + 0 + 1 + Owner: + + + + + + 2 + 3 + 1 + 2 + GTK_SHRINK | GTK_FILL + + + + + + True + False + 0 + 1 + Shared: + + + + + + 2 + 3 + 2 + 3 + GTK_SHRINK | GTK_FILL + + + + + + True + False + 0 + char + True + + + 3 + 4 + 2 + 3 + GTK_FILL + + + + + + True + False + 0 + 20 + + + True + False + 0 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + False + 0 + 20 + + + True + False + 0 + char + True + + + + + 3 + 4 + 1 + 2 + GTK_FILL + + + + + + + + - GTK_FILL + 2 + 1 + 4 + GTK_SHRINK | GTK_FILL - + True False - 5 - - - True - False - 0 - Path: - - - - - + 0 + Path: + + + - 2 - 3 - GTK_FILL - + 4 + 5 + GTK_SHRINK | GTK_FILL + GTK_FILL @@ -1067,154 +1260,14 @@ char True - - 1 - 4 - 2 - 3 - - - - - - True - False - 0 - 1 - Status: - - - - - - 6 - 7 - GTK_FILL - - - - - - True - False - 0 - True - - - 1 - 4 - 6 - 7 - - - - - - True - False - 0 - True - 1 2 - 3 - 4 + 4 + 5 - - - True - False - 0 - 1 - Owner: - - - - - - 8 - 9 - GTK_FILL - - - - - - True - False - 0 - 1 - Shared: - - - - - - 9 - 10 - GTK_FILL - - - - - - True - False - 0 - char - True - - - 1 - 2 - 8 - 9 - - - - - - True - False - 0 - char - True - - - 1 - 2 - 9 - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1774,37 +1827,6 @@ False 3 2 - - - Private - False - True - False - True - False - True - - - - - - - - - Shared - False - True - True - False - True - - - - 1 - 2 - - - Prioritize First/Last @@ -1839,6 +1861,21 @@ + + + Shared + False + True + True + False + True + + + + 2 + + + diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py index e74aacca5..5595bae7b 100644 --- a/deluge/ui/gtkui/options_tab.py +++ b/deluge/ui/gtkui/options_tab.py @@ -40,6 +40,7 @@ from deluge.ui.client import client from deluge.ui.gtkui.path_chooser import PathChooser from deluge.ui.gtkui.torrentdetails import Tab + class OptionsTab(Tab): def __init__(self): Tab.__init__(self) @@ -53,7 +54,6 @@ class OptionsTab(Tab): self.spin_max_upload = builder.get_object("spin_max_upload") self.spin_max_connections = builder.get_object("spin_max_connections") self.spin_max_upload_slots = builder.get_object("spin_max_upload_slots") - self.chk_private = builder.get_object("chk_private") self.chk_prioritize_first_last = builder.get_object("chk_prioritize_first_last") self.chk_sequential_download = builder.get_object("chk_sequential_download") self.chk_auto_managed = builder.get_object("chk_auto_managed") @@ -118,7 +118,6 @@ class OptionsTab(Tab): "max_upload_speed", "max_connections", "max_upload_slots", - "private", "prioritize_first_last", "is_auto_managed", "stop_at_ratio", @@ -139,7 +138,7 @@ class OptionsTab(Tab): def _on_get_torrent_status(self, status): # We only want to update values that have been applied in the core. This # is so we don't overwrite the user changes that haven't been applied yet. - if self.prev_status == None: + if self.prev_status is None: self.prev_status = {}.fromkeys(status.keys(), None) if status != self.prev_status: @@ -151,8 +150,6 @@ class OptionsTab(Tab): self.spin_max_connections.set_value(status["max_connections"]) if status["max_upload_slots"] != self.prev_status["max_upload_slots"]: self.spin_max_upload_slots.set_value(status["max_upload_slots"]) - if status["private"] != self.prev_status["private"]: - self.chk_private.set_active(status["private"]) if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]: self.chk_prioritize_first_last.set_active(status["prioritize_first_last"]) if status["is_auto_managed"] != self.prev_status["is_auto_managed"]: @@ -168,7 +165,8 @@ class OptionsTab(Tab): if status["move_on_completed"] != self.prev_status["move_on_completed"]: self.chk_move_completed.set_active(status["move_on_completed"]) if status["move_on_completed_path"] != self.prev_status["move_on_completed_path"]: - self.move_completed_path_chooser.set_text(status["move_on_completed_path"], cursor_end=False, default_text=True) + self.move_completed_path_chooser.set_text(status["move_on_completed_path"], + cursor_end=False, default_text=True) if status["shared"] != self.prev_status["shared"]: self.chk_shared.set_active(status["shared"]) @@ -189,7 +187,6 @@ class OptionsTab(Tab): if not self.chk_sequential_download.get_property("visible"): self.chk_sequential_download.show() - if self.button_apply.is_sensitive(): self.button_apply.set_sensitive(False) @@ -213,14 +210,14 @@ class OptionsTab(Tab): self.prev_torrent_id, self.spin_max_upload_slots.get_value_as_int() ) if self.chk_prioritize_first_last.get_active() != \ - self.prev_status["prioritize_first_last"] and \ - not self.prev_status["storage_mode"] == "compact": + self.prev_status["prioritize_first_last"] and \ + not self.prev_status["storage_mode"] == "compact": client.core.set_torrent_prioritize_first_last( self.prev_torrent_id, self.chk_prioritize_first_last.get_active() ) if self.chk_sequential_download.get_active() != \ - self.prev_status["sequential_download"] and \ - not self.prev_status["storage_mode"] == "compact": + self.prev_status["sequential_download"] and \ + not self.prev_status["storage_mode"] == "compact": client.core.set_torrent_sequential_download( self.prev_torrent_id, self.chk_prioritize_first_last.get_active() ) @@ -264,7 +261,6 @@ class OptionsTab(Tab): self.button_apply.set_sensitive(True) dialog.run().addCallback(on_response) - def _on_chk_move_completed_toggled(self, widget): value = self.chk_move_completed.get_active() self.move_completed_path_chooser.set_sensitive(value) diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index 10388d559..3cda6e052 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -44,32 +44,27 @@ from deluge.ui.gtkui.piecesbar import PiecesBar log = logging.getLogger(__name__) + def fpeer_sized(first, second): return "%s (%s)" % (deluge.common.fsize(first), deluge.common.fsize(second)) -def fpeer_size_second(first, second): - return "%s (%s)" % (first, deluge.common.fsize(second)) def fratio(value): if value < 0: return "∞" return "%.3f" % value + def fpcnt(value): return "%.2f%%" % value + def fspeed(value, max_value=-1): if max_value > -1: return "%s (%s %s)" % (deluge.common.fspeed(value), max_value, _("KiB/s")) else: return deluge.common.fspeed(value) -def fdate(value): - """Display value as date, eg 05/05/08 or blank""" - if value > 0.0: - return deluge.common.fdate(value) - else: - return "" def fdate_or_never(value): """Display value as date, eg 05/05/08 or Never""" @@ -78,6 +73,7 @@ def fdate_or_never(value): else: return "Never" + class StatusTab(Tab): def __init__(self): Tab.__init__(self) @@ -96,9 +92,9 @@ class StatusTab(Tab): apply_now=True ) self.label_widgets = [ - (builder.get_object("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")), (builder.get_object("summary_availability"), fratio, ("distributed_copies",)), - (builder.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download", "total_payload_download")), + (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")), @@ -113,9 +109,9 @@ class StatusTab(Tab): (builder.get_object("summary_seed_rank"), str, ("seed_rank",)), (builder.get_object("summary_auto_managed"), str, ("is_auto_managed",)), (builder.get_object("progressbar"), fpcnt, ("progress",)), - (builder.get_object("summary_date_added"), deluge.common.fdate, ("time_added",)), (builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)), - (builder.get_object("summary_completed"), fdate, ("completed_time",)), + (builder.get_object("summary_torrent_status"), str, ("message",)), + (builder.get_object("summary_tracker"), None, ("tracker",)), ] def update(self): @@ -130,18 +126,16 @@ class StatusTab(Tab): return # Get the torrent status - status_keys = ["progress", "num_pieces", "piece_length", + status_keys = [ "distributed_copies", "all_time_download", "total_payload_download", - "total_uploaded", "total_payload_upload", "download_payload_rate", - "upload_payload_rate", "num_peers", "num_seeds", "total_peers", - "total_seeds", "eta", "ratio", "next_announce", - "tracker_status", "max_connections", "max_upload_slots", - "max_upload_speed", "max_download_speed", "active_time", - "seeding_time", "seed_rank", "is_auto_managed", "time_added", - "last_seen_complete", "completed_time"] + "total_uploaded", "total_payload_upload", "download_payload_rate", "max_download_speed", + "upload_payload_rate", "max_upload_speed", "num_peers", "num_seeds", "total_peers", + "total_seeds", "eta", "ratio", "tracker_status", "next_announce", "active_time", + "seeding_time", "seed_rank", "is_auto_managed", "progress", "last_seen_complete", + "message", "tracker" + ] if self.config['show_piecesbar']: - status_keys.extend(["pieces", "state"]) - + status_keys.extend(["pieces", "state", "num_pieces"]) component.get("SessionProxy").get_torrent_status( selected, status_keys).addCallback(self._on_get_torrent_status) @@ -152,15 +146,15 @@ class StatusTab(Tab): return if status["is_auto_managed"]: - status["is_auto_managed"]=_("On") + status["is_auto_managed"] = _("On") else: - status["is_auto_managed"]=_("Off") + status["is_auto_managed"] = _("Off") translate_tracker_status = { - "Error" : _("Error"), - "Warning" : _("Warning"), - "Announce OK" : _("Announce OK"), - "Announce Sent" : _("Announce Sent") + "Error": _("Error"), + "Warning": _("Warning"), + "Announce OK": _("Announce OK"), + "Announce Sent": _("Announce Sent") } for key, value in translate_tracker_status.iteritems(): if key in status["tracker_status"]: @@ -169,7 +163,7 @@ class StatusTab(Tab): # Update all the label widgets for widget in self.label_widgets: - if widget[1] != None: + if widget[1] is not None: args = [] try: for key in widget[2]: