option to load new torrents above completed ones

This commit is contained in:
Marcos Pinto 2007-07-17 05:24:43 +00:00
parent d94c7e6986
commit d9b1fce480
4 changed files with 37 additions and 3 deletions

View File

@ -295,8 +295,22 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property> <property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="on_chk_seedbottom"/>
</widget> </widget>
</child> </child>
<child>
<widget class="GtkCheckButton" id="chk_queue_above_completed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Queue new torrents above completed ones</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<widget class="GtkHBox" id="hbox14"> <widget class="GtkHBox" id="hbox14">
<property name="visible">True</property> <property name="visible">True</property>
@ -331,7 +345,7 @@
</child> </child>
</widget> </widget>
<packing> <packing>
<property name="position">1</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -344,7 +358,7 @@
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
<property name="position">2</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
</widget> </widget>

View File

@ -798,7 +798,15 @@ class Manager:
# Add torrents to queue - at the end, of course # Add torrents to queue - at the end, of course
for unique_ID in self.unique_IDs.keys(): for unique_ID in self.unique_IDs.keys():
if unique_ID not in self.state.queue: if unique_ID not in self.state.queue:
self.state.queue.append(unique_ID) if (self.get_pref('queue_above_completed')) and len(self.state.queue) > 0:
for index in range(len(self.state.queue)):
torrent_state = self.get_core_torrent_state(self.state.queue[index])
if torrent_state['progress'] == 1.0:
break
self.state.queue.insert(index, unique_ID)
else:
self.state.queue.append(unique_ID)
# run through queue, remove those that no longer exists # run through queue, remove those that no longer exists
to_delete = [] to_delete = []
for queue_item in self.state.queue: for queue_item in self.state.queue:

View File

@ -46,6 +46,7 @@ class PreferencesDlg:
'on_chk_use_tray_toggled': self.tray_toggle, 'on_chk_use_tray_toggled': self.tray_toggle,
'on_save_all_to' : self.toggle_move_chk, 'on_save_all_to' : self.toggle_move_chk,
'on_ask_save' : self.toggle_move_chk, 'on_ask_save' : self.toggle_move_chk,
'on_chk_seedbottom' : self.toggle_queue_above_completed_chk,
'on_chk_autoseed' : self.toggle_clear_max_ratio_torrents_chk, 'on_chk_autoseed' : self.toggle_clear_max_ratio_torrents_chk,
'on_btn_testport_clicked': self.TestPort, 'on_btn_testport_clicked': self.TestPort,
}) })
@ -98,6 +99,8 @@ class PreferencesDlg:
self.glade.get_widget("spin_proxy_port").set_value(self.preferences.get("proxy_port")) self.glade.get_widget("spin_proxy_port").set_value(self.preferences.get("proxy_port"))
self.glade.get_widget("spin_torrents").set_value(float(self.preferences.get("max_active_torrents"))) self.glade.get_widget("spin_torrents").set_value(float(self.preferences.get("max_active_torrents")))
self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom")) self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom"))
self.glade.get_widget("chk_queue_above_completed").set_sensitive(self.preferences.get("queue_seeds_to_bottom"))
self.glade.get_widget("chk_queue_above_completed").set_active(self.preferences.get("queue_above_completed"))
self.glade.get_widget("chk_autoseed").set_active(self.preferences.get("auto_end_seeding")) self.glade.get_widget("chk_autoseed").set_active(self.preferences.get("auto_end_seeding"))
self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(self.preferences.get("auto_end_seeding")) self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(self.preferences.get("auto_end_seeding"))
self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(self.preferences.get("clear_max_ratio_torrents")) self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(self.preferences.get("clear_max_ratio_torrents"))
@ -150,6 +153,7 @@ class PreferencesDlg:
self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active())
self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value()) self.preferences.set("gui_update_interval", self.glade.get_widget("spin_gui").get_value())
self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active()) self.preferences.set("clear_max_ratio_torrents", self.glade.get_widget("chk_clear_max_ratio_torrents").get_active())
self.preferences.set("queue_above_completed", self.glade.get_widget("chk_queue_above_completed").get_active())
return r return r
@ -171,6 +175,13 @@ class PreferencesDlg:
self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(False) self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(False)
self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(False) self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(False)
def toggle_queue_above_completed_chk(self, widget):
if(self.glade.get_widget("chk_seedbottom").get_active()):
self.glade.get_widget("chk_queue_above_completed").set_sensitive(True)
else:
self.glade.get_widget("chk_queue_above_completed").set_active(False)
self.glade.get_widget("chk_queue_above_completed").set_sensitive(False)
def toggle_move_chk(self, widget): def toggle_move_chk(self, widget):
if(self.glade.get_widget("radio_ask_save").get_active()): if(self.glade.get_widget("radio_ask_save").get_active()):
self.glade.get_widget("chk_move_completed").set_active(False) self.glade.get_widget("chk_move_completed").set_active(False)

View File

@ -42,6 +42,7 @@ DEFAULT_PREFS = {
"auto_seed_ratio" : 0, "auto_seed_ratio" : 0,
"close_to_tray" : False, "close_to_tray" : False,
"enable_files_dialog" : False, "enable_files_dialog" : False,
"queue_above_completed" : False,
"clear_max_ratio_torrents" : False, "clear_max_ratio_torrents" : False,
"default_download_path" : os.path.expanduser("~/"), "default_download_path" : os.path.expanduser("~/"),
"default_load_path" : os.path.expanduser("~/"), "default_load_path" : os.path.expanduser("~/"),