From 4dc59b5255227f910fc06a29d60bc590afcb23af Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 28 Oct 2016 11:08:33 +0100 Subject: [PATCH] [Core] Remove compact allocation references * This has been removed from lt 1.1 so no longer relevant. --- deluge/core/torrent.py | 17 +++-------------- deluge/core/torrentmanager.py | 5 +---- deluge/ui/gtkui/files_tab.py | 6 +----- deluge/ui/gtkui/options_tab.py | 30 ++++++++++-------------------- 4 files changed, 15 insertions(+), 43 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 2a8b2998e..8b97abc31 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -382,9 +382,6 @@ class Torrent(object): return None, None if not self.has_metadata: return None, None - if self.get_status(["storage_mode"])["storage_mode"] == "compact": - log.debug("Setting first/last priority with compact allocation does not work!") - return None, None # A list of priorities for each piece in the torrent priorities = self.handle.piece_priorities() prioritized_pieces = [] @@ -417,11 +414,8 @@ class Torrent(object): Args: set_sequencial (bool): Enable sequencial downloading. """ - if self.get_status(["storage_mode"])["storage_mode"] != "compact": - self.options["sequential_download"] = set_sequencial - self.handle.set_sequential_download(set_sequencial) - else: - self.options["sequential_download"] = False + self.options["sequential_download"] = set_sequencial + self.handle.set_sequential_download(set_sequencial) def set_auto_managed(self, auto_managed): """Set auto managed mode, i.e. will be started or queued automatically. @@ -500,11 +494,6 @@ class Torrent(object): self.options["file_priorities"] = self.handle.file_priorities() return - if self.get_status(["storage_mode"])["storage_mode"] == "compact": - log.warning("Setting file priority with compact allocation does not work!") - self.options["file_priorities"] = self.handle.file_priorities() - return - if log.isEnabledFor(logging.DEBUG): log.debug("Setting %s's file priorities: %s", self.torrent_id, file_priorities) @@ -982,7 +971,7 @@ class Torrent(object): "seeding_time": lambda: self.status.seeding_time, "finished_time": lambda: self.status.finished_time, "all_time_download": lambda: self.status.all_time_download, - "storage_mode": lambda: self.status.storage_mode.name.split("_")[2], # sparse, allocate or compact + "storage_mode": lambda: self.status.storage_mode.name.split("_")[2], # sparse or allocate "distributed_copies": lambda: max(0.0, self.status.distributed_copies), "download_payload_rate": lambda: self.status.download_payload_rate, "file_priorities": lambda: self.options["file_priorities"], diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 3849c1a92..218f5b015 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -538,10 +538,7 @@ class TorrentManager(component.Component): try: for attr in set(dir(t_state_tmp)) - set(dir(state.torrents[0])): for t_state in state.torrents: - if attr == "storage_mode" and getattr(t_state, "compact", None): - setattr(t_state, attr, "compact") - else: - setattr(t_state, attr, getattr(t_state_tmp, attr, None)) + setattr(t_state, attr, getattr(t_state_tmp, attr, None)) except AttributeError as ex: log.error("Unable to update state file to a compatible version: %s", ex) return state diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 8014cf03d..36835dce4 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -445,10 +445,6 @@ class FilesTab(Tab): if self.torrent_id != torrent_id: return - # Store this torrent's compact setting - if "storage_mode" in status: - self.__compact = status["storage_mode"] == "compact" - if "is_seed" in status: self.__is_seed = status["is_seed"] @@ -498,7 +494,7 @@ class FilesTab(Tab): self.listview.get_selection().select_iter(row) for widget in self.file_menu_priority_items: - widget.set_sensitive(not (self.__compact or self.__is_seed)) + widget.set_sensitive(not self.__is_seed) self.file_menu.popup(None, None, None, event.button, event.time) return True diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py index 94a6098bf..0ee14faf5 100644 --- a/deluge/ui/gtkui/options_tab.py +++ b/deluge/ui/gtkui/options_tab.py @@ -147,22 +147,14 @@ class OptionsTab(Tab): if status["owner"] != self.prev_status["owner"]: self.summary_owner.set_text(status["owner"]) - if status["storage_mode"] == "compact": - self.chk_prioritize_first_last.set_sensitive(False) - if self.chk_sequential_download.get_property("visible"): - self.chk_prioritize_first_last.hide() - self.chk_sequential_download.set_sensitive(False) - if self.chk_sequential_download.get_property("visible"): - self.chk_sequential_download.hide() - else: - if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]: - self.chk_prioritize_first_last.set_active(status["prioritize_first_last"]) - if not self.chk_prioritize_first_last.get_property("visible"): - self.chk_prioritize_first_last.show() - if status["sequential_download"] != self.prev_status["sequential_download"]: - self.chk_sequential_download.set_active(status["sequential_download"]) - if not self.chk_sequential_download.get_property("visible"): - self.chk_sequential_download.show() + if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]: + self.chk_prioritize_first_last.set_active(status["prioritize_first_last"]) + if not self.chk_prioritize_first_last.get_property("visible"): + self.chk_prioritize_first_last.show() + if status["sequential_download"] != self.prev_status["sequential_download"]: + self.chk_sequential_download.set_active(status["sequential_download"]) + 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) @@ -180,12 +172,10 @@ class OptionsTab(Tab): if self.spin_max_upload_slots.get_value_as_int() != self.prev_status["max_upload_slots"]: client.core.set_torrent_max_upload_slots( 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 self.prev_status["storage_mode"] != "compact"): + if (self.chk_prioritize_first_last.get_active() != self.prev_status["prioritize_first_last"]): 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 self.prev_status["storage_mode"] != "compact"): + if (self.chk_sequential_download.get_active() != self.prev_status["sequential_download"]): client.core.set_torrent_options( [self.prev_torrent_id], {"sequential_download": self.chk_sequential_download.get_active()}) if self.chk_auto_managed.get_active() != self.prev_status["is_auto_managed"]: