Made moving selection along with queue delayed, just like queue operations themselves

This commit is contained in:
Asmageddon 2012-03-12 19:55:48 +01:00
parent 459c4aebb9
commit 8d07a697d3
1 changed files with 29 additions and 29 deletions

View File

@ -71,19 +71,7 @@ def torrent_action(idx, data, mode, ids):
client.core.resume_torrent(ids).addErrback(action_error,mode) client.core.resume_torrent(ids).addErrback(action_error,mode)
elif data==ACTION.QUEUE: elif data==ACTION.QUEUE:
def do_queue(idx,qact,mode,ids): def do_queue(idx,qact,mode,ids):
if qact == ACTION.QUEUE_TOP: def move_selection(r):
log.debug("Queuing torrents top")
client.core.queue_top(ids)
elif qact == ACTION.QUEUE_UP:
log.debug("Queuing torrents up")
client.core.queue_up(ids)
elif qact == ACTION.QUEUE_DOWN:
log.debug("Queuing torrents down")
client.core.queue_down(ids)
elif qact == ACTION.QUEUE_BOTTOM:
log.debug("Queuing torrents bottom")
client.core.queue_bottom(ids)
if mode.config["move_selection"]: if mode.config["move_selection"]:
queue_length = 0 queue_length = 0
selected_num = 0 selected_num = 0
@ -108,6 +96,18 @@ def torrent_action(idx, data, mode, ids):
mode.cursel = queue_length - selected_num + 1 + sorted(mode.marked).index(mode.cursel) mode.cursel = queue_length - selected_num + 1 + sorted(mode.marked).index(mode.cursel)
mode.marked = range(queue_length - selected_num + 1, queue_length+1) mode.marked = range(queue_length - selected_num + 1, queue_length+1)
if qact == ACTION.QUEUE_TOP:
log.debug("Queuing torrents top")
client.core.queue_top(ids).addCallback(move_selection)
elif qact == ACTION.QUEUE_UP:
log.debug("Queuing torrents up")
client.core.queue_up(ids).addCallback(move_selection)
elif qact == ACTION.QUEUE_DOWN:
log.debug("Queuing torrents down")
client.core.queue_down(ids).addCallback(move_selection)
elif qact == ACTION.QUEUE_BOTTOM:
log.debug("Queuing torrents bottom")
client.core.queue_bottom(ids).addCallback(move_selection)
if len(ids) == 1: if len(ids) == 1:
mode.clear_marks() mode.clear_marks()