mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-10 02:18:41 +00:00
Remove Queue plugin as it's functionality has been moved to the core.
This commit is contained in:
parent
d4a8f29957
commit
2113cbc3c3
8 changed files with 0 additions and 1034 deletions
|
@ -1,54 +0,0 @@
|
||||||
#
|
|
||||||
# __init__.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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)
|
|
|
@ -1,143 +0,0 @@
|
||||||
#
|
|
||||||
# core.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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")
|
|
|
@ -1,49 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
|
||||||
<!--Generated with glade3 3.2.2 on Thu Aug 23 04:16:54 2007 by andrew@fragment-->
|
|
||||||
<glade-interface>
|
|
||||||
<widget class="GtkMenu" id="menu_queue">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_queuetop">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">gtk-goto-top</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_queuetop_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_queueup">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">gtk-go-up</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_queueup_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_queuedown">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">gtk-go-down</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_queuedown_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="menuitem_queuebottom">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">gtk-goto-bottom</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<signal name="activate" handler="on_menuitem_queuebottom_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</glade-interface>
|
|
|
@ -1,306 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
|
||||||
<!--Generated with glade3 3.2.2 on Fri Nov 9 16:19:20 2007 by andrew@fragment-->
|
|
||||||
<glade-interface>
|
|
||||||
<widget class="GtkWindow" id="window1">
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkVBox" id="queue_prefs_box">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="spacing">5</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkFrame" id="frame1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label_xalign">0</property>
|
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="top_padding">5</property>
|
|
||||||
<property name="left_padding">12</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkVBox" id="vbox3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckButton" id="chk_queue_new_top">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Queue new torrents to top</property>
|
|
||||||
<property name="response_id">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes"><b>General</b></property>
|
|
||||||
<property name="use_markup">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="type">label_item</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkFrame" id="frame3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label_xalign">0</property>
|
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment4">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="top_padding">5</property>
|
|
||||||
<property name="left_padding">12</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkTable" id="table1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="n_rows">3</property>
|
|
||||||
<property name="n_columns">2</property>
|
|
||||||
<property name="column_spacing">10</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_downloading">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">0 -1 9999 1 10 10</property>
|
|
||||||
<property name="snap_to_ticks">True</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="bottom_attach">3</property>
|
|
||||||
<property name="x_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_seeding">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">0 -1 9999 1 10 10</property>
|
|
||||||
<property name="snap_to_ticks">True</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="x_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_torrents">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">0 -1 9999 1 10 10</property>
|
|
||||||
<property name="snap_to_ticks">True</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="x_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label4">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes">Total active downloading:</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="bottom_attach">3</property>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes">Total active seeding:</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="label" translatable="yes">Total active torrents:</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label6">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes"><b>Active Torrents</b></property>
|
|
||||||
<property name="use_markup">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="type">label_item</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkFrame" id="frame2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label_xalign">0</property>
|
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="top_padding">5</property>
|
|
||||||
<property name="left_padding">12</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkVBox" id="vbox2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="spacing">2</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckButton" id="chk_finished_bottom">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Queue newly finished torrents to bottom</property>
|
|
||||||
<property name="response_id">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkHBox" id="hbox1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="spacing">5</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckButton" id="chk_seed_ratio">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Stop seeding when share ratio reaches:</property>
|
|
||||||
<property name="response_id">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
<signal name="toggled" handler="on_chk_seed_ratio_toggled"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_share_ratio">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">0 0 100 0.10000000000000001 1 1</property>
|
|
||||||
<property name="digits">2</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="left_padding">10</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckButton" id="chk_remove_ratio">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Remove torrent when share ratio reached</property>
|
|
||||||
<property name="response_id">0</property>
|
|
||||||
<property name="draw_indicator">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes"><b>Seeding</b></property>
|
|
||||||
<property name="use_markup">True</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="type">label_item</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</glade-interface>
|
|
|
@ -1,119 +0,0 @@
|
||||||
#
|
|
||||||
# gtkui.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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()
|
|
|
@ -1,183 +0,0 @@
|
||||||
#
|
|
||||||
# torrentqueue.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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
|
|
|
@ -1,128 +0,0 @@
|
||||||
#
|
|
||||||
# ui.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
# setup.py
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Andrew Resch ('andar') <andrewresch@gmail.com>
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
"""
|
|
||||||
)
|
|
Loading…
Add table
Add a link
Reference in a new issue