Sequential downloads: Implemented in GTK UI torrent options tab.
This commit is contained in:
parent
ce3ce2c035
commit
3b676eca40
File diff suppressed because it is too large
Load Diff
|
@ -53,6 +53,7 @@ class OptionsTab(Tab):
|
||||||
self.spin_max_upload_slots = glade.get_widget("spin_max_upload_slots")
|
self.spin_max_upload_slots = glade.get_widget("spin_max_upload_slots")
|
||||||
self.chk_private = glade.get_widget("chk_private")
|
self.chk_private = glade.get_widget("chk_private")
|
||||||
self.chk_prioritize_first_last = glade.get_widget("chk_prioritize_first_last")
|
self.chk_prioritize_first_last = glade.get_widget("chk_prioritize_first_last")
|
||||||
|
self.chk_sequential_download = glade.get_widget("chk_sequential_download")
|
||||||
self.chk_auto_managed = glade.get_widget("chk_auto_managed")
|
self.chk_auto_managed = glade.get_widget("chk_auto_managed")
|
||||||
self.chk_stop_at_ratio = glade.get_widget("chk_stop_at_ratio")
|
self.chk_stop_at_ratio = glade.get_widget("chk_stop_at_ratio")
|
||||||
self.chk_remove_at_ratio = glade.get_widget("chk_remove_at_ratio")
|
self.chk_remove_at_ratio = glade.get_widget("chk_remove_at_ratio")
|
||||||
|
@ -72,7 +73,9 @@ class OptionsTab(Tab):
|
||||||
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled,
|
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled,
|
||||||
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled,
|
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled,
|
||||||
"on_chk_shared_toggled": self._on_chk_shared_toggled,
|
"on_chk_shared_toggled": self._on_chk_shared_toggled,
|
||||||
"on_spin_value_changed": self._on_spin_value_changed
|
"on_spin_value_changed": self._on_spin_value_changed,
|
||||||
|
"on_chk_sequential_download_toggled": \
|
||||||
|
self._on_chk_sequential_download_toggled
|
||||||
})
|
})
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
@ -113,6 +116,8 @@ class OptionsTab(Tab):
|
||||||
"stop_at_ratio",
|
"stop_at_ratio",
|
||||||
"stop_ratio",
|
"stop_ratio",
|
||||||
"remove_at_ratio",
|
"remove_at_ratio",
|
||||||
|
"compact_allocation",
|
||||||
|
"sequential_download",
|
||||||
"move_on_completed",
|
"move_on_completed",
|
||||||
"move_on_completed_path",
|
"move_on_completed_path",
|
||||||
"shared"
|
"shared"
|
||||||
|
@ -162,6 +167,18 @@ class OptionsTab(Tab):
|
||||||
if status["shared"] != self.prev_status["shared"]:
|
if status["shared"] != self.prev_status["shared"]:
|
||||||
self.chk_shared.set_active(status["shared"])
|
self.chk_shared.set_active(status["shared"])
|
||||||
|
|
||||||
|
if status["compact_allocation"]:
|
||||||
|
self.chk_prioritize_first_last.set_sensitive(False)
|
||||||
|
self.chk_prioritize_first_last.hide()
|
||||||
|
self.chk_sequential_download.set_sensitive(False)
|
||||||
|
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 status["sequential_download"] != self.prev_status["sequential_download"]:
|
||||||
|
self.chk_sequential_download.set_active(status["sequential_download"])
|
||||||
|
|
||||||
|
|
||||||
if self.button_apply.is_sensitive():
|
if self.button_apply.is_sensitive():
|
||||||
self.button_apply.set_sensitive(False)
|
self.button_apply.set_sensitive(False)
|
||||||
|
|
||||||
|
@ -169,25 +186,53 @@ class OptionsTab(Tab):
|
||||||
|
|
||||||
def _on_button_apply_clicked(self, button):
|
def _on_button_apply_clicked(self, button):
|
||||||
if self.spin_max_download.get_value() != self.prev_status["max_download_speed"]:
|
if self.spin_max_download.get_value() != self.prev_status["max_download_speed"]:
|
||||||
client.core.set_torrent_max_download_speed(self.prev_torrent_id, self.spin_max_download.get_value())
|
client.core.set_torrent_max_download_speed(
|
||||||
|
self.prev_torrent_id, self.spin_max_download.get_value()
|
||||||
|
)
|
||||||
if self.spin_max_upload.get_value() != self.prev_status["max_upload_speed"]:
|
if self.spin_max_upload.get_value() != self.prev_status["max_upload_speed"]:
|
||||||
client.core.set_torrent_max_upload_speed(self.prev_torrent_id, self.spin_max_upload.get_value())
|
client.core.set_torrent_max_upload_speed(
|
||||||
|
self.prev_torrent_id, self.spin_max_upload.get_value()
|
||||||
|
)
|
||||||
if self.spin_max_connections.get_value_as_int() != self.prev_status["max_connections"]:
|
if self.spin_max_connections.get_value_as_int() != self.prev_status["max_connections"]:
|
||||||
client.core.set_torrent_max_connections(self.prev_torrent_id, self.spin_max_connections.get_value_as_int())
|
client.core.set_torrent_max_connections(
|
||||||
|
self.prev_torrent_id, self.spin_max_connections.get_value_as_int()
|
||||||
|
)
|
||||||
if self.spin_max_upload_slots.get_value_as_int() != self.prev_status["max_upload_slots"]:
|
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())
|
client.core.set_torrent_max_upload_slots(
|
||||||
if self.chk_prioritize_first_last.get_active() != self.prev_status["prioritize_first_last"]:
|
self.prev_torrent_id, self.spin_max_upload_slots.get_value_as_int()
|
||||||
client.core.set_torrent_prioritize_first_last(self.prev_torrent_id, self.chk_prioritize_first_last.get_active())
|
)
|
||||||
|
if self.chk_prioritize_first_last.get_active() != \
|
||||||
|
self.prev_status["prioritize_first_last"] and \
|
||||||
|
not self.prev_status["compact_allocation"]:
|
||||||
|
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["compact_allocation"]:
|
||||||
|
client.core.set_torrent_sequential_download(
|
||||||
|
self.prev_torrent_id, self.chk_prioritize_first_last.get_active()
|
||||||
|
)
|
||||||
if self.chk_auto_managed.get_active() != self.prev_status["is_auto_managed"]:
|
if self.chk_auto_managed.get_active() != self.prev_status["is_auto_managed"]:
|
||||||
client.core.set_torrent_auto_managed(self.prev_torrent_id, self.chk_auto_managed.get_active())
|
client.core.set_torrent_auto_managed(
|
||||||
|
self.prev_torrent_id, self.chk_auto_managed.get_active()
|
||||||
|
)
|
||||||
if self.chk_stop_at_ratio.get_active() != self.prev_status["stop_at_ratio"]:
|
if self.chk_stop_at_ratio.get_active() != self.prev_status["stop_at_ratio"]:
|
||||||
client.core.set_torrent_stop_at_ratio(self.prev_torrent_id, self.chk_stop_at_ratio.get_active())
|
client.core.set_torrent_stop_at_ratio(
|
||||||
|
self.prev_torrent_id, self.chk_stop_at_ratio.get_active()
|
||||||
|
)
|
||||||
if self.spin_stop_ratio.get_value() != self.prev_status["stop_ratio"]:
|
if self.spin_stop_ratio.get_value() != self.prev_status["stop_ratio"]:
|
||||||
client.core.set_torrent_stop_ratio(self.prev_torrent_id, self.spin_stop_ratio.get_value())
|
client.core.set_torrent_stop_ratio(
|
||||||
|
self.prev_torrent_id, self.spin_stop_ratio.get_value()
|
||||||
|
)
|
||||||
if self.chk_remove_at_ratio.get_active() != self.prev_status["remove_at_ratio"]:
|
if self.chk_remove_at_ratio.get_active() != self.prev_status["remove_at_ratio"]:
|
||||||
client.core.set_torrent_remove_at_ratio(self.prev_torrent_id, self.chk_remove_at_ratio.get_active())
|
client.core.set_torrent_remove_at_ratio(
|
||||||
|
self.prev_torrent_id, self.chk_remove_at_ratio.get_active()
|
||||||
|
)
|
||||||
if self.chk_move_completed.get_active() != self.prev_status["move_on_completed"]:
|
if self.chk_move_completed.get_active() != self.prev_status["move_on_completed"]:
|
||||||
client.core.set_torrent_move_completed(self.prev_torrent_id, self.chk_move_completed.get_active())
|
client.core.set_torrent_move_completed(
|
||||||
|
self.prev_torrent_id, self.chk_move_completed.get_active()
|
||||||
|
)
|
||||||
if self.chk_move_completed.get_active():
|
if self.chk_move_completed.get_active():
|
||||||
if client.is_localhost():
|
if client.is_localhost():
|
||||||
path = self.filechooser_move_completed.get_current_folder()
|
path = self.filechooser_move_completed.get_current_folder()
|
||||||
|
@ -195,7 +240,9 @@ class OptionsTab(Tab):
|
||||||
path = self.entry_move_completed.get_text()
|
path = self.entry_move_completed.get_text()
|
||||||
client.core.set_torrent_move_completed_path(self.prev_torrent_id, path)
|
client.core.set_torrent_move_completed_path(self.prev_torrent_id, path)
|
||||||
if self.chk_shared.get_active() != self.prev_status["shared"]:
|
if self.chk_shared.get_active() != self.prev_status["shared"]:
|
||||||
client.core.set_torrents_shared(self.prev_torrent_id, self.chk_shared.get_active())
|
client.core.set_torrents_shared(
|
||||||
|
self.prev_torrent_id, self.chk_shared.get_active()
|
||||||
|
)
|
||||||
self.button_apply.set_sensitive(False)
|
self.button_apply.set_sensitive(False)
|
||||||
|
|
||||||
def _on_button_edit_trackers_clicked(self, button):
|
def _on_button_edit_trackers_clicked(self, button):
|
||||||
|
@ -238,3 +285,7 @@ class OptionsTab(Tab):
|
||||||
def _on_spin_value_changed(self, widget):
|
def _on_spin_value_changed(self, widget):
|
||||||
if not self.button_apply.is_sensitive():
|
if not self.button_apply.is_sensitive():
|
||||||
self.button_apply.set_sensitive(True)
|
self.button_apply.set_sensitive(True)
|
||||||
|
|
||||||
|
def _on_chk_sequential_download_toggled(self, widget):
|
||||||
|
if not self.button_apply.is_sensitive():
|
||||||
|
self.button_apply.set_sensitive(True)
|
||||||
|
|
Loading…
Reference in New Issue