From 751dc5bf2b54ae9d7deacfe8e38222e9a83dead7 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Tue, 14 Aug 2007 19:16:47 +0000 Subject: [PATCH] add web seed plugin --- plugins/WebSeed/__init__.py | 68 ++++++++++++++++++++++++++ plugins/WebSeed/webseed.glade | 89 +++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 plugins/WebSeed/__init__.py create mode 100644 plugins/WebSeed/webseed.glade diff --git a/plugins/WebSeed/__init__.py b/plugins/WebSeed/__init__.py new file mode 100644 index 000000000..8e1c39156 --- /dev/null +++ b/plugins/WebSeed/__init__.py @@ -0,0 +1,68 @@ +# Copyright (C) 2007 - Marcos Pinto +# +# 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 St, Fifth Floor, Boston, MA 02110-1301 USA. + +### Initialization ### + +plugin_name = _("Web Seed") +plugin_author = "Marcos Pinto" +plugin_version = "0.1" +plugin_description = _("This plugin allows users to add web seeds to their torrents") + +def deluge_init(deluge_path): + global path + path = deluge_path + +def enable(core, interface): + global path + return webseedMenu(path, core, interface) + + +import deluge +import gtk +import os + +class webseedMenu: + + def __init__(self, path, core, interface): + print "Loading Web Seed plugin..." + self.path = path + self.core = core + self.interface = interface + self.glade = gtk.glade.XML(path + "/webseed.glade") + self.dialog = self.glade.get_widget("dialog") + # Add menu item to torrent context menu + self.menuitem_image = gtk.Image() + self.menuitem_image.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU) + + self.menuitem = gtk.ImageMenuItem(_("_Add Web Seed")) + self.menuitem.set_image(self.menuitem_image) + self.menuitem.connect("activate", self.webseed_clicked) + self.interface.torrent_menu.append(self.menuitem) + self.menuitem.show_all() + + def update(self): + pass + + def unload(self): + self.interface.torrent_menu.remove(self.menuitem) + + def webseed_clicked(self, widget): + self.unique_ID = self.interface.get_selected_torrent() + self.dialog.show() + response = self.dialog.run() + self.dialog.hide() + if response: + self.core.add_url_seed(self.unique_ID, self.glade.get_widget("txt_url").get_text()) diff --git a/plugins/WebSeed/webseed.glade b/plugins/WebSeed/webseed.glade new file mode 100644 index 000000000..eb5fb9d10 --- /dev/null +++ b/plugins/WebSeed/webseed.glade @@ -0,0 +1,89 @@ + + + + + + 5 + Open Containing Folder Preferences + 400 + 100 + GDK_WINDOW_TYPE_HINT_NORMAL + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + 2 + + + True + + + 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 + URL: + + + + + + + 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 + + + + + 1 + + + + + False + False + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK + GTK_BUTTONBOX_END + + + True + gtk-cancel + True + 0 + + + + + True + gtk-ok + True + 1 + + + 1 + + + + + False + GTK_PACK_END + + + + + +