diff --git a/deluge/plugins/queue/queue/__init__.py b/deluge/plugins/queue/queue/__init__.py deleted file mode 100644 index 37219e170..000000000 --- a/deluge/plugins/queue/queue/__init__.py +++ /dev/null @@ -1,54 +0,0 @@ -# -# __init__.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -from deluge.log import LOG as log - -from deluge.plugins.init import PluginBase - -class CorePlugin(PluginBase): - def __init__(self, plugin_api, plugin_name): - # Load the Core portion of the plugin - try: - from core import Core - self.plugin = Core(plugin_api, plugin_name) - except Exception, e: - log.debug("Did not load a Core plugin: %s", e) - -class GtkUIPlugin(PluginBase): - def __init__(self, plugin_api, plugin_name): - # Load the GtkUI portion of the plugin - try: - from gtkui import GtkUI - self.plugin = GtkUI(plugin_api, plugin_name) - except Exception, e: - log.debug("Did not load a GtkUI plugin: %s", e) diff --git a/deluge/plugins/queue/queue/core.py b/deluge/plugins/queue/queue/core.py deleted file mode 100644 index c8ea98659..000000000 --- a/deluge/plugins/queue/queue/core.py +++ /dev/null @@ -1,143 +0,0 @@ -# -# core.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -from torrentqueue import TorrentQueue -from deluge.log import LOG as log -from deluge.plugins.corepluginbase import CorePluginBase - -class Core(CorePluginBase): - def enable(self): - # Get a list of torrent_ids in the session - # We give this to the TorrentQueue to compare with the saved state - # and create the queuing order. - self.queue = TorrentQueue(self.plugin.get_torrent_list()) - - # Register core hooks - self.plugin.register_hook("post_torrent_add", self._post_torrent_add) - self.plugin.register_hook("post_torrent_remove", - self._post_torrent_remove) - - # Register the 'queue' status field - self.plugin.register_status_field("queue", self._status_field_queue) - - log.debug("Queue Core plugin enabled..") - - def disable(self): - # Save queue state - self.queue.save_state() - # Delete the queue - del self.queue - self.queue = None - # De-register hooks - self.plugin.deregister_hook("post_torrent_add", self._post_torrent_add) - self.plugin.deregister_hook("post_torrent_remove", - self._post_torrent_remove) - - # De-register status fields - self.plugin.deregister_status_field("queue") - - def update(self): - pass - - ## Hooks for core ## - def _post_torrent_add(self, torrent_id): - if torrent_id is not None: - self.queue.append(torrent_id) - - def _post_torrent_remove(self, torrent_id): - if torrent_id is not None: - self.queue.remove(torrent_id) - - ## Status field function ## - def _status_field_queue(self, torrent_id): - try: - return self.queue[torrent_id]+1 - except TypeError: - return None - - ## Queueing functions ## - def export_queue_top(self, torrent_id): - log.debug("Attempting to queue %s to top", torrent_id) - try: - # If the queue method returns True, then we should emit a signal - if self.queue.top(torrent_id): - self._torrent_queue_changed() - except KeyError: - log.warning("torrent_id: %s does not exist in the queue", - torrent_id) - - def export_queue_up(self, torrent_id): - log.debug("Attempting to queue %s to up", torrent_id) - try: - # If the queue method returns True, then we should emit a signal - if self.queue.up(torrent_id): - self._torrent_queue_changed() - except KeyError: - log.warning("torrent_id: %s does not exist in the queue", - torrent_id) - - def export_queue_down(self, torrent_id): - log.debug("Attempting to queue %s to down", torrent_id) - try: - # If the queue method returns True, then we should emit a signal - if self.queue.down(torrent_id): - self._torrent_queue_changed() - except KeyError: - log.warning("torrent_id: %s does not exist in the queue", - torrent_id) - - def export_queue_bottom(self, torrent_id): - log.debug("Attempting to queue %s to bottom", torrent_id) - try: - # If the queue method returns True, then we should emit a signal - if self.queue.bottom(torrent_id): - self._torrent_queue_changed() - except KeyError: - log.warning("torrent_id: %s does not exist in the queue", - torrent_id) - - def export_get_queue_list(self): - """Returns the queue list. - """ - log.debug("Getting queue list") - return self.queue.queue - - def export_get_position(self, torrent_id): - """Returns the queue position of torrent_id""" - log.debug("Getting queue position for %s", torrent_id) - return self.queue[torrent_id] - - ## Signals ## - def _torrent_queue_changed(self): - """Emitted when a torrent queue position is changed""" - log.debug("torrent_queue_changed signal emitted") diff --git a/deluge/plugins/queue/queue/glade/queuemenu.glade b/deluge/plugins/queue/queue/glade/queuemenu.glade deleted file mode 100644 index 7a5232256..000000000 --- a/deluge/plugins/queue/queue/glade/queuemenu.glade +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-goto-top - True - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-go-up - True - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-go-down - True - True - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-goto-bottom - True - True - - - - - diff --git a/deluge/plugins/queue/queue/glade/queueprefs.glade b/deluge/plugins/queue/queue/glade/queueprefs.glade deleted file mode 100644 index 67d89aae3..000000000 --- a/deluge/plugins/queue/queue/glade/queueprefs.glade +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Queue new torrents to top - 0 - True - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>General</b> - True - - - label_item - - - - - False - False - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 2 - 10 - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 -1 9999 1 10 10 - True - True - - - 1 - 2 - 2 - 3 - - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 -1 9999 1 10 10 - True - True - - - 1 - 2 - 1 - 2 - - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 -1 9999 1 10 10 - True - True - - - 1 - 2 - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Total active downloading: - - - 2 - 3 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Total active seeding: - - - 1 - 2 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Total active torrents: - - - GTK_FILL - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Active Torrents</b> - True - - - label_item - - - - - False - False - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - GTK_SHADOW_NONE - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - 12 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Queue newly finished torrents to bottom - 0 - True - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Stop seeding when share ratio reaches: - 0 - True - - - - False - False - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 0 0 100 0.10000000000000001 1 1 - 2 - True - - - False - False - 1 - - - - - False - False - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 10 - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Remove torrent when share ratio reached - 0 - True - - - - - 2 - - - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Seeding</b> - True - - - label_item - - - - - False - False - 2 - - - - - - diff --git a/deluge/plugins/queue/queue/gtkui.py b/deluge/plugins/queue/queue/gtkui.py deleted file mode 100644 index fb6a7bf1a..000000000 --- a/deluge/plugins/queue/queue/gtkui.py +++ /dev/null @@ -1,119 +0,0 @@ -# -# gtkui.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -import pkg_resources -import gtk.glade -from deluge.log import LOG as log -import ui - -class GtkUI(ui.UI): - def __init__(self, plugin_api, plugin_name): - log.debug("Calling UI init") - # Call UI constructor - ui.UI.__init__(self, plugin_api, plugin_name) - log.debug("Queue GtkUI plugin initalized..") - - def load_interface(self): - # Get the queue menu from the glade file - menu_glade = gtk.glade.XML(pkg_resources.resource_filename("queue", - "glade/queuemenu.glade")) - - prefs_glade = gtk.glade.XML(pkg_resources.resource_filename("queue", - "glade/queueprefs.glade")) - - menu_glade.signal_autoconnect({ - "on_menuitem_queuetop_activate": \ - self.on_queuetop_activate, - "on_menuitem_queueup_activate": self.on_queueup_activate, - "on_menuitem_queuedown_activate": \ - self.on_queuedown_activate, - "on_menuitem_queuebottom_activate": \ - self.on_queuebottom_activate - }) - - menu = menu_glade.get_widget("menu_queue") - - # Connect to the 'torrent_queue_changed' signal - #self.core.connect_to_signal("torrent_queue_changed", - # self.torrent_queue_changed_signal) - - # Add the '#' column at the first position - self.plugin.add_torrentview_text_column("#", - col_type=int, - position=0, - status_field=["queue"]) - # Update the new column right away - self.update() - - # Add a toolbar buttons - self.toolbar_sep = self.plugin.add_toolbar_separator() - self.toolbutton_up = self.plugin.add_toolbar_button( - stock="gtk-go-up", - label=_("Queue Up"), - tooltip=_("Queue selected torrents up"), - callback=self.on_queueup_activate) - - self.toolbutton_down = self.plugin.add_toolbar_button( - stock="gtk-go-down", - label=_("Queue Down"), - tooltip=_("Queue selected torrents down"), - callback=self.on_queuedown_activate) - - # Add a separator before menu - self.menu_sep = self.plugin.add_torrentmenu_separator() - - # Add the queue menu to the torrent menu - self.queue_menuitem = gtk.ImageMenuItem("Queue") - queue_image = gtk.Image() - queue_image.set_from_stock(gtk.STOCK_SORT_ASCENDING, gtk.ICON_SIZE_MENU) - self.queue_menuitem.set_image(queue_image) - self.queue_menuitem.set_submenu(menu) - self.queue_menuitem.show_all() - self.plugin.add_torrentmenu_menu(self.queue_menuitem) - - # Add preferences page - self.queue_pref_page = \ - prefs_glade.get_widget("queue_prefs_box") - self.plugin.add_preferences_page("Queue", self.queue_pref_page) - - def unload_interface(self): - self.plugin.remove_torrentmenu_item(self.menu_sep) - self.plugin.remove_torrentmenu_item(self.queue_menuitem) - self.plugin.remove_toolbar_button(self.toolbar_sep) - self.plugin.remove_toolbar_button(self.toolbutton_up) - self.plugin.remove_toolbar_button(self.toolbutton_down) - self.plugin.remove_torrentview_column("#") - self.plugin.remove_preferences_page("Queue") - - def update(self): - self.plugin.update_torrent_view() diff --git a/deluge/plugins/queue/queue/torrentqueue.py b/deluge/plugins/queue/queue/torrentqueue.py deleted file mode 100644 index 87ddd6281..000000000 --- a/deluge/plugins/queue/queue/torrentqueue.py +++ /dev/null @@ -1,183 +0,0 @@ -# -# torrentqueue.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -import pickle - -import deluge.common -from deluge.log import LOG as log - -class TorrentQueue: - def __init__(self, torrent_list): - # Try to load the queue state from file - self.queue = self.load_state() - - # First remove any torrent_ids in self.queue that are not in the current - # session list. - for torrent_id in self.queue: - if torrent_id not in torrent_list: - self.queue.remove(torrent_id) - - # Next we append any torrents in the session list to self.queue - for torrent_id in torrent_list: - if torrent_id not in self.queue: - self.queue.append(torrent_id) - - def __getitem__(self, torrent_id): - """Return the queue position of the torrent_id""" - try: - return self.queue.index(torrent_id) - except ValueError: - return None - - def load_state(self): - """Load the queue state""" - try: - log.debug("Opening queue state file for load.") - state_file = open(deluge.common.get_config_dir("queue.state"), - "rb") - state = pickle.load(state_file) - state_file.close() - return state - except IOError, e: - log.warning("Unable to load queue state file: %s", e) - - return [] - - def save_state(self): - """Save the queue state""" - try: - log.debug("Saving queue state file.") - state_file = open(deluge.common.get_config_dir("queue.state"), - "wb") - pickle.dump(self.queue, state_file) - state_file.close() - except IOError: - log.warning("Unable to save queue state file.") - - def append(self, torrent_id): - """Append torrent_id to the bottom of the queue""" - log.debug("Append torrent %s to queue..", torrent_id) - self.queue.append(torrent_id) - self.save_state() - - def prepend(self, torrent_id): - """Prepend torrent_id to the top of the queue""" - log.debug("Prepend torrent %s to queue..", torrent_id) - self.queue.insert(0, torrent_id) - self.save_state() - - def remove(self, torrent_id): - """Removes torrent_id from the list""" - log.debug("Remove torrent %s from queue..", torrent_id) - self.queue.remove(torrent_id) - self.save_state() - - def up(self, torrent_id): - """Move torrent_id up one in the queue""" - if torrent_id not in self.queue: - # Raise KeyError if the torrent_id is not in the queue - raise KeyError - - log.debug("Move torrent %s up..", torrent_id) - # Get the index of the torrent_id - index = self.queue.index(torrent_id) - - # Can't queue up if torrent is already at top - if index is 0: - return False - - # Pop and insert the torrent_id at index - 1 - self.queue.insert(index - 1, self.queue.pop(index)) - - self.save_state() - - return True - - def top(self, torrent_id): - """Move torrent_id to top of the queue""" - if torrent_id not in self.queue: - # Raise KeyError if the torrent_id is not in the queue - raise KeyError - - log.debug("Move torrent %s to top..", torrent_id) - # Get the index of the torrent_id - index = self.queue.index(torrent_id) - - # Can't queue up if torrent is already at top - if index is 0: - return False - - # Pop and prepend the torrent_id - self.prepend(self.queue.pop(index)) - - return True - - def down(self, torrent_id): - """Move torrent_id down one in the queue""" - if torrent_id not in self.queue: - # Raise KeyError if torrent_id is not in the queue - raise KeyError - - log.debug("Move torrent %s down..", torrent_id) - # Get the index of the torrent_id - index = self.queue.index(torrent_id) - - # Can't queue down of torrent_id is at bottom - if index is len(self.queue) - 1: - return False - - # Pop and insert the torrent_id at index + 1 - self.queue.insert(index + 1, self.queue.pop(index)) - - self.save_state() - - return True - - def bottom(self, torrent_id): - """Move torrent_id to bottom of the queue""" - if torrent_id not in self.queue: - # Raise KeyError if torrent_id is not in the queue - raise KeyError - - log.debug("Move torrent %s to bottom..", torrent_id) - # Get the index of the torrent_id - index = self.queue.index(torrent_id) - - # Can't queue down of torrent_id is at bottom - if index is len(self.queue) - 1: - return False - - # Pop and append the torrent_id - self.append(self.queue.pop(index)) - - return True diff --git a/deluge/plugins/queue/queue/ui.py b/deluge/plugins/queue/queue/ui.py deleted file mode 100644 index 8cb120950..000000000 --- a/deluge/plugins/queue/queue/ui.py +++ /dev/null @@ -1,128 +0,0 @@ -# -# ui.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -import gettext -import locale -import pkg_resources -from deluge.ui.client import aclient as client -from deluge.log import LOG as log - -class UI: - def __init__(self, plugin_api, plugin_name): - self.plugin = plugin_api - # Initialize gettext - locale.setlocale(locale.LC_MESSAGES, '') - locale.bindtextdomain("deluge", - pkg_resources.resource_filename( - "deluge", "i18n")) - locale.textdomain("deluge") - gettext.bindtextdomain("deluge", - pkg_resources.resource_filename( - "deluge", "i18n")) - gettext.textdomain("deluge") - gettext.install("deluge", - pkg_resources.resource_filename( - "deluge", "i18n")) - - def enable(self): - log.debug("Enabling UI plugin") - # Load the interface and connect the callbacks - self.load_interface() - - def disable(self): - self.unload_interface() - - def load_interface(self): - pass - - def unload_interface(self): - pass - - def update(self): - pass - - ## Menu callbacks ## - def on_queuetop_activate(self, data=None): - log.debug("on_menuitem_queuetop_activate") - # Get the selected torrents - torrent_ids = self.plugin.get_selected_torrents() - for torrent_id in torrent_ids: - try: - client.queue_queue_top(torrent_id) - except Exception, e: - log.debug("Unable to queue top torrent: %s", e) - return - - def on_queueup_activate(self, data=None): - log.debug("on_menuitem_queueup_activate") - # Get the selected torrents - torrent_ids = self.plugin.get_selected_torrents() - for torrent_id in torrent_ids: - try: - client.queue_queue_up(torrent_id) - except Exception, e: - log.debug("Unable to queue up torrent: %s", e) - return - - def on_queuedown_activate(self, data=None): - log.debug("on_menuitem_queuedown_activate") - # Get the selected torrents - torrent_ids = self.plugin.get_selected_torrents() - for torrent_id in torrent_ids: - try: - client.queue_queue_down(torrent_id) - except Exception, e: - log.debug("Unable to queue down torrent: %s", e) - return - - def on_queuebottom_activate(self, data=None): - log.debug("on_menuitem_queuebottom_activate") - # Get the selected torrents - torrent_ids = self.plugin.get_selected_torrents() - for torrent_id in torrent_ids: - try: - client.queue_queue_bottom(torrent_id) - except Exception, e: - log.debug("Unable to queue bottom torrent: %s", e) - return - - ## Signals ## - def torrent_queue_changed_signal(self): - """This function is called whenever we receive a 'torrent_queue_changed' - signal from the core plugin. - """ - log.debug("torrent_queue_changed signal received..") - # We only need to update the queue column - self.update() - return - diff --git a/deluge/plugins/queue/setup.py b/deluge/plugins/queue/setup.py deleted file mode 100644 index 9f7231642..000000000 --- a/deluge/plugins/queue/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -# setup.py -# -# Copyright (C) 2007 Andrew Resch ('andar') -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -""" -Allow torrents to be queued in a specific order -""" - -from setuptools import setup - -__author__ = "Andrew Resch" - -setup( - name="Queue", - version="1.0", - description=__doc__, - author=__author__, - packages=["queue"], - package_data = {"queue": ["glade/*.glade"]}, - entry_points=""" - [deluge.plugin.core] - Queue = queue:CorePlugin - [deluge.plugin.gtkui] - Queue = queue:GtkUIPlugin - """ -)