mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-28 11:00:33 +00:00
proper paths for cross platfrom
This commit is contained in:
parent
3fd1434b04
commit
0ed3bda526
@ -34,6 +34,7 @@ import urllib, deluge.common, deluge.pref
|
||||
from peerguardian import PGReader, PGException
|
||||
from text import TextReader, GZMuleReader, PGZip
|
||||
from ui import GTKConfig, GTKProgress
|
||||
import os.path
|
||||
|
||||
# List of formats supported. This is used to generate the UI list and
|
||||
# specify the reader class. The last entry is for storage by the UI.
|
||||
@ -55,9 +56,9 @@ class BlocklistImport:
|
||||
self.gtkprog = GTKProgress(self)
|
||||
self.nimported = 0
|
||||
|
||||
self.blockfile = deluge.common.CONFIG_DIR + "/blocklist.cache"
|
||||
self.blockfile = os.path.join(deluge.common.CONFIG_DIR, "blocklist.cache")
|
||||
|
||||
conffile = deluge.common.CONFIG_DIR + "/blocklist.conf"
|
||||
conffile = os.path.join(deluge.common.CONFIG_DIR, "blocklist.conf")
|
||||
self.config = deluge.pref.Preferences(filename=conffile,
|
||||
global_defaults=False)
|
||||
self.config.load()
|
||||
|
@ -37,6 +37,7 @@ DEFAULT_PREFS = {
|
||||
|
||||
import deluge
|
||||
import gtk, gtk.glade
|
||||
import os.path
|
||||
|
||||
class DesiredRatio:
|
||||
|
||||
@ -48,7 +49,7 @@ class DesiredRatio:
|
||||
self.callback_ids = []
|
||||
|
||||
# Setup preferences
|
||||
self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/desired_ratio.conf", global_defaults=False, defaults=DEFAULT_PREFS)
|
||||
self.config = deluge.pref.Preferences(filename=os.path.join(deluge.common.CONFIG_DIR, "desired_ratio.conf"), global_defaults=False, defaults=DEFAULT_PREFS)
|
||||
|
||||
# Connect to events for the torrent menu so we know when to build and remove our sub-menu
|
||||
self.callback_ids.append(self.interface.torrent_menu.connect_after("realize", self.torrent_menu_show))
|
||||
|
@ -52,6 +52,7 @@ def enable(core, interface):
|
||||
### The Plugin ###
|
||||
import deluge
|
||||
import gtk
|
||||
import os.path
|
||||
from EventLogging.tab_log import LogTabManager
|
||||
|
||||
class EventLogging:
|
||||
@ -61,7 +62,7 @@ class EventLogging:
|
||||
self.manager = core
|
||||
self.parent = interface
|
||||
# Create an options file and try to load existing Values
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/event_logging.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "event_logging.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, False)
|
||||
try:
|
||||
self.config.load()
|
||||
@ -69,7 +70,7 @@ class EventLogging:
|
||||
# File does not exist
|
||||
pass
|
||||
self.dialog_initialize = True
|
||||
self.glade = gtk.glade.XML(path + "/event_logging_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "event_logging_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.dialog.set_position(gtk.WIN_POS_CENTER)
|
||||
self.glade.signal_autoconnect({
|
||||
|
@ -57,7 +57,7 @@ class ExtraStats:
|
||||
print "Loading ExtraStats plugin..."
|
||||
self.manager = core
|
||||
# Create an options file and try to load existing Values
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/extra_stats.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "extra_stats.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, False,
|
||||
{'enable_downloaded': True,
|
||||
'enable_uploaded': True,
|
||||
@ -70,7 +70,7 @@ class ExtraStats:
|
||||
except IOError:
|
||||
# File does not exist
|
||||
pass
|
||||
self.glade = gtk.glade.XML(path + "/stats_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "stats_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.dialog.set_position(gtk.WIN_POS_CENTER)
|
||||
self.glade.signal_autoconnect({
|
||||
|
@ -1145,7 +1145,7 @@ class plugin_FlexRSS:
|
||||
def configure_ui_show_toolbar_button(self):
|
||||
if self.toolbar_button == None:
|
||||
import gtk
|
||||
import os
|
||||
import os.path
|
||||
|
||||
icon = gtk.Image()
|
||||
icon.set_from_file(os.path.join(self.path, "FlexRSS.png"))
|
||||
|
@ -37,10 +37,10 @@ def enable(core, interface):
|
||||
import deluge
|
||||
from deluge import dialogs
|
||||
import gtk
|
||||
import os
|
||||
import os.path
|
||||
|
||||
DEFAULT_PREFS = {
|
||||
"default_finished_path": os.path.expanduser("~/"),
|
||||
"default_finished_path": os.path.expanduser("~"),
|
||||
"enable_move_completed": False
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ class movetorrentMenu:
|
||||
self.dialogs = deluge.dialogs
|
||||
self.core.connect_event(self.core.constants['EVENT_STORAGE_MOVED'], self.handle_event)
|
||||
self.core.connect_event(self.core.constants['EVENT_FINISHED'], self.handle_event)
|
||||
self.glade = gtk.glade.XML(path + "/movetorrent.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "movetorrent.glade"))
|
||||
self.glade.signal_autoconnect({
|
||||
'dialog_ok': self.dialog_ok,
|
||||
'dialog_cancel': self.dialog_cancel
|
||||
@ -63,7 +63,7 @@ class movetorrentMenu:
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.dialog.set_position(gtk.WIN_POS_CENTER)
|
||||
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/move_torrent.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "move_torrent.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, global_defaults=False, defaults=DEFAULT_PREFS)
|
||||
try:
|
||||
self.config.load()
|
||||
@ -99,7 +99,6 @@ class movetorrentMenu:
|
||||
self.core.move_storage(unique_id, path)
|
||||
|
||||
def configure(self, window):
|
||||
import os.path
|
||||
try:
|
||||
self.glade.get_widget("chk_move_completed").set_active(self.config.get("enable_move_completed"))
|
||||
self.glade.get_widget("finished_path_button").set_filename(self.config.get("default_finished_path"))
|
||||
|
@ -48,6 +48,7 @@ from NetworkGraph.tab_graph import GraphTabManager
|
||||
|
||||
import gtk
|
||||
import deluge
|
||||
import os.path
|
||||
|
||||
class NetworkGraph:
|
||||
def __init__(self, path, core, interface):
|
||||
@ -55,7 +56,7 @@ class NetworkGraph:
|
||||
self.location = path
|
||||
self.manager = core
|
||||
self.dialog_initialize = True
|
||||
self.glade = gtk.glade.XML(path + "/graph_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "graph_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.glade.signal_autoconnect({
|
||||
'on_Reset_Download_released' : self.reset_download,
|
||||
@ -64,7 +65,7 @@ class NetworkGraph:
|
||||
'on_button_ok_pressed': self.ok_pressed
|
||||
})
|
||||
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/graph.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "graph.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, False)
|
||||
try:
|
||||
self.config.load()
|
||||
|
@ -1,4 +1,5 @@
|
||||
import deluge.common, deluge.pref, gtk, copy, pickle, time
|
||||
import os.path
|
||||
|
||||
class plugin_Scheduler:
|
||||
def __init__(self, path, deluge_core, deluge_interface):
|
||||
@ -7,7 +8,7 @@ class plugin_Scheduler:
|
||||
self.interface = deluge_interface
|
||||
|
||||
self.days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
||||
self.conf_file = deluge.common.CONFIG_DIR + "/scheduler.conf"
|
||||
self.conf_file = os.path.join(deluge.common.CONFIG_DIR, "scheduler.conf")
|
||||
self.config = deluge.pref.Preferences()
|
||||
self.button_state_temp = [[0] * 7 for dummy in xrange(24)]
|
||||
self.status = -1
|
||||
|
@ -36,6 +36,7 @@ DEFAULT_PREFS = {
|
||||
|
||||
import deluge
|
||||
import gtk, gtk.glade
|
||||
import os.path
|
||||
|
||||
class DesiredSpeed:
|
||||
|
||||
@ -47,7 +48,7 @@ class DesiredSpeed:
|
||||
self.set_down_speeds = {}
|
||||
self.callback_ids = []
|
||||
|
||||
self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/desired_speed.conf", global_defaults=False, defaults=DEFAULT_PREFS)
|
||||
self.config = deluge.pref.Preferences(filename=os.path.join(deluge.common.CONFIG_DIR, "desired_speed.conf"), global_defaults=False, defaults=DEFAULT_PREFS)
|
||||
|
||||
self.callback_ids.append(self.interface.torrent_menu.connect_after("realize", self.torrent_menu_show))
|
||||
self.callback_ids.append(self.interface.torrent_menu.connect("show", self.torrent_menu_show))
|
||||
|
@ -33,6 +33,7 @@ def enable(core, interface):
|
||||
|
||||
import deluge
|
||||
import gtk, gtk.glade
|
||||
import os.path
|
||||
|
||||
class TorrentCreator:
|
||||
|
||||
@ -79,7 +80,7 @@ class TorrentCreator:
|
||||
|
||||
def new_torrent_clicked(self, widget, data=None):
|
||||
# Show the torrent creator dialog
|
||||
self.glade = gtk.glade.XML(self.path + "/torrentcreator.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(self.path, "torrentcreator.glade"))
|
||||
|
||||
self.dialog = self.glade.get_widget("torrentcreator")
|
||||
self.glade.get_widget("piece_size_combobox").set_active(3)
|
||||
|
@ -49,13 +49,14 @@ import gtk
|
||||
|
||||
import deluge
|
||||
from TorrentFiles.tab_files import FilesTabManager
|
||||
import os.path
|
||||
|
||||
class TorrentFiles:
|
||||
def __init__(self, path, core, interface):
|
||||
print "Loading TorrentFiles plugin..."
|
||||
self.parent = interface
|
||||
self.manager = core
|
||||
config_file = deluge.common.CONFIG_DIR + "/files.conf"
|
||||
config_file = os.path.join(deluge.common.CONFIG_DIR, "files.conf")
|
||||
self.config = deluge.pref.Preferences(config_file, False,
|
||||
defaults={'file_viewer': 'xdg-open'})
|
||||
try:
|
||||
@ -64,7 +65,7 @@ class TorrentFiles:
|
||||
# File does not exist
|
||||
pass
|
||||
|
||||
self.glade = gtk.glade.XML(path + "/files_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "files_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.glade.signal_autoconnect({
|
||||
'on_button_cancel_clicked': self.on_button_cancel_clicked,
|
||||
|
@ -34,6 +34,7 @@ def enable(core, interface):
|
||||
import deluge
|
||||
import deluge.common
|
||||
import gtk
|
||||
import os.path
|
||||
|
||||
class TorrentNotification:
|
||||
|
||||
@ -48,7 +49,7 @@ class TorrentNotification:
|
||||
self.core.connect_event(self.core.constants['EVENT_FINISHED'], self.handle_event)
|
||||
|
||||
# Create an options file and try to load existing Values
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/notification.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "notification.conf")
|
||||
if deluge.common.windows_check():
|
||||
self.config = deluge.pref.Preferences(self.config_file, False,
|
||||
defaults={'enable_tray_blink' : True,
|
||||
@ -66,7 +67,7 @@ class TorrentNotification:
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
self.glade = gtk.glade.XML(path + "/notification_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "notification_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.dialog.set_position(gtk.WIN_POS_CENTER)
|
||||
self.glade.signal_autoconnect({
|
||||
@ -117,7 +118,6 @@ class TorrentNotification:
|
||||
pass
|
||||
|
||||
def configure(self, window):
|
||||
import os.path
|
||||
self.glade.get_widget("chk_tray_blink").set_active(self.config.get("enable_tray_blink"))
|
||||
if deluge.common.windows_check():
|
||||
self.glade.get_widget("chk_notification").set_active(False)
|
||||
@ -155,7 +155,6 @@ class TorrentNotification:
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
import os.path
|
||||
import sys
|
||||
pygame.init()
|
||||
try:
|
||||
|
@ -49,6 +49,7 @@ import gtk
|
||||
|
||||
import deluge
|
||||
from TorrentPeers.tab_peers import PeersTabManager
|
||||
import os.path
|
||||
|
||||
class TorrentPeers:
|
||||
|
||||
@ -56,7 +57,7 @@ class TorrentPeers:
|
||||
print "Loading TorrentPeers plugin..."
|
||||
self.parent = interface
|
||||
self.manager = core
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/peers.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "peers.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, False,
|
||||
defaults={'enable_flags' : True,
|
||||
'size_18' : True})
|
||||
@ -66,7 +67,7 @@ class TorrentPeers:
|
||||
# File does not exist
|
||||
pass
|
||||
self.dialog_initialize = True
|
||||
self.glade = gtk.glade.XML(path + "/peers_preferences.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "peers_preferences.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
self.glade.signal_autoconnect({
|
||||
'toggle_ui': self.toggle_ui,
|
||||
|
@ -1,48 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# __init__.py
|
||||
#
|
||||
# Copyright (C) Marcos Pinto 2007 <markybob@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.
|
||||
|
||||
plugin_name = "Torrent Search"
|
||||
plugin_author = "Zach Tibbitts"
|
||||
plugin_version = "0.5"
|
||||
plugin_description = _("A searchbar for torrent search engines")
|
||||
|
||||
|
||||
def deluge_init(deluge_path):
|
||||
global path
|
||||
path = deluge_path
|
||||
|
||||
|
||||
from TorrentSearch.plugin import plugin_Search
|
||||
|
||||
def enable(core, interface):
|
||||
global path
|
||||
return plugin_Search(path, core, interface)
|
@ -1,187 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# plugin.py
|
||||
#
|
||||
# Copyright (C) Marcos Pinto 2007 <markybob@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.
|
||||
|
||||
|
||||
class plugin_Search:
|
||||
def __init__(self, path, deluge_core, deluge_interface):
|
||||
import gtk, gtk.glade, os
|
||||
import deluge.common, deluge.dgtk, deluge.pref
|
||||
self.core = deluge_core
|
||||
self.interface = deluge_interface
|
||||
self.conf_file = deluge.common.CONFIG_DIR + "/search.conf"
|
||||
if not os.path.isfile(self.conf_file):
|
||||
f = open(self.conf_file, mode='w')
|
||||
f.flush()
|
||||
f.close()
|
||||
glade = gtk.glade.XML(path + "/searchdlg.glade")
|
||||
self.dlg = glade.get_widget("search_dialog")
|
||||
# self.dlg.set_icon_from_file(deluge.common.get_pixmap("deluge32.png"))
|
||||
self.view = glade.get_widget("search_view")
|
||||
model = gtk.ListStore(str, str)
|
||||
self.view.set_model(model)
|
||||
deluge.dgtk.add_text_column(self.view, _("Name"), 0, width=80)
|
||||
deluge.dgtk.add_text_column(self.view, _("Search String"), 1)
|
||||
self.field_name = glade.get_widget("field_name")
|
||||
self.field_search = glade.get_widget("field_search")
|
||||
self.button_add = glade.get_widget("button_addsearch")
|
||||
self.button_del = glade.get_widget("button_delsearch")
|
||||
dic = { "add_clicked" : self.add_clicked,
|
||||
"del_clicked" : self.del_clicked,
|
||||
"row_clicked" : self.row_clicked,
|
||||
"text_changed" : self.text_changed }
|
||||
glade.signal_autoconnect(dic)
|
||||
self.view.get_selection().set_select_function(self.row_clicked)
|
||||
### Note: All other plugins should use self.interface.toolbar
|
||||
### when adding items to the toolbar
|
||||
self.se = ''
|
||||
self.toolbar = self.interface.wtree.get_widget("tb_left")
|
||||
self.engines = deluge.pref.Preferences(self.conf_file, False)
|
||||
self.search_entry = gtk.Entry()
|
||||
self.search_entry.connect("activate", self.torrent_search)
|
||||
self.search_item = gtk.ToolItem()
|
||||
self.search_item.add(self.search_entry)
|
||||
self.search_icon = gtk.Image()
|
||||
self.search_icon.set_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_MENU)
|
||||
self.menu_button = gtk.MenuToolButton(self.search_icon, _("Choose an Engine"))
|
||||
self.menu_button.set_is_important(True)
|
||||
self.menu_button.connect("clicked", self.torrent_search)
|
||||
self.menu = gtk.Menu()
|
||||
self.manage_item = gtk.ImageMenuItem(_("Manage Engines"))
|
||||
self.image = gtk.Image()
|
||||
self.image.set_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU)
|
||||
self.manage_item.set_image(self.image)
|
||||
self.manage_item.connect("activate", self.configure)
|
||||
self.menu.add(self.manage_item)
|
||||
self.menu_button.set_menu(self.menu)
|
||||
self.toolbar.insert(self.search_item, -1)
|
||||
self.toolbar.insert(self.menu_button, -1)
|
||||
self.populate_search_menu()
|
||||
self.toolbar.show_all()
|
||||
self.search_item.show_all()
|
||||
self.menu_button.show_all()
|
||||
self.menu.show_all()
|
||||
|
||||
def unload(self):
|
||||
self.engines.save(self.conf_file)
|
||||
self.toolbar.remove(self.search_item)
|
||||
self.toolbar.remove(self.menu_button)
|
||||
|
||||
def text_changed(self, args):
|
||||
a = (self.field_name.get_text() != "")
|
||||
b = (self.field_search.get_text() != "")
|
||||
if(a and b):
|
||||
self.button_add.set_sensitive(1)
|
||||
else:
|
||||
self.button_add.set_sensitive(0)
|
||||
|
||||
def add_clicked(self, args):
|
||||
self.view.get_model().append([self.field_name.get_text(),
|
||||
self.field_search.get_text()])
|
||||
self.field_name.set_text("")
|
||||
self.field_search.set_text("")
|
||||
|
||||
def del_clicked(self, args):
|
||||
(model, selection) = self.view.get_selection().get_selected()
|
||||
model.remove(selection)
|
||||
self.button_del.set_sensitive(0)
|
||||
|
||||
def row_clicked(self, args):
|
||||
self.button_del.set_sensitive(1)
|
||||
return True
|
||||
|
||||
def configure(self, widget=None):
|
||||
import gtk, gtk.glade
|
||||
from deluge import common
|
||||
self.dlg.show_all()
|
||||
model = self.view.get_model()
|
||||
model.clear()
|
||||
for name in self.engines.keys():
|
||||
self.view.get_model().append( (name, self.engines.get(name)) )
|
||||
self.button_add.set_sensitive(0)
|
||||
self.button_del.set_sensitive(0)
|
||||
result = self.dlg.run()
|
||||
self.dlg.hide_all()
|
||||
if result == 1:
|
||||
self.engines.clear()
|
||||
the_iter = model.get_iter_first()
|
||||
while the_iter is not None:
|
||||
self.engines.set(model.get_value(the_iter, 0), model.get_value(the_iter, 1))
|
||||
the_iter = model.iter_next(the_iter)
|
||||
self.engines.save(self.conf_file)
|
||||
self.populate_search_menu()
|
||||
|
||||
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def torrent_search(self, widget=None):
|
||||
from deluge import common
|
||||
print "Searching with engine", self.se
|
||||
url = self.engines.get(self.se)
|
||||
entry = self.search_entry.get_text()
|
||||
print 'URL =', url
|
||||
print 'Entry =', entry
|
||||
entry = entry.replace(' ', '+')
|
||||
print 'URL =', url
|
||||
print 'Entry =', entry
|
||||
url = url.replace('${query}', entry)
|
||||
print 'URL =', url
|
||||
print 'Entry =', entry
|
||||
common.open_url_in_browser(url)
|
||||
|
||||
def populate_search_menu(self):
|
||||
import gtk
|
||||
self.menu_button.set_label(_("Choose an Engine"))
|
||||
for child in self.menu.get_children():
|
||||
self.menu.remove(child)
|
||||
group = None
|
||||
i = 0
|
||||
for engine in self.engines.keys():
|
||||
rmi = gtk.RadioMenuItem(None, engine)
|
||||
rmi.eng_name = engine
|
||||
rmi.connect("activate", self.select_search, rmi.eng_name)
|
||||
if (group != None):
|
||||
rmi.set_group(group)
|
||||
else:
|
||||
group = rmi
|
||||
rmi.set_active(1)
|
||||
self.menu.insert(rmi, i)
|
||||
i = i + 1
|
||||
rmi.show()
|
||||
self.menu.insert(self.manage_item, i)
|
||||
self.menu.show()
|
||||
|
||||
def select_search(self, menuitem, engine_string):
|
||||
self.menu_button.set_label(_("Search ") + engine_string)
|
||||
self.se = engine_string
|
||||
|
@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.1.4 on Thu Feb 15 12:48:42 2007 by zach@notapowerbook-->
|
||||
<glade-interface>
|
||||
<widget class="GtkDialog" id="search_dialog">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Manage Search Plugins</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<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 | GDK_ENTER_NOTIFY_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">4</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_addsearch">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="add_clicked"/>
|
||||
<signal name="activate" handler="add_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="search_view">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="right_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="field_name">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="text_changed"/>
|
||||
</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="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="field_search">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="text_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Name:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">URL:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_delsearch">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="del_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkExpander" id="expander1">
|
||||
<property name="visible">True</property>
|
||||
<property name="expanded">True</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Add a new search engine by entering a Name and a URL. For Name, enter the name of the search engine to be used. For URL, enter the url of the seach page. The user's search query will replace any instance of ${query} in the URL.
|
||||
For example, a Google search would be:
|
||||
Name: Google
|
||||
URL: http://www.google.com/search?q=${query}</property>
|
||||
<property name="wrap">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Help</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<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 | GDK_ENTER_NOTIFY_MASK</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">1</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
@ -33,7 +33,7 @@ def enable(core, interface):
|
||||
|
||||
import deluge
|
||||
import gtk
|
||||
import os
|
||||
import os.path
|
||||
|
||||
class webseedMenu:
|
||||
|
||||
@ -42,7 +42,7 @@ class webseedMenu:
|
||||
self.path = path
|
||||
self.core = core
|
||||
self.interface = interface
|
||||
self.glade = gtk.glade.XML(path + "/webseed.glade")
|
||||
self.glade = gtk.glade.XML(os.path.join(path, "webseed.glade"))
|
||||
self.dialog = self.glade.get_widget("dialog")
|
||||
# Add menu item to torrent context menu
|
||||
self.menuitem_image = gtk.Image()
|
||||
|
@ -97,7 +97,7 @@ class plugin_WebUi(object):
|
||||
if status[0] == 0:
|
||||
os.kill(int(status[1].split()[0]), 9)
|
||||
time.sleep(1) #safe time to wait for kill to finish.
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/webui.conf"
|
||||
self.config_file = os.path.join(deluge.common.CONFIG_DIR, "webui.conf")
|
||||
self.config = deluge.pref.Preferences(self.config_file, False)
|
||||
try:
|
||||
self.config.load()
|
||||
@ -162,7 +162,7 @@ class plugin_WebUi(object):
|
||||
|
||||
else:
|
||||
print 'Start Webui(in process)..'
|
||||
server_bin = os.path.dirname(__file__) + '/run_webserver'
|
||||
server_bin = os.path.join(os.path.dirname(__file__), 'run_webserver')
|
||||
self.proc = Popen((server_bin,'env=0.5'))
|
||||
|
||||
def kill_server(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user