diff --git a/deluge/core/core.py b/deluge/core/core.py
index f16cc91e1..07c46827d 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -188,29 +188,29 @@ class Core(dbus.service.Object):
in_signature="s", out_signature="")
def queue_top(self, torrent_id):
# If the queue method returns True, then we should emit a signal
- if self.queue.top(torrent_id):
- self.torrent_queue_top()
+ if self.torrents.queue.top(torrent_id):
+ self.torrent_queue_changed()
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def queue_up(self, torrent_id):
# If the queue method returns True, then we should emit a signal
- if self.queue.up(torrent_id):
- self.torrent_queue_up()
-
+ if self.torrents.queue.up(torrent_id):
+ self.torrent_queue_changed()
+
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def queue_down(self, torrent_id):
# If the queue method returns True, then we should emit a signal
- if self.queue.down(torrent_id):
- self.torrent_queue_down()
+ if self.torrents.queue.down(torrent_id):
+ self.torrent_queue_changed()
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def queue_bottom(self, torrent_id):
# If the queue method returns True, then we should emit a signal
- if self.queue.bottom(torrent_id):
- self.torrent_queue_bottom()
+ if self.torrents.queue.bottom(torrent_id):
+ self.torrent_queue_changed()
# Signals
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
@@ -232,25 +232,7 @@ class Core(dbus.service.Object):
log.debug("torrent_remove signal emitted")
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
- signature="s")
- def torrent_queue_top(self, torrent_id):
- """Emitted when a torrent is queued to the top"""
- log.debug("torrent_queue_top signal emitted")
-
- @dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
- signature="s")
- def torrent_queue_up(self, torrent_id):
- """Emitted when a torrent is queued up"""
- log.debug("torrent_queue_up signal emitted")
-
- @dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
- signature="s")
- def torrent_queue_down(self, torrent_id):
- """Emitted when a torrent is queued down"""
- log.debug("torrent_queue_down signal emitted")
-
- @dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
- signature="s")
- def torrent_queue_bottom(self, torrent_id):
- """Emitted when a torrent is queued to the bottom"""
- log.debug("torrent_queue_bottom signal emitted")
+ signature="")
+ def torrent_queue_changed(self):
+ """Emitted when a torrent queue position is changed"""
+ log.debug("torrent_queue_changed signal emitted")
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 54d695e88..7b7824667 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -55,6 +55,9 @@ class Torrent:
left = self.handle.status().total_wanted \
- self.handle.status().total_done
+ if left == 0 or self.handle.status().download_payload_rate == 0:
+ return 0
+
try:
eta = left / self.handle.status().download_payload_rate
except ZeroDivisionError:
diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index 7cde8358e..98c294e08 100644
--- a/deluge/ui/gtkui/addtorrentdialog.py
+++ b/deluge/ui/gtkui/addtorrentdialog.py
@@ -70,7 +70,6 @@ class AddTorrentDialog:
self.chooser.set_current_folder(
self.config.get("default_load_path"))
-
def run(self):
"""Returns a list of selected files or None if no files were selected.
"""
diff --git a/deluge/ui/gtkui/functions.py b/deluge/ui/gtkui/functions.py
index 5e6fb7226..7de2d515c 100644
--- a/deluge/ui/gtkui/functions.py
+++ b/deluge/ui/gtkui/functions.py
@@ -93,6 +93,34 @@ def remove_torrent(torrent_ids):
for torrent_id in torrent_ids:
core.remove_torrent(torrent_id)
+def queue_top(torrent_ids):
+ """Attempts to queue all torrent_ids to the top"""
+ log.debug("Attempting to queue to top these torrents: %s", torrent_ids)
+ core = get_core()
+ for torrent_id in torrent_ids:
+ core.queue_top(torrent_id)
+
+def queue_up(torrent_ids):
+ """Attempts to queue all torrent_ids up"""
+ log.debug("Attempting to queue up these torrents: %s", torrent_ids)
+ core = get_core()
+ for torrent_id in torrent_ids:
+ core.queue_up(torrent_id)
+
+def queue_down(torrent_ids):
+ """Attempts to queue all torrent_ids down"""
+ log.debug("Attempting to queue down these torrents: %s", torrent_ids)
+ core = get_core()
+ for torrent_id in torrent_ids:
+ core.queue_down(torrent_id)
+
+def queue_bottom(torrent_ids):
+ """Attempts to queue all torrent_ids to the bottom"""
+ log.debug("Attempting to queue to bottom these torrents: %s", torrent_ids)
+ core = get_core()
+ for torrent_id in torrent_ids:
+ core.queue_bottom(torrent_id)
+
def get_torrent_status_dict(core, torrent_id):
"""Builds and returns a status dictionary using the status template"""
status = core.get_torrent_status(torrent_id)
diff --git a/deluge/ui/gtkui/glade/torrent_menu.glade b/deluge/ui/gtkui/glade/torrent_menu.glade
index dc1c89d74..a14b823af 100644
--- a/deluge/ui/gtkui/glade/torrent_menu.glade
+++ b/deluge/ui/gtkui/glade/torrent_menu.glade
@@ -106,7 +106,7 @@
True
_Up
True
-
+