Change imports to use absolute paths
This commit is contained in:
parent
45ef6ac56d
commit
08b61eb50b
|
@ -822,8 +822,9 @@ AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL
|
||||||
|
|
||||||
def create_auth_file():
|
def create_auth_file():
|
||||||
import stat
|
import stat
|
||||||
import configmanager
|
import deluge.configmanager
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
|
||||||
|
auth_file = deluge.configmanager.get_config_dir("auth")
|
||||||
# Check for auth file and create if necessary
|
# Check for auth file and create if necessary
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.exists(auth_file):
|
||||||
fd = open(auth_file, "w")
|
fd = open(auth_file, "w")
|
||||||
|
@ -835,11 +836,11 @@ def create_auth_file():
|
||||||
|
|
||||||
|
|
||||||
def create_localclient_account(append=False):
|
def create_localclient_account(append=False):
|
||||||
import configmanager
|
|
||||||
import random
|
import random
|
||||||
from hashlib import sha1 as sha
|
from hashlib import sha1 as sha
|
||||||
|
import deluge.configmanager
|
||||||
|
|
||||||
auth_file = configmanager.get_config_dir("auth")
|
auth_file = deluge.configmanager.get_config_dir("auth")
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.exists(auth_file):
|
||||||
create_auth_file()
|
create_auth_file()
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from twisted.python.failure import Failure
|
||||||
from twisted.web import client, http
|
from twisted.web import client, http
|
||||||
from twisted.web.error import PageRedirect
|
from twisted.web.error import PageRedirect
|
||||||
|
|
||||||
from common import get_version
|
from deluge.common import get_version
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -33,5 +33,5 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
UI_PATH = __path__[0]
|
UI_PATH = __path__[0]
|
||||||
from main import start
|
from deluge.ui.console.main import start
|
||||||
assert start # silence pyflakes
|
assert start # silence pyflakes
|
||||||
|
|
|
@ -18,9 +18,9 @@ import sys
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from colors import strip_colors
|
|
||||||
from deluge.error import DelugeError
|
from deluge.error import DelugeError
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.console.colors import strip_colors
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import colors
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.common import windows_check
|
from deluge.common import windows_check
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.console import colors
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,10 @@ import sys
|
||||||
|
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
|
|
||||||
import colors
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.ui.console import UI_PATH
|
from deluge.ui.console import colors, UI_PATH
|
||||||
from deluge.ui.console.eventlog import EventLog
|
from deluge.ui.console.eventlog import EventLog
|
||||||
from deluge.ui.console.statusbars import StatusBars
|
from deluge.ui.console.statusbars import StatusBars
|
||||||
from deluge.ui.coreconfig import CoreConfig
|
from deluge.ui.coreconfig import CoreConfig
|
||||||
|
@ -298,7 +297,7 @@ class ConsoleUI(component.Component):
|
||||||
print("Sorry, couldn't find any commands")
|
print("Sorry, couldn't find any commands")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
from commander import Commander
|
from deluge.ui.console.commander import Commander
|
||||||
cmdr = Commander(cmds)
|
cmdr = Commander(cmds)
|
||||||
if daemon:
|
if daemon:
|
||||||
cmdr.exec_args(args, *daemon)
|
cmdr.exec_args(args, *daemon)
|
||||||
|
@ -334,7 +333,7 @@ Please use commands from the command line, eg:\n
|
||||||
# pass it the function that handles commands
|
# pass it the function that handles commands
|
||||||
colors.init_colors()
|
colors.init_colors()
|
||||||
self.statusbars = StatusBars()
|
self.statusbars = StatusBars()
|
||||||
from modes.connectionmanager import ConnectionManager
|
from deluge.ui.console.modes.connectionmanager import ConnectionManager
|
||||||
self.stdscr = stdscr
|
self.stdscr = stdscr
|
||||||
self.screen = ConnectionManager(stdscr, self.encoding)
|
self.screen = ConnectionManager(stdscr, self.encoding)
|
||||||
self.eventlog = EventLog()
|
self.eventlog = EventLog()
|
||||||
|
|
|
@ -13,11 +13,11 @@ import os
|
||||||
|
|
||||||
import deluge.common as common
|
import deluge.common as common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import format_utils
|
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from input_popup import InputPopup
|
from deluge.ui.console import format_utils
|
||||||
from popup import MessagePopup
|
from deluge.ui.console.basemode import BaseMode
|
||||||
|
from deluge.ui.console.input_popup import InputPopup
|
||||||
|
from deluge.ui.console.popup import MessagePopup
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
|
|
@ -10,21 +10,21 @@
|
||||||
import logging
|
import logging
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
import column as console_column
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import format_utils
|
import deluge.ui.console.column
|
||||||
from addtorrents import AddTorrents
|
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from eventview import EventView
|
from deluge.ui.console import format_utils
|
||||||
from input_popup import InputPopup
|
from deluge.ui.console.addtorrents import AddTorrents
|
||||||
from legacy import Legacy
|
from deluge.ui.console.basemode import BaseMode
|
||||||
from popup import MessagePopup, Popup, SelectablePopup
|
from deluge.ui.console.eventview import EventView
|
||||||
from preferences import Preferences
|
from deluge.ui.console.input_popup import InputPopup
|
||||||
from torrent_actions import ACTION, torrent_actions_popup
|
from deluge.ui.console.legacy import Legacy
|
||||||
from torrentdetail import TorrentDetail
|
from deluge.ui.console.popup import MessagePopup, Popup, SelectablePopup
|
||||||
|
from deluge.ui.console.preferences import Preferences
|
||||||
|
from deluge.ui.console.torrent_actions import ACTION, torrent_actions_popup
|
||||||
|
from deluge.ui.console.torrentdetail import TorrentDetail
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
@ -365,7 +365,7 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
if ("show_%s" % pref) not in self.config or self.config["show_%s" % pref]]
|
if ("show_%s" % pref) not in self.config or self.config["show_%s" % pref]]
|
||||||
|
|
||||||
self.__columns = [prefs_to_names[col] for col in self.__cols_to_show]
|
self.__columns = [prefs_to_names[col] for col in self.__cols_to_show]
|
||||||
self.__status_fields = console_column.get_required_fields(self.__columns)
|
self.__status_fields = deluge.ui.console.column.get_required_fields(self.__columns)
|
||||||
|
|
||||||
# we always need these, even if we're not displaying them
|
# we always need these, even if we're not displaying them
|
||||||
for rf in ["state", "name", "queue", "progress"]:
|
for rf in ["state", "name", "queue", "progress"]:
|
||||||
|
@ -870,7 +870,7 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
#Because dots are slow
|
#Because dots are slow
|
||||||
sorted_ids = self._sorted_ids
|
sorted_ids = self._sorted_ids
|
||||||
curstate = self.curstate
|
curstate = self.curstate
|
||||||
gcv = console_column.get_column_value
|
gcv = deluge.ui.console.column.get_column_value
|
||||||
fr = format_utils.format_row
|
fr = format_utils.format_row
|
||||||
cols = self.__columns
|
cols = self.__columns
|
||||||
colw = self.column_widths
|
colw = self.column_widths
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import format_utils
|
from deluge.ui.console import format_utils
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ import time
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.ui.client
|
|
||||||
from alltorrents import AllTorrents
|
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import Client, client
|
||||||
from input_popup import InputPopup
|
from deluge.ui.console.alltorrents import AllTorrents
|
||||||
from popup import MessagePopup, SelectablePopup
|
from deluge.ui.console.basemode import BaseMode
|
||||||
|
from deluge.ui.console.input_popup import InputPopup
|
||||||
|
from deluge.ui.console.popup import MessagePopup, SelectablePopup
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
@ -83,7 +82,7 @@ class ConnectionManager(BaseMode):
|
||||||
del self.statuses[host_id]
|
del self.statuses[host_id]
|
||||||
|
|
||||||
for host in self.config["hosts"]:
|
for host in self.config["hosts"]:
|
||||||
c = deluge.ui.client.Client()
|
c = Client()
|
||||||
hadr = host[1]
|
hadr = host[1]
|
||||||
port = host[2]
|
port = host[2]
|
||||||
user = host[3]
|
user = host[3]
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import format_utils
|
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.console import format_utils
|
||||||
|
from deluge.ui.console.basemode import BaseMode
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
|
|
@ -11,14 +11,9 @@ import re
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
from unicodedata import normalize as ud_normalize
|
||||||
from unicodedata import east_asian_width
|
from unicodedata import east_asian_width
|
||||||
|
|
||||||
try:
|
|
||||||
import unicodedata
|
|
||||||
haveud = True
|
|
||||||
except:
|
|
||||||
haveud = False
|
|
||||||
|
|
||||||
|
|
||||||
def format_speed(speed):
|
def format_speed(speed):
|
||||||
if (speed > 0):
|
if (speed > 0):
|
||||||
|
@ -94,7 +89,7 @@ def trim_string(string, w, have_dbls):
|
||||||
idx = 0
|
idx = 0
|
||||||
while width < w:
|
while width < w:
|
||||||
chrs.append(string[idx])
|
chrs.append(string[idx])
|
||||||
if unicodedata.east_asian_width(string[idx]) in ["W", "F"]:
|
if east_asian_width(string[idx]) in ["W", "F"]:
|
||||||
width += 2
|
width += 2
|
||||||
else:
|
else:
|
||||||
width += 1
|
width += 1
|
||||||
|
@ -106,20 +101,16 @@ def trim_string(string, w, have_dbls):
|
||||||
else:
|
else:
|
||||||
return u"%s " % (string[0:w - 1])
|
return u"%s " % (string[0:w - 1])
|
||||||
|
|
||||||
#Dots are slow
|
|
||||||
eaw = unicodedata.east_asian_width
|
|
||||||
ud_normalize = unicodedata.normalize
|
|
||||||
|
|
||||||
|
|
||||||
def format_column(col, lim):
|
def format_column(col, lim):
|
||||||
dbls = 0
|
dbls = 0
|
||||||
#Chosen over isinstance(col, unicode) and col.__class__ == unicode
|
#Chosen over isinstance(col, unicode) and col.__class__ == unicode
|
||||||
# for speed - it's ~3 times faster for non-unicode strings and ~1.5
|
# for speed - it's ~3 times faster for non-unicode strings and ~1.5
|
||||||
# for unicode strings.
|
# for unicode strings.
|
||||||
if haveud and col.__class__ is unicode:
|
if col.__class__ is unicode:
|
||||||
# might have some double width chars
|
# might have some double width chars
|
||||||
col = ud_normalize("NFC", col)
|
col = ud_normalize("NFC", col)
|
||||||
dbls = sum(eaw(c) in "WF" for c in col)
|
dbls = sum(east_asian_width(c) in "WF" for c in col)
|
||||||
size = len(col) + dbls
|
size = len(col) + dbls
|
||||||
if (size >= lim - 1):
|
if (size >= lim - 1):
|
||||||
return trim_string(col, lim, dbls > 0)
|
return trim_string(col, lim, dbls > 0)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from deluge.ui.console import colors
|
from deluge.ui.console import colors
|
||||||
from popup import ALIGN, Popup
|
from deluge.ui.console.popup import ALIGN, Popup
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ from twisted.internet import defer
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager
|
import deluge.configmanager
|
||||||
import deluge.ui.console.colors as colors
|
import deluge.ui.console.colors as colors
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.console.basemode import BaseMode
|
||||||
from deluge.ui.console.modes import format_utils
|
from deluge.ui.console.modes import format_utils
|
||||||
|
|
||||||
strwidth = format_utils.strwidth
|
strwidth = format_utils.strwidth
|
||||||
|
|
|
@ -14,7 +14,7 @@ except ImportError:
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import format_utils
|
from deluge.ui.console import format_utils
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,13 @@ import logging
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from popup import MessagePopup
|
from deluge.ui.console.basemode import BaseMode
|
||||||
from input_popup import Popup, SelectInput
|
from deluge.ui.console.input_popup import Popup, SelectInput
|
||||||
from preference_panes import (BandwidthPane, CachePane, ColumnsPane, DaemonPane, DownloadsPane, InterfacePane,
|
from deluge.ui.console.popup import MessagePopup
|
||||||
NetworkPane, OtherPane, ProxyPane, QueuePane)
|
from deluge.ui.console.preference_panes import (BandwidthPane, CachePane, ColumnsPane, DaemonPane,
|
||||||
|
DownloadsPane, InterfacePane, NetworkPane, OtherPane,
|
||||||
|
ProxyPane, QueuePane)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
|
|
@ -14,8 +14,8 @@ from twisted.internet import defer
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.ui.console import colors
|
from deluge.ui.console import colors
|
||||||
from input_popup import InputPopup
|
from deluge.ui.console.input_popup import InputPopup
|
||||||
from popup import Popup, SelectablePopup
|
from deluge.ui.console.popup import Popup, SelectablePopup
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,13 @@ from collections import deque
|
||||||
from sys import maxint
|
from sys import maxint
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.ui.console.colors as colors
|
from deluge.common import fdate, FILE_PRIORITY, fsize, ftime
|
||||||
import format_utils
|
|
||||||
from basemode import BaseMode
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.common import fsize, fdate, ftime, FILE_PRIORITY
|
from deluge.ui.console import colors, format_utils
|
||||||
from input_popup import InputPopup
|
from deluge.ui.console.basemode import BaseMode
|
||||||
from popup import MessagePopup, SelectablePopup
|
from deluge.ui.console.input_popup import InputPopup
|
||||||
from torrent_actions import ACTION, torrent_actions_popup
|
from deluge.ui.console.popup import MessagePopup, SelectablePopup
|
||||||
|
from deluge.ui.console.torrent_actions import ACTION, torrent_actions_popup
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
from gtkui import start
|
from deluge.ui.gtkui.gtkui import start
|
||||||
assert start # silence pyflakes
|
assert start # silence pyflakes
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
import gtk
|
import gtk
|
||||||
import pygtk
|
import pygtk
|
||||||
|
|
||||||
import common
|
from deluge.common import get_pixmap, get_version, open_url_in_browser
|
||||||
import deluge.common
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.gtkui.common import get_deluge_icon
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ pygtk.require('2.0')
|
||||||
class AboutDialog:
|
class AboutDialog:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
def url_hook(dialog, url):
|
def url_hook(dialog, url):
|
||||||
deluge.common.open_url_in_browser(url)
|
open_url_in_browser(url)
|
||||||
gtk.about_dialog_set_url_hook(url_hook)
|
gtk.about_dialog_set_url_hook(url_hook)
|
||||||
self.about = gtk.AboutDialog()
|
self.about = gtk.AboutDialog()
|
||||||
self.about.set_position(gtk.WIN_POS_CENTER)
|
self.about.set_position(gtk.WIN_POS_CENTER)
|
||||||
self.about.set_name("Deluge")
|
self.about.set_name("Deluge")
|
||||||
self.about.set_program_name(_("Deluge"))
|
self.about.set_program_name(_("Deluge"))
|
||||||
|
|
||||||
version = deluge.common.get_version()
|
version = get_version()
|
||||||
|
|
||||||
self.about.set_copyright(_('Copyright 2007-2011 Deluge Team'))
|
self.about.set_copyright(_('Copyright 2007-2011 Deluge Team'))
|
||||||
self.about.set_comments(
|
self.about.set_comments(
|
||||||
|
@ -249,10 +249,8 @@ class AboutDialog:
|
||||||
self.about.set_website("http://deluge-torrent.org")
|
self.about.set_website("http://deluge-torrent.org")
|
||||||
self.about.set_website_label("deluge-torrent.org")
|
self.about.set_website_label("deluge-torrent.org")
|
||||||
|
|
||||||
self.about.set_icon(common.get_deluge_icon())
|
self.about.set_icon(get_deluge_icon())
|
||||||
self.about.set_logo(gtk.gdk.pixbuf_new_from_file(
|
self.about.set_logo(gtk.gdk.pixbuf_new_from_file(get_pixmap("deluge-about.png")))
|
||||||
deluge.common.get_pixmap("deluge-about.png")
|
|
||||||
))
|
|
||||||
|
|
||||||
if client.connected():
|
if client.connected():
|
||||||
if not client.is_classicmode():
|
if not client.is_classicmode():
|
||||||
|
|
|
@ -18,16 +18,16 @@ import pygtk
|
||||||
import twisted.web.client
|
import twisted.web.client
|
||||||
import twisted.web.error
|
import twisted.web.error
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.ui.common
|
|
||||||
import dialogs
|
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.httpdownloader import download_file
|
from deluge.httpdownloader import download_file
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.common import TorrentInfo
|
||||||
|
from deluge.ui.gtkui.common import reparent_iter
|
||||||
|
from deluge.ui.gtkui.dialogs import ErrorDialog
|
||||||
from deluge.ui.gtkui.path_chooser import PathChooser
|
from deluge.ui.gtkui.path_chooser import PathChooser
|
||||||
from torrentview_data_funcs import cell_data_size
|
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
|
||||||
|
@ -186,15 +186,15 @@ class AddTorrentDialog(component.Component):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
# Get the torrent data from the torrent file
|
# Get the torrent data from the torrent file
|
||||||
try:
|
try:
|
||||||
info = deluge.ui.common.TorrentInfo(filename)
|
info = TorrentInfo(filename)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.debug("Unable to open torrent file: %s", ex)
|
log.debug("Unable to open torrent file: %s", ex)
|
||||||
dialogs.ErrorDialog(_("Invalid File"), ex, self.dialog).run()
|
ErrorDialog(_("Invalid File"), ex, self.dialog).run()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if info.info_hash in self.files:
|
if info.info_hash in self.files:
|
||||||
log.debug("Trying to add a duplicate torrent!")
|
log.debug("Trying to add a duplicate torrent!")
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Duplicate Torrent"),
|
_("Duplicate Torrent"),
|
||||||
_("You cannot add the same torrent twice."),
|
_("You cannot add the same torrent twice."),
|
||||||
self.dialog
|
self.dialog
|
||||||
|
@ -607,7 +607,7 @@ class AddTorrentDialog(component.Component):
|
||||||
elif deluge.common.is_magnet(url):
|
elif deluge.common.is_magnet(url):
|
||||||
self.add_from_magnets([url])
|
self.add_from_magnets([url])
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Invalid URL"),
|
_("Invalid URL"),
|
||||||
"%s %s" % (url, _("is not a valid URL.")),
|
"%s %s" % (url, _("is not a valid URL.")),
|
||||||
self.dialog
|
self.dialog
|
||||||
|
@ -656,7 +656,7 @@ class AddTorrentDialog(component.Component):
|
||||||
else:
|
else:
|
||||||
log.debug("Download failed: %s", result)
|
log.debug("Download failed: %s", result)
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Download Failed"), "%s %s" % (_("Failed to download:"), url),
|
_("Download Failed"), "%s %s" % (_("Failed to download:"), url),
|
||||||
details=result.getErrorMessage(), parent=self.dialog
|
details=result.getErrorMessage(), parent=self.dialog
|
||||||
).run()
|
).run()
|
||||||
|
@ -830,7 +830,7 @@ class AddTorrentDialog(component.Component):
|
||||||
parent = self.files_treestore.append(parent, [True, s, 0, -1, False, gtk.STOCK_DIRECTORY])
|
parent = self.files_treestore.append(parent, [True, s, 0, -1, False, gtk.STOCK_DIRECTORY])
|
||||||
|
|
||||||
self.files_treestore[itr][1] = split_text[-1]
|
self.files_treestore[itr][1] = split_text[-1]
|
||||||
common.reparent_iter(self.files_treestore, itr, parent)
|
reparent_iter(self.files_treestore, itr, parent)
|
||||||
else:
|
else:
|
||||||
# Update the row's text
|
# Update the row's text
|
||||||
self.files_treestore[itr][1] = new_text
|
self.files_treestore[itr][1] = new_text
|
||||||
|
@ -891,7 +891,7 @@ class AddTorrentDialog(component.Component):
|
||||||
self.files_treestore[itr][1] = split_text[-1] + os.path.sep
|
self.files_treestore[itr][1] = split_text[-1] + os.path.sep
|
||||||
|
|
||||||
# Now re-parent itr to parent
|
# Now re-parent itr to parent
|
||||||
common.reparent_iter(self.files_treestore, itr, parent)
|
reparent_iter(self.files_treestore, itr, parent)
|
||||||
itr = parent
|
itr = parent
|
||||||
|
|
||||||
# We need to re-expand the view because it might contracted
|
# We need to re-expand the view because it might contracted
|
||||||
|
|
|
@ -15,16 +15,14 @@ import time
|
||||||
import gtk
|
import gtk
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager
|
from deluge.common import resource_filename
|
||||||
import deluge.ui.client
|
from deluge.configmanager import ConfigManager, get_config_dir
|
||||||
import dialogs
|
|
||||||
from deluge.configmanager import ConfigManager
|
|
||||||
from deluge.error import AuthenticationRequired, BadLoginError, IncompatibleClient
|
from deluge.error import AuthenticationRequired, BadLoginError, IncompatibleClient
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import Client, client
|
||||||
from deluge.ui.common import get_localhost_auth
|
from deluge.ui.common import get_localhost_auth
|
||||||
|
from deluge.ui.gtkui.common import get_deluge_icon, get_logo
|
||||||
|
from deluge.ui.gtkui.dialogs import AuthenticationDialog, ErrorDialog
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -88,7 +86,7 @@ class ConnectionManager(component.Component):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def __load_config(self):
|
def __load_config(self):
|
||||||
auth_file = deluge.configmanager.get_config_dir("auth")
|
auth_file = get_config_dir("auth")
|
||||||
if not os.path.exists(auth_file):
|
if not os.path.exists(auth_file):
|
||||||
from deluge.common import create_localclient_account
|
from deluge.common import create_localclient_account
|
||||||
create_localclient_account()
|
create_localclient_account()
|
||||||
|
@ -116,15 +114,15 @@ class ConnectionManager(component.Component):
|
||||||
# Get the gtk builder file for the connection manager
|
# Get the gtk builder file for the connection manager
|
||||||
self.builder = gtk.Builder()
|
self.builder = gtk.Builder()
|
||||||
# The main dialog
|
# The main dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.ui")
|
||||||
))
|
))
|
||||||
# The add host dialog
|
# The add host dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.addhost.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.addhost.ui")
|
||||||
))
|
))
|
||||||
# The ask password dialog
|
# The ask password dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.askpassword.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "connection_manager.askpassword.ui")
|
||||||
))
|
))
|
||||||
self.window = component.get("MainWindow")
|
self.window = component.get("MainWindow")
|
||||||
|
@ -133,13 +131,13 @@ class ConnectionManager(component.Component):
|
||||||
self.connection_manager = self.builder.get_object("connection_manager")
|
self.connection_manager = self.builder.get_object("connection_manager")
|
||||||
self.connection_manager.set_transient_for(self.window.window)
|
self.connection_manager.set_transient_for(self.window.window)
|
||||||
|
|
||||||
self.connection_manager.set_icon(common.get_deluge_icon())
|
self.connection_manager.set_icon(get_deluge_icon())
|
||||||
|
|
||||||
self.builder.get_object("image1").set_from_pixbuf(common.get_logo(32))
|
self.builder.get_object("image1").set_from_pixbuf(get_logo(32))
|
||||||
|
|
||||||
self.askpassword_dialog = self.builder.get_object("askpassword_dialog")
|
self.askpassword_dialog = self.builder.get_object("askpassword_dialog")
|
||||||
self.askpassword_dialog.set_transient_for(self.connection_manager)
|
self.askpassword_dialog.set_transient_for(self.connection_manager)
|
||||||
self.askpassword_dialog.set_icon(common.get_deluge_icon())
|
self.askpassword_dialog.set_icon(get_deluge_icon())
|
||||||
self.askpassword_dialog_entry = self.builder.get_object("askpassword_dialog_entry")
|
self.askpassword_dialog_entry = self.builder.get_object("askpassword_dialog_entry")
|
||||||
|
|
||||||
self.hostlist = self.builder.get_object("hostlist")
|
self.hostlist = self.builder.get_object("hostlist")
|
||||||
|
@ -342,7 +340,7 @@ class ConnectionManager(component.Component):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Create a new Client instance
|
# Create a new Client instance
|
||||||
c = deluge.ui.client.Client()
|
c = Client()
|
||||||
d = c.connect(host, port, skip_authentication=True)
|
d = c.connect(host, port, skip_authentication=True)
|
||||||
d.addCallback(on_connect, c, host_id)
|
d.addCallback(on_connect, c, host_id)
|
||||||
d.addErrback(on_connect_failed, host_id)
|
d.addErrback(on_connect_failed, host_id)
|
||||||
|
@ -456,7 +454,7 @@ class ConnectionManager(component.Component):
|
||||||
except OSError as ex:
|
except OSError as ex:
|
||||||
from errno import ENOENT
|
from errno import ENOENT
|
||||||
if ex.errno == ENOENT:
|
if ex.errno == ENOENT:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Unable to start daemon!"),
|
_("Unable to start daemon!"),
|
||||||
_("Deluge cannot find the 'deluged' executable, it is "
|
_("Deluge cannot find the 'deluged' executable, it is "
|
||||||
"likely that you forgot to install the deluged package "
|
"likely that you forgot to install the deluged package "
|
||||||
|
@ -468,7 +466,7 @@ class ConnectionManager(component.Component):
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
tb = sys.exc_info()
|
tb = sys.exc_info()
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Unable to start daemon!"),
|
_("Unable to start daemon!"),
|
||||||
_("Please examine the details for more information."),
|
_("Please examine the details for more information."),
|
||||||
details=traceback.format_exc(tb[2])).run()
|
details=traceback.format_exc(tb[2])).run()
|
||||||
|
@ -505,7 +503,7 @@ class ConnectionManager(component.Component):
|
||||||
|
|
||||||
if reason.check(AuthenticationRequired, BadLoginError):
|
if reason.check(AuthenticationRequired, BadLoginError):
|
||||||
log.debug("PasswordRequired exception")
|
log.debug("PasswordRequired exception")
|
||||||
dialog = dialogs.AuthenticationDialog(reason.value.message, reason.value.username)
|
dialog = AuthenticationDialog(reason.value.message, reason.value.username)
|
||||||
|
|
||||||
def dialog_finished(response_id, host, port, user):
|
def dialog_finished(response_id, host, port, user):
|
||||||
if response_id == gtk.RESPONSE_OK:
|
if response_id == gtk.RESPONSE_OK:
|
||||||
|
@ -516,7 +514,7 @@ class ConnectionManager(component.Component):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
elif reason.trap(IncompatibleClient):
|
elif reason.trap(IncompatibleClient):
|
||||||
dialog = dialogs.ErrorDialog(
|
dialog = ErrorDialog(
|
||||||
_("Incompatible Client"), reason.value.message
|
_("Incompatible Client"), reason.value.message
|
||||||
)
|
)
|
||||||
return dialog.run()
|
return dialog.run()
|
||||||
|
@ -532,7 +530,7 @@ class ConnectionManager(component.Component):
|
||||||
if not self.builder.get_object("chk_autostart").get_active():
|
if not self.builder.get_object("chk_autostart").get_active():
|
||||||
msg += '\n' + _("Auto-starting the daemon locally is not enabled. "
|
msg += '\n' + _("Auto-starting the daemon locally is not enabled. "
|
||||||
"See \"Options\" on the \"Connection Manager\".")
|
"See \"Options\" on the \"Connection Manager\".")
|
||||||
dialogs.ErrorDialog(_("Failed To Connect"), msg).run()
|
ErrorDialog(_("Failed To Connect"), msg).run()
|
||||||
|
|
||||||
def on_button_connect_clicked(self, widget=None):
|
def on_button_connect_clicked(self, widget=None):
|
||||||
model, row = self.hostlist.get_selection().get_selected()
|
model, row = self.hostlist.get_selection().get_selected()
|
||||||
|
@ -553,7 +551,7 @@ class ConnectionManager(component.Component):
|
||||||
|
|
||||||
if (status == "Offline" and self.builder.get_object("chk_autostart").get_active() and
|
if (status == "Offline" and self.builder.get_object("chk_autostart").get_active() and
|
||||||
host in ("127.0.0.1", "localhost")):
|
host in ("127.0.0.1", "localhost")):
|
||||||
if not self.start_daemon(port, deluge.configmanager.get_config_dir()):
|
if not self.start_daemon(port, get_config_dir()):
|
||||||
log.debug("Failed to auto-start daemon")
|
log.debug("Failed to auto-start daemon")
|
||||||
return
|
return
|
||||||
return self.__connect(
|
return self.__connect(
|
||||||
|
@ -591,7 +589,6 @@ class ConnectionManager(component.Component):
|
||||||
self.add_host(hostname, port_spinbutton.get_value_as_int(),
|
self.add_host(hostname, port_spinbutton.get_value_as_int(),
|
||||||
username, password)
|
username, password)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
from deluge.ui.gtkui.dialogs import ErrorDialog
|
|
||||||
ErrorDialog(_("Error Adding Host"), ex).run()
|
ErrorDialog(_("Error Adding Host"), ex).run()
|
||||||
|
|
||||||
username_entry.set_text("")
|
username_entry.set_text("")
|
||||||
|
@ -675,7 +672,7 @@ class ConnectionManager(component.Component):
|
||||||
self.add_host(DEFAULT_HOST, DEFAULT_PORT, *get_localhost_auth())
|
self.add_host(DEFAULT_HOST, DEFAULT_PORT, *get_localhost_auth())
|
||||||
# ..and start the daemon.
|
# ..and start the daemon.
|
||||||
self.start_daemon(
|
self.start_daemon(
|
||||||
DEFAULT_PORT, deluge.configmanager.get_config_dir()
|
DEFAULT_PORT, get_config_dir()
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -702,7 +699,7 @@ class ConnectionManager(component.Component):
|
||||||
client.daemon.shutdown().addCallback(on_daemon_shutdown)
|
client.daemon.shutdown().addCallback(on_daemon_shutdown)
|
||||||
elif user and password:
|
elif user and password:
|
||||||
# Create a new client instance
|
# Create a new client instance
|
||||||
c = deluge.ui.client.Client()
|
c = Client()
|
||||||
|
|
||||||
def on_connect(d, c):
|
def on_connect(d, c):
|
||||||
log.debug("on_connect")
|
log.debug("on_connect")
|
||||||
|
@ -711,7 +708,7 @@ class ConnectionManager(component.Component):
|
||||||
c.connect(host, port, user, password).addCallback(on_connect, c)
|
c.connect(host, port, user, password).addCallback(on_connect, c)
|
||||||
|
|
||||||
elif status == "Offline":
|
elif status == "Offline":
|
||||||
self.start_daemon(port, deluge.configmanager.get_config_dir())
|
self.start_daemon(port, get_config_dir())
|
||||||
reactor.callLater(0.8, self.__update_list)
|
reactor.callLater(0.8, self.__update_list)
|
||||||
|
|
||||||
def on_button_refresh_clicked(self, widget):
|
def on_button_refresh_clicked(self, widget):
|
||||||
|
|
|
@ -15,8 +15,8 @@ import gobject
|
||||||
import gtk
|
import gtk
|
||||||
from twisted.internet.threads import deferToThread
|
from twisted.internet.threads import deferToThread
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
from deluge.common import get_path_size, is_url, resource_filename
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
|
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
|
||||||
|
@ -29,19 +29,19 @@ class CreateTorrentDialog:
|
||||||
self.builder = gtk.Builder()
|
self.builder = gtk.Builder()
|
||||||
|
|
||||||
# The main dialog
|
# The main dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.ui")
|
||||||
))
|
))
|
||||||
# The remote path dialog
|
# The remote path dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.remote_path.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.remote_path.ui")
|
||||||
))
|
))
|
||||||
# The remote save dialog
|
# The remote save dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.remote_save.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.remote_save.ui")
|
||||||
))
|
))
|
||||||
# The progress dialog
|
# The progress dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.progress.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "create_torrent_dialog.progress.ui")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class CreateTorrentDialog:
|
||||||
path = result.decode('utf-8')
|
path = result.decode('utf-8')
|
||||||
|
|
||||||
self.files_treestore.clear()
|
self.files_treestore.clear()
|
||||||
self.files_treestore.append(None, [result, gtk.STOCK_FILE, deluge.common.get_path_size(path)])
|
self.files_treestore.append(None, [result, gtk.STOCK_FILE, get_path_size(path)])
|
||||||
self.adjust_piece_size()
|
self.adjust_piece_size()
|
||||||
chooser.destroy()
|
chooser.destroy()
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class CreateTorrentDialog:
|
||||||
path = result.decode('utf-8')
|
path = result.decode('utf-8')
|
||||||
|
|
||||||
self.files_treestore.clear()
|
self.files_treestore.clear()
|
||||||
self.files_treestore.append(None, [result, gtk.STOCK_OPEN, deluge.common.get_path_size(path)])
|
self.files_treestore.append(None, [result, gtk.STOCK_OPEN, get_path_size(path)])
|
||||||
self.adjust_piece_size()
|
self.adjust_piece_size()
|
||||||
chooser.destroy()
|
chooser.destroy()
|
||||||
|
|
||||||
|
@ -289,9 +289,8 @@ class CreateTorrentDialog:
|
||||||
webseeds = []
|
webseeds = []
|
||||||
b = self.builder.get_object("textview_webseeds").get_buffer()
|
b = self.builder.get_object("textview_webseeds").get_buffer()
|
||||||
lines = b.get_text(b.get_start_iter(), b.get_end_iter()).strip().split("\n")
|
lines = b.get_text(b.get_start_iter(), b.get_end_iter()).strip().split("\n")
|
||||||
import deluge.common
|
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if deluge.common.is_url(l):
|
if is_url(l):
|
||||||
webseeds.append(l)
|
webseeds.append(l)
|
||||||
# Get the piece length in bytes
|
# Get the piece length in bytes
|
||||||
combo = self.builder.get_object("combo_piece_size")
|
combo = self.builder.get_object("combo_piece_size")
|
||||||
|
@ -406,7 +405,7 @@ class CreateTorrentDialog:
|
||||||
def _on_button_add_clicked(self, widget):
|
def _on_button_add_clicked(self, widget):
|
||||||
log.debug("_on_button_add_clicked")
|
log.debug("_on_button_add_clicked")
|
||||||
builder = gtk.Builder()
|
builder = gtk.Builder()
|
||||||
builder.add_from_file(deluge.common.resource_filename(
|
builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.add.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.add.ui")
|
||||||
))
|
))
|
||||||
dialog = builder.get_object("add_tracker_dialog")
|
dialog = builder.get_object("add_tracker_dialog")
|
||||||
|
@ -427,7 +426,7 @@ class CreateTorrentDialog:
|
||||||
self.config["createtorrent.trackers"] = lines
|
self.config["createtorrent.trackers"] = lines
|
||||||
log.debug("lines: %s", lines)
|
log.debug("lines: %s", lines)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if deluge.common.is_url(l):
|
if is_url(l):
|
||||||
trackers.append(l)
|
trackers.append(l)
|
||||||
|
|
||||||
# We are going to add these trackers to the highest tier + 1
|
# We are going to add these trackers to the highest tier + 1
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
import gtk
|
import gtk
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.ui.gtkui import common
|
from deluge.common import get_pixmap, osx_check, windows_check
|
||||||
|
from deluge.ui.gtkui.common import get_deluge_icon
|
||||||
|
|
||||||
|
|
||||||
class BaseDialog(gtk.Dialog):
|
class BaseDialog(gtk.Dialog):
|
||||||
|
@ -34,7 +34,7 @@ class BaseDialog(gtk.Dialog):
|
||||||
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
|
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
|
||||||
buttons=buttons)
|
buttons=buttons)
|
||||||
|
|
||||||
self.set_icon(common.get_deluge_icon())
|
self.set_icon(get_deluge_icon())
|
||||||
|
|
||||||
self.connect("delete-event", self._on_delete_event)
|
self.connect("delete-event", self._on_delete_event)
|
||||||
self.connect("response", self._on_response)
|
self.connect("response", self._on_response)
|
||||||
|
@ -46,9 +46,9 @@ class BaseDialog(gtk.Dialog):
|
||||||
image = gtk.Image()
|
image = gtk.Image()
|
||||||
if not gtk.stock_lookup(icon) and (icon.endswith(".svg") or icon.endswith(".png")):
|
if not gtk.stock_lookup(icon) and (icon.endswith(".svg") or icon.endswith(".png")):
|
||||||
# Hack for Windows since it doesn't support svg
|
# Hack for Windows since it doesn't support svg
|
||||||
if icon.endswith(".svg") and (deluge.common.windows_check() or deluge.common.osx_check()):
|
if icon.endswith(".svg") and (windows_check() or osx_check()):
|
||||||
icon = icon.rpartition(".svg")[0] + "16.png"
|
icon = icon.rpartition(".svg")[0] + "16.png"
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(deluge.common.get_pixmap(icon), 32, 32)
|
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap(icon), 32, 32)
|
||||||
image.set_from_pixbuf(pixbuf)
|
image.set_from_pixbuf(pixbuf)
|
||||||
else:
|
else:
|
||||||
image.set_from_stock(icon, gtk.ICON_SIZE_DIALOG)
|
image.set_from_stock(icon, gtk.ICON_SIZE_DIALOG)
|
||||||
|
|
|
@ -13,10 +13,10 @@ import os.path
|
||||||
import gtk
|
import gtk
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
from deluge.common import is_url, resource_filename
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.gtkui.common import get_deluge_icon
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -26,15 +26,15 @@ class EditTrackersDialog:
|
||||||
self.torrent_id = torrent_id
|
self.torrent_id = torrent_id
|
||||||
self.builder = gtk.Builder()
|
self.builder = gtk.Builder()
|
||||||
# Main dialog
|
# Main dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.ui")
|
||||||
))
|
))
|
||||||
# add tracker dialog
|
# add tracker dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.add.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.add.ui")
|
||||||
))
|
))
|
||||||
# edit tracker dialog
|
# edit tracker dialog
|
||||||
self.builder.add_from_file(deluge.common.resource_filename(
|
self.builder.add_from_file(resource_filename(
|
||||||
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.edit.ui")
|
"deluge.ui.gtkui", os.path.join("glade", "edit_trackers.edit.ui")
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class EditTrackersDialog:
|
||||||
self.add_tracker_dialog.set_transient_for(self.dialog)
|
self.add_tracker_dialog.set_transient_for(self.dialog)
|
||||||
self.edit_tracker_entry = self.builder.get_object("edit_tracker_entry")
|
self.edit_tracker_entry = self.builder.get_object("edit_tracker_entry")
|
||||||
self.edit_tracker_entry.set_transient_for(self.dialog)
|
self.edit_tracker_entry.set_transient_for(self.dialog)
|
||||||
self.dialog.set_icon(common.get_deluge_icon())
|
self.dialog.set_icon(get_deluge_icon())
|
||||||
|
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
self.dialog.set_transient_for(parent)
|
self.dialog.set_transient_for(parent)
|
||||||
|
@ -195,7 +195,7 @@ class EditTrackersDialog:
|
||||||
b = textview.get_buffer()
|
b = textview.get_buffer()
|
||||||
lines = b.get_text(b.get_start_iter(), b.get_end_iter()).strip().split("\n")
|
lines = b.get_text(b.get_start_iter(), b.get_end_iter()).strip().split("\n")
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if deluge.common.is_url(l):
|
if is_url(l):
|
||||||
trackers.append(l)
|
trackers.append(l)
|
||||||
|
|
||||||
for tracker in trackers:
|
for tracker in trackers:
|
||||||
|
|
|
@ -15,11 +15,12 @@ import gobject
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.gdk
|
import gtk.gdk
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
|
from deluge.common import FILE_PRIORITY, open_file, show_file
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.ui.gtkui.common import load_pickled_state_file, reparent_iter, save_pickled_state_file
|
from deluge.ui.gtkui.common import load_pickled_state_file, reparent_iter, save_pickled_state_file
|
||||||
from deluge.ui.gtkui.torrentdetails import Tab
|
from deluge.ui.gtkui.torrentdetails import Tab
|
||||||
|
from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ def cell_priority(column, cell, model, row, data):
|
||||||
cell.set_property("text", "")
|
cell.set_property("text", "")
|
||||||
return
|
return
|
||||||
priority = model.get_value(row, data)
|
priority = model.get_value(row, data)
|
||||||
cell.set_property("text", _t(deluge.common.FILE_PRIORITY[priority]))
|
cell.set_property("text", _t(FILE_PRIORITY[priority]))
|
||||||
|
|
||||||
|
|
||||||
def cell_priority_icon(column, cell, model, row, data):
|
def cell_priority_icon(column, cell, model, row, data):
|
||||||
|
@ -58,13 +59,13 @@ def cell_priority_icon(column, cell, model, row, data):
|
||||||
cell.set_property("stock-id", None)
|
cell.set_property("stock-id", None)
|
||||||
return
|
return
|
||||||
priority = model.get_value(row, data)
|
priority = model.get_value(row, data)
|
||||||
if deluge.common.FILE_PRIORITY[priority] == "Do Not Download":
|
if FILE_PRIORITY[priority] == "Do Not Download":
|
||||||
cell.set_property("stock-id", gtk.STOCK_NO)
|
cell.set_property("stock-id", gtk.STOCK_NO)
|
||||||
elif deluge.common.FILE_PRIORITY[priority] == "Normal Priority":
|
elif FILE_PRIORITY[priority] == "Normal Priority":
|
||||||
cell.set_property("stock-id", gtk.STOCK_YES)
|
cell.set_property("stock-id", gtk.STOCK_YES)
|
||||||
elif deluge.common.FILE_PRIORITY[priority] == "High Priority":
|
elif FILE_PRIORITY[priority] == "High Priority":
|
||||||
cell.set_property("stock-id", gtk.STOCK_GO_UP)
|
cell.set_property("stock-id", gtk.STOCK_GO_UP)
|
||||||
elif deluge.common.FILE_PRIORITY[priority] == "Highest Priority":
|
elif FILE_PRIORITY[priority] == "Highest Priority":
|
||||||
cell.set_property("stock-id", gtk.STOCK_GOTO_TOP)
|
cell.set_property("stock-id", gtk.STOCK_GOTO_TOP)
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ class FilesTab(Tab):
|
||||||
column = gtk.TreeViewColumn(_("Size"))
|
column = gtk.TreeViewColumn(_("Size"))
|
||||||
render = gtk.CellRendererText()
|
render = gtk.CellRendererText()
|
||||||
column.pack_start(render, False)
|
column.pack_start(render, False)
|
||||||
column.set_cell_data_func(render, deluge.ui.gtkui.torrentview_data_funcs.cell_data_size, 1)
|
column.set_cell_data_func(render, cell_data_size, 1)
|
||||||
column.set_sort_column_id(1)
|
column.set_sort_column_id(1)
|
||||||
column.set_clickable(True)
|
column.set_clickable(True)
|
||||||
column.set_resizable(True)
|
column.set_resizable(True)
|
||||||
|
@ -324,7 +325,7 @@ class FilesTab(Tab):
|
||||||
filepath = os.path.join(status["download_location"], *path)
|
filepath = os.path.join(status["download_location"], *path)
|
||||||
log.debug("Open file '%s'", filepath)
|
log.debug("Open file '%s'", filepath)
|
||||||
timestamp = gtk.get_current_event_time()
|
timestamp = gtk.get_current_event_time()
|
||||||
deluge.common.open_file(filepath, timestamp=timestamp)
|
open_file(filepath, timestamp=timestamp)
|
||||||
|
|
||||||
def _on_show_file(self, status):
|
def _on_show_file(self, status):
|
||||||
paths = self.listview.get_selection().get_selected_rows()[1]
|
paths = self.listview.get_selection().get_selected_rows()[1]
|
||||||
|
@ -337,7 +338,7 @@ class FilesTab(Tab):
|
||||||
filepath = os.path.join(status["download_location"], *path)
|
filepath = os.path.join(status["download_location"], *path)
|
||||||
log.debug("Show file '%s'", filepath)
|
log.debug("Show file '%s'", filepath)
|
||||||
timestamp = gtk.get_current_event_time()
|
timestamp = gtk.get_current_event_time()
|
||||||
deluge.common.show_file(filepath, timestamp=timestamp)
|
show_file(filepath, timestamp=timestamp)
|
||||||
|
|
||||||
## The following 3 methods create the folder/file view in the treeview
|
## The following 3 methods create the folder/file view in the treeview
|
||||||
def prepare_file_store(self, files):
|
def prepare_file_store(self, files):
|
||||||
|
@ -551,22 +552,22 @@ class FilesTab(Tab):
|
||||||
def _on_menuitem_donotdownload_activate(self, menuitem):
|
def _on_menuitem_donotdownload_activate(self, menuitem):
|
||||||
self._set_file_priorities_on_user_change(
|
self._set_file_priorities_on_user_change(
|
||||||
self.get_selected_files(),
|
self.get_selected_files(),
|
||||||
deluge.common.FILE_PRIORITY["Do Not Download"])
|
FILE_PRIORITY["Do Not Download"])
|
||||||
|
|
||||||
def _on_menuitem_normal_activate(self, menuitem):
|
def _on_menuitem_normal_activate(self, menuitem):
|
||||||
self._set_file_priorities_on_user_change(
|
self._set_file_priorities_on_user_change(
|
||||||
self.get_selected_files(),
|
self.get_selected_files(),
|
||||||
deluge.common.FILE_PRIORITY["Normal Priority"])
|
FILE_PRIORITY["Normal Priority"])
|
||||||
|
|
||||||
def _on_menuitem_high_activate(self, menuitem):
|
def _on_menuitem_high_activate(self, menuitem):
|
||||||
self._set_file_priorities_on_user_change(
|
self._set_file_priorities_on_user_change(
|
||||||
self.get_selected_files(),
|
self.get_selected_files(),
|
||||||
deluge.common.FILE_PRIORITY["High Priority"])
|
FILE_PRIORITY["High Priority"])
|
||||||
|
|
||||||
def _on_menuitem_highest_activate(self, menuitem):
|
def _on_menuitem_highest_activate(self, menuitem):
|
||||||
self._set_file_priorities_on_user_change(
|
self._set_file_priorities_on_user_change(
|
||||||
self.get_selected_files(),
|
self.get_selected_files(),
|
||||||
deluge.common.FILE_PRIORITY["Highest Priority"])
|
FILE_PRIORITY["Highest Priority"])
|
||||||
|
|
||||||
def _on_menuitem_expand_all_activate(self, menuitem):
|
def _on_menuitem_expand_all_activate(self, menuitem):
|
||||||
self.listview.expand_all()
|
self.listview.expand_all()
|
||||||
|
|
|
@ -21,28 +21,29 @@ reactor = gtk2reactor.install()
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.error
|
|
||||||
import dialogs
|
|
||||||
from addtorrentdialog import AddTorrentDialog
|
|
||||||
from deluge.configmanager import ConfigManager, get_config_dir
|
from deluge.configmanager import ConfigManager, get_config_dir
|
||||||
|
from deluge.error import AuthenticationRequired, BadLoginError, DaemonRunningError
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.gtkui.addtorrentdialog import AddTorrentDialog
|
||||||
from deluge.ui.gtkui.common import associate_magnet_links
|
from deluge.ui.gtkui.common import associate_magnet_links
|
||||||
|
from deluge.ui.gtkui.dialogs import AuthenticationDialog, ErrorDialog, YesNoDialog
|
||||||
|
from deluge.ui.gtkui.filtertreeview import FilterTreeView
|
||||||
|
from deluge.ui.gtkui.ipcinterface import IPCInterface
|
||||||
|
from deluge.ui.gtkui.mainwindow import MainWindow
|
||||||
|
from deluge.ui.gtkui.menubar import MenuBar
|
||||||
|
from deluge.ui.gtkui.pluginmanager import PluginManager
|
||||||
|
from deluge.ui.gtkui.preferences import Preferences
|
||||||
|
from deluge.ui.gtkui.queuedtorrents import QueuedTorrents
|
||||||
|
from deluge.ui.gtkui.sidebar import SideBar
|
||||||
|
from deluge.ui.gtkui.statusbar import StatusBar
|
||||||
|
from deluge.ui.gtkui.systemtray import SystemTray
|
||||||
|
from deluge.ui.gtkui.toolbar import ToolBar
|
||||||
|
from deluge.ui.gtkui.torrentdetails import TorrentDetails
|
||||||
|
from deluge.ui.gtkui.torrentview import TorrentView
|
||||||
from deluge.ui.sessionproxy import SessionProxy
|
from deluge.ui.sessionproxy import SessionProxy
|
||||||
from deluge.ui.tracker_icons import TrackerIcons
|
from deluge.ui.tracker_icons import TrackerIcons
|
||||||
from deluge.ui.ui import _UI
|
from deluge.ui.ui import _UI
|
||||||
from filtertreeview import FilterTreeView
|
|
||||||
from ipcinterface import IPCInterface
|
|
||||||
from mainwindow import MainWindow
|
|
||||||
from menubar import MenuBar
|
|
||||||
from pluginmanager import PluginManager
|
|
||||||
from preferences import Preferences
|
|
||||||
from queuedtorrents import QueuedTorrents
|
|
||||||
from sidebar import SideBar
|
|
||||||
from statusbar import StatusBar
|
|
||||||
from systemtray import SystemTray
|
|
||||||
from toolbar import ToolBar
|
|
||||||
from torrentdetails import TorrentDetails
|
|
||||||
from torrentview import TorrentView
|
|
||||||
|
|
||||||
gobject.set_prgname("deluge")
|
gobject.set_prgname("deluge")
|
||||||
|
|
||||||
|
@ -235,7 +236,7 @@ class GtkUI(object):
|
||||||
from deluge.ui.gtkui.ipcinterface import process_args
|
from deluge.ui.gtkui.ipcinterface import process_args
|
||||||
process_args([filename])
|
process_args([filename])
|
||||||
self.osxapp.connect("NSApplicationOpenFile", nsapp_open_file)
|
self.osxapp.connect("NSApplicationOpenFile", nsapp_open_file)
|
||||||
from menubar_osx import menubar_osx
|
from deluge.ui.gtkui.menubar_osx import menubar_osx
|
||||||
menubar_osx(self, self.osxapp)
|
menubar_osx(self, self.osxapp)
|
||||||
self.osxapp.ready()
|
self.osxapp.ready()
|
||||||
|
|
||||||
|
@ -243,7 +244,7 @@ class GtkUI(object):
|
||||||
self.plugins = PluginManager()
|
self.plugins = PluginManager()
|
||||||
|
|
||||||
# Late import because of setting up translations
|
# Late import because of setting up translations
|
||||||
from connectionmanager import ConnectionManager
|
from deluge.ui.gtkui.connectionmanager import ConnectionManager
|
||||||
# Show the connection manager
|
# Show the connection manager
|
||||||
self.connectionmanager = ConnectionManager()
|
self.connectionmanager = ConnectionManager()
|
||||||
|
|
||||||
|
@ -310,8 +311,8 @@ class GtkUI(object):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
client.start_classic_mode()
|
client.start_classic_mode()
|
||||||
except deluge.error.DaemonRunningError:
|
except DaemonRunningError:
|
||||||
d = dialogs.YesNoDialog(
|
d = YesNoDialog(
|
||||||
_("Switch to Thin Client Mode?"),
|
_("Switch to Thin Client Mode?"),
|
||||||
_("A Deluge daemon process (deluged) is already running. "
|
_("A Deluge daemon process (deluged) is already running. "
|
||||||
"To use Standalone mode, stop this daemon and restart Deluge."
|
"To use Standalone mode, stop this daemon and restart Deluge."
|
||||||
|
@ -321,7 +322,7 @@ class GtkUI(object):
|
||||||
d.addCallback(on_dialog_response)
|
d.addCallback(on_dialog_response)
|
||||||
except ImportError as ex:
|
except ImportError as ex:
|
||||||
if "No module named libtorrent" in ex.message:
|
if "No module named libtorrent" in ex.message:
|
||||||
d = dialogs.YesNoDialog(
|
d = YesNoDialog(
|
||||||
_("Switch to Thin Client Mode?"),
|
_("Switch to Thin Client Mode?"),
|
||||||
_("Only Thin Client mode is available because libtorrent is not installed."
|
_("Only Thin Client mode is available because libtorrent is not installed."
|
||||||
"\n\n"
|
"\n\n"
|
||||||
|
@ -336,14 +337,14 @@ class GtkUI(object):
|
||||||
except Exception:
|
except Exception:
|
||||||
import traceback
|
import traceback
|
||||||
tb = sys.exc_info()
|
tb = sys.exc_info()
|
||||||
ed = dialogs.ErrorDialog(
|
ed = ErrorDialog(
|
||||||
_("Error Starting Core"),
|
_("Error Starting Core"),
|
||||||
_("An error occurred starting the core component required to run Deluge in Standalone mode."
|
_("An error occurred starting the core component required to run Deluge in Standalone mode."
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Please see the details below for more information."), details=traceback.format_exc(tb[2])).run()
|
"Please see the details below for more information."), details=traceback.format_exc(tb[2])).run()
|
||||||
|
|
||||||
def on_ed_response(response):
|
def on_ed_response(response):
|
||||||
d = dialogs.YesNoDialog(
|
d = YesNoDialog(
|
||||||
_("Switch to Thin Client Mode?"),
|
_("Switch to Thin Client Mode?"),
|
||||||
_("Unable to start Standalone mode would you like to continue in Thin Client mode?")
|
_("Unable to start Standalone mode would you like to continue in Thin Client mode?")
|
||||||
).run()
|
).run()
|
||||||
|
@ -379,7 +380,7 @@ class GtkUI(object):
|
||||||
)
|
)
|
||||||
log.debug("Localhost started: %s", try_connect)
|
log.debug("Localhost started: %s", try_connect)
|
||||||
if not try_connect:
|
if not try_connect:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Starting Daemon"),
|
_("Error Starting Daemon"),
|
||||||
_("There was an error starting the daemon "
|
_("There was an error starting the daemon "
|
||||||
"process. Try running it from a console "
|
"process. Try running it from a console "
|
||||||
|
@ -399,12 +400,9 @@ class GtkUI(object):
|
||||||
if not try_counter:
|
if not try_counter:
|
||||||
return
|
return
|
||||||
|
|
||||||
if reason.check(deluge.error.AuthenticationRequired,
|
if reason.check(AuthenticationRequired, BadLoginError):
|
||||||
deluge.error.BadLoginError):
|
|
||||||
log.debug("PasswordRequired exception")
|
log.debug("PasswordRequired exception")
|
||||||
dialog = dialogs.AuthenticationDialog(
|
dialog = AuthenticationDialog(reason.value.message, reason.value.username)
|
||||||
reason.value.message, reason.value.username
|
|
||||||
)
|
|
||||||
|
|
||||||
def dialog_finished(response_id, host, port):
|
def dialog_finished(response_id, host, port):
|
||||||
if response_id == gtk.RESPONSE_OK:
|
if response_id == gtk.RESPONSE_OK:
|
||||||
|
@ -412,8 +410,7 @@ class GtkUI(object):
|
||||||
0.5, do_connect, try_counter - 1,
|
0.5, do_connect, try_counter - 1,
|
||||||
host, port, dialog.get_username(),
|
host, port, dialog.get_username(),
|
||||||
dialog.get_password())
|
dialog.get_password())
|
||||||
dialog.run().addCallback(dialog_finished,
|
dialog.run().addCallback(dialog_finished, host, port)
|
||||||
host, port)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
log.info("Connection to host failed..")
|
log.info("Connection to host failed..")
|
||||||
|
|
|
@ -20,9 +20,9 @@ import twisted.internet.error
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.protocol import ClientFactory, Factory, Protocol
|
from twisted.internet.protocol import ClientFactory, Factory, Protocol
|
||||||
|
|
||||||
import deluge.common
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.common import is_magnet, is_url, windows_check
|
||||||
|
from deluge.configmanager import ConfigManager, get_config_dir
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -66,11 +66,11 @@ class IPCClientFactory(ClientFactory):
|
||||||
class IPCInterface(component.Component):
|
class IPCInterface(component.Component):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
component.Component.__init__(self, "IPCInterface")
|
component.Component.__init__(self, "IPCInterface")
|
||||||
ipc_dir = deluge.configmanager.get_config_dir("ipc")
|
ipc_dir = get_config_dir("ipc")
|
||||||
if not os.path.exists(ipc_dir):
|
if not os.path.exists(ipc_dir):
|
||||||
os.makedirs(ipc_dir)
|
os.makedirs(ipc_dir)
|
||||||
socket = os.path.join(ipc_dir, "deluge-gtk")
|
socket = os.path.join(ipc_dir, "deluge-gtk")
|
||||||
if deluge.common.windows_check():
|
if windows_check():
|
||||||
# If we're on windows we need to check the global mutex to see if deluge is
|
# If we're on windows we need to check the global mutex to see if deluge is
|
||||||
# already running.
|
# already running.
|
||||||
import win32event
|
import win32event
|
||||||
|
@ -145,7 +145,7 @@ class IPCInterface(component.Component):
|
||||||
process_args(args)
|
process_args(args)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if deluge.common.windows_check():
|
if windows_check():
|
||||||
import win32api
|
import win32api
|
||||||
win32api.CloseHandle(self.mutex)
|
win32api.CloseHandle(self.mutex)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ def process_args(args):
|
||||||
continue
|
continue
|
||||||
log.debug("arg: %s", arg)
|
log.debug("arg: %s", arg)
|
||||||
|
|
||||||
if deluge.common.is_url(arg):
|
if is_url(arg):
|
||||||
log.debug("Attempting to add url (%s) from external source...", arg)
|
log.debug("Attempting to add url (%s) from external source...", arg)
|
||||||
if config["interactive_add"]:
|
if config["interactive_add"]:
|
||||||
component.get("AddTorrentDialog").add_from_url(arg)
|
component.get("AddTorrentDialog").add_from_url(arg)
|
||||||
|
@ -175,7 +175,7 @@ def process_args(args):
|
||||||
else:
|
else:
|
||||||
client.core.add_torrent_url(arg, None)
|
client.core.add_torrent_url(arg, None)
|
||||||
|
|
||||||
elif deluge.common.is_magnet(arg):
|
elif is_magnet(arg):
|
||||||
log.debug("Attempting to add magnet (%s) from external source...", arg)
|
log.debug("Attempting to add magnet (%s) from external source...", arg)
|
||||||
if config["interactive_add"]:
|
if config["interactive_add"]:
|
||||||
component.get("AddTorrentDialog").add_from_magnets([arg])
|
component.get("AddTorrentDialog").add_from_magnets([arg])
|
||||||
|
|
|
@ -17,10 +17,9 @@ import pygtk
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.error
|
|
||||||
import dialogs
|
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.gtkui.dialogs import ErrorDialog, OtherDialog
|
||||||
from deluge.ui.gtkui.path_chooser import PathChooser
|
from deluge.ui.gtkui.path_chooser import PathChooser
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
@ -242,7 +241,7 @@ class MenuBar(component.Component):
|
||||||
|
|
||||||
def on_menuitem_createtorrent_activate(self, data=None):
|
def on_menuitem_createtorrent_activate(self, data=None):
|
||||||
log.debug("on_menuitem_createtorrent_activate")
|
log.debug("on_menuitem_createtorrent_activate")
|
||||||
from createtorrentdialog import CreateTorrentDialog
|
from deluge.ui.gtkui.createtorrentdialog import CreateTorrentDialog
|
||||||
CreateTorrentDialog().show()
|
CreateTorrentDialog().show()
|
||||||
|
|
||||||
def on_menuitem_quitdaemon_activate(self, data=None):
|
def on_menuitem_quitdaemon_activate(self, data=None):
|
||||||
|
@ -280,7 +279,7 @@ class MenuBar(component.Component):
|
||||||
|
|
||||||
def on_menuitem_edittrackers_activate(self, data=None):
|
def on_menuitem_edittrackers_activate(self, data=None):
|
||||||
log.debug("on_menuitem_edittrackers_activate")
|
log.debug("on_menuitem_edittrackers_activate")
|
||||||
from edittrackersdialog import EditTrackersDialog
|
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog
|
||||||
dialog = EditTrackersDialog(
|
dialog = EditTrackersDialog(
|
||||||
component.get("TorrentView").get_selected_torrent(),
|
component.get("TorrentView").get_selected_torrent(),
|
||||||
component.get("MainWindow").window)
|
component.get("MainWindow").window)
|
||||||
|
@ -290,7 +289,7 @@ class MenuBar(component.Component):
|
||||||
log.debug("on_menuitem_remove_activate")
|
log.debug("on_menuitem_remove_activate")
|
||||||
torrent_ids = component.get("TorrentView").get_selected_torrents()
|
torrent_ids = component.get("TorrentView").get_selected_torrents()
|
||||||
if torrent_ids:
|
if torrent_ids:
|
||||||
from removetorrentdialog import RemoveTorrentDialog
|
from deluge.ui.gtkui.removetorrentdialog import RemoveTorrentDialog
|
||||||
RemoveTorrentDialog(torrent_ids).run()
|
RemoveTorrentDialog(torrent_ids).run()
|
||||||
|
|
||||||
def on_menuitem_recheck_activate(self, data=None):
|
def on_menuitem_recheck_activate(self, data=None):
|
||||||
|
@ -393,7 +392,7 @@ class MenuBar(component.Component):
|
||||||
|
|
||||||
def on_menuitem_about_activate(self, data=None):
|
def on_menuitem_about_activate(self, data=None):
|
||||||
log.debug("on_menuitem_about_activate")
|
log.debug("on_menuitem_about_activate")
|
||||||
from aboutdialog import AboutDialog
|
from deluge.ui.gtkui.aboutdialog import AboutDialog
|
||||||
AboutDialog().run()
|
AboutDialog().run()
|
||||||
|
|
||||||
def on_menuitem_set_unlimited(self, widget):
|
def on_menuitem_set_unlimited(self, widget):
|
||||||
|
@ -448,7 +447,7 @@ class MenuBar(component.Component):
|
||||||
options["stop_at_ratio"] = True
|
options["stop_at_ratio"] = True
|
||||||
client.core.set_torrent_options(torrent_ids, options)
|
client.core.set_torrent_options(torrent_ids, options)
|
||||||
|
|
||||||
dialog = dialogs.OtherDialog(*other_dialog)
|
dialog = OtherDialog(*other_dialog)
|
||||||
dialog.run().addCallback(set_value)
|
dialog.run().addCallback(set_value)
|
||||||
|
|
||||||
torrent_ids = component.get("TorrentView").get_selected_torrents()
|
torrent_ids = component.get("TorrentView").get_selected_torrents()
|
||||||
|
@ -542,7 +541,7 @@ class MenuBar(component.Component):
|
||||||
log.debug("Setting torrent owner \"%s\" on %s", username, update_torrents)
|
log.debug("Setting torrent owner \"%s\" on %s", username, update_torrents)
|
||||||
|
|
||||||
def failed_change_owner(failure):
|
def failed_change_owner(failure):
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Ownership Change Error"),
|
_("Ownership Change Error"),
|
||||||
_("There was an error while trying changing ownership."),
|
_("There was an error while trying changing ownership."),
|
||||||
self.window.window, details=failure.value.logable()
|
self.window.window, details=failure.value.logable()
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
|
from deluge.ui.gtkui.common import get_logo
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class Notification:
|
||||||
message = deluge.common.xml_encode("%s\n%s %i %s" % (status["name"],
|
message = deluge.common.xml_encode("%s\n%s %i %s" % (status["name"],
|
||||||
_("Including"), status["num_files"], _("files")))
|
_("Including"), status["num_files"], _("files")))
|
||||||
self.note = pynotify.Notification(title, message)
|
self.note = pynotify.Notification(title, message)
|
||||||
self.note.set_icon_from_pixbuf(common.get_logo(48))
|
self.note.set_icon_from_pixbuf(get_logo(48))
|
||||||
if not self.note.show():
|
if not self.note.show():
|
||||||
log.warning("pynotify failed to show notification")
|
log.warning("pynotify failed to show notification")
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,13 @@ from hashlib import sha1 as sha
|
||||||
import gtk
|
import gtk
|
||||||
import pygtk
|
import pygtk
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.configmanager
|
from deluge.configmanager import ConfigManager, get_config_dir
|
||||||
import dialogs
|
|
||||||
from deluge.configmanager import ConfigManager
|
|
||||||
from deluge.error import AuthManagerError, NotAuthorizedError
|
from deluge.error import AuthManagerError, NotAuthorizedError
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
from deluge.ui.gtkui.common import associate_magnet_links, get_deluge_icon
|
||||||
|
from deluge.ui.gtkui.dialogs import AccountDialog, ErrorDialog, InformationDialog, YesNoDialog
|
||||||
from deluge.ui.gtkui.path_chooser import PathChooser
|
from deluge.ui.gtkui.path_chooser import PathChooser
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
@ -50,7 +49,7 @@ class Preferences(component.Component):
|
||||||
))
|
))
|
||||||
self.pref_dialog = self.builder.get_object("pref_dialog")
|
self.pref_dialog = self.builder.get_object("pref_dialog")
|
||||||
self.pref_dialog.set_transient_for(component.get("MainWindow").window)
|
self.pref_dialog.set_transient_for(component.get("MainWindow").window)
|
||||||
self.pref_dialog.set_icon(common.get_deluge_icon())
|
self.pref_dialog.set_icon(get_deluge_icon())
|
||||||
self.treeview = self.builder.get_object("treeview")
|
self.treeview = self.builder.get_object("treeview")
|
||||||
self.notebook = self.builder.get_object("notebook")
|
self.notebook = self.builder.get_object("notebook")
|
||||||
self.gtkui_config = ConfigManager("gtkui.conf")
|
self.gtkui_config = ConfigManager("gtkui.conf")
|
||||||
|
@ -728,7 +727,7 @@ class Preferences(component.Component):
|
||||||
else:
|
else:
|
||||||
active = self.language_combo.get_active()
|
active = self.language_combo.get_active()
|
||||||
if active == -1:
|
if active == -1:
|
||||||
dialog = dialogs.InformationDialog(
|
dialog = InformationDialog(
|
||||||
_("Attention"),
|
_("Attention"),
|
||||||
_("You must choose a language")
|
_("You must choose a language")
|
||||||
)
|
)
|
||||||
|
@ -739,7 +738,7 @@ class Preferences(component.Component):
|
||||||
new_gtkui_config["language"] = model.get(model.get_iter(active), 0)[0]
|
new_gtkui_config["language"] = model.get(model.get_iter(active), 0)[0]
|
||||||
|
|
||||||
if new_gtkui_config["language"] != self.gtkui_config["language"]:
|
if new_gtkui_config["language"] != self.gtkui_config["language"]:
|
||||||
dialog = dialogs.InformationDialog(
|
dialog = InformationDialog(
|
||||||
_("Attention"),
|
_("Attention"),
|
||||||
_("You must now restart the deluge UI for the changes to take effect.")
|
_("You must now restart the deluge UI for the changes to take effect.")
|
||||||
)
|
)
|
||||||
|
@ -784,7 +783,7 @@ class Preferences(component.Component):
|
||||||
self.gtkui_config["classic_mode"] = not new_gtkui_in_classic_mode
|
self.gtkui_config["classic_mode"] = not new_gtkui_in_classic_mode
|
||||||
self.builder.get_object("radio_classic").set_active(self.gtkui_config["classic_mode"])
|
self.builder.get_object("radio_classic").set_active(self.gtkui_config["classic_mode"])
|
||||||
self.builder.get_object("radio_thinclient").set_active(not self.gtkui_config["classic_mode"])
|
self.builder.get_object("radio_thinclient").set_active(not self.gtkui_config["classic_mode"])
|
||||||
dialog = dialogs.YesNoDialog(
|
dialog = YesNoDialog(
|
||||||
_("Switching client mode..."),
|
_("Switching client mode..."),
|
||||||
_("Your current session will be stopped. Do you wish to continue?")
|
_("Your current session will be stopped. Do you wish to continue?")
|
||||||
)
|
)
|
||||||
|
@ -984,7 +983,7 @@ class Preferences(component.Component):
|
||||||
filename = os.path.split(filepath)[1]
|
filename = os.path.split(filepath)[1]
|
||||||
shutil.copyfile(
|
shutil.copyfile(
|
||||||
filepath,
|
filepath,
|
||||||
os.path.join(deluge.configmanager.get_config_dir(), "plugins", filename))
|
os.path.join(get_config_dir(), "plugins", filename))
|
||||||
|
|
||||||
component.get("PluginManager").scan_for_plugins()
|
component.get("PluginManager").scan_for_plugins()
|
||||||
|
|
||||||
|
@ -1047,7 +1046,7 @@ class Preferences(component.Component):
|
||||||
self.builder.get_object(show_entry).show()
|
self.builder.get_object(show_entry).show()
|
||||||
|
|
||||||
def _on_button_associate_magnet_clicked(self, widget):
|
def _on_button_associate_magnet_clicked(self, widget):
|
||||||
common.associate_magnet_links(True)
|
associate_magnet_links(True)
|
||||||
|
|
||||||
def _get_accounts_tab_data(self):
|
def _get_accounts_tab_data(self):
|
||||||
def on_ok(accounts):
|
def on_ok(accounts):
|
||||||
|
@ -1058,7 +1057,7 @@ class Preferences(component.Component):
|
||||||
if failure.type == NotAuthorizedError:
|
if failure.type == NotAuthorizedError:
|
||||||
self.accounts_frame.hide()
|
self.accounts_frame.hide()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Server Side Error"),
|
_("Server Side Error"),
|
||||||
_("An error ocurred on the server"),
|
_("An error ocurred on the server"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
|
@ -1104,7 +1103,7 @@ class Preferences(component.Component):
|
||||||
self.builder.get_object("accounts_delete").set_sensitive(False)
|
self.builder.get_object("accounts_delete").set_sensitive(False)
|
||||||
|
|
||||||
def _on_accounts_add_clicked(self, widget):
|
def _on_accounts_add_clicked(self, widget):
|
||||||
dialog = dialogs.AccountDialog(
|
dialog = AccountDialog(
|
||||||
levels_mapping=client.auth_levels_mapping,
|
levels_mapping=client.auth_levels_mapping,
|
||||||
parent=self.pref_dialog
|
parent=self.pref_dialog
|
||||||
)
|
)
|
||||||
|
@ -1128,13 +1127,13 @@ class Preferences(component.Component):
|
||||||
|
|
||||||
def add_fail(failure):
|
def add_fail(failure):
|
||||||
if failure.type == AuthManagerError:
|
if failure.type == AuthManagerError:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Adding Account"),
|
_("Error Adding Account"),
|
||||||
_("Authentication failed"),
|
_("Authentication failed"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Adding Account"),
|
_("Error Adding Account"),
|
||||||
_("An error ocurred while adding account"),
|
_("An error ocurred while adding account"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
|
@ -1152,7 +1151,7 @@ class Preferences(component.Component):
|
||||||
if not itr:
|
if not itr:
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog = dialogs.AccountDialog(
|
dialog = AccountDialog(
|
||||||
model[itr][ACCOUNTS_USERNAME],
|
model[itr][ACCOUNTS_USERNAME],
|
||||||
model[itr][ACCOUNTS_PASSWORD],
|
model[itr][ACCOUNTS_PASSWORD],
|
||||||
model[itr][ACCOUNTS_LEVEL],
|
model[itr][ACCOUNTS_LEVEL],
|
||||||
|
@ -1167,7 +1166,7 @@ class Preferences(component.Component):
|
||||||
model.set_value(itr, ACCOUNTS_LEVEL, dialog.get_authlevel())
|
model.set_value(itr, ACCOUNTS_LEVEL, dialog.get_authlevel())
|
||||||
|
|
||||||
def update_fail(failure):
|
def update_fail(failure):
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Updating Account"),
|
_("Error Updating Account"),
|
||||||
_("An error ocurred while updating account"),
|
_("An error ocurred while updating account"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
|
@ -1191,7 +1190,7 @@ class Preferences(component.Component):
|
||||||
header = _("Remove Account")
|
header = _("Remove Account")
|
||||||
text = _("Are you sure you wan't do remove the account with the "
|
text = _("Are you sure you wan't do remove the account with the "
|
||||||
"username \"%(username)s\"?" % dict(username=username))
|
"username \"%(username)s\"?" % dict(username=username))
|
||||||
dialog = dialogs.YesNoDialog(header, text, parent=self.pref_dialog)
|
dialog = YesNoDialog(header, text, parent=self.pref_dialog)
|
||||||
|
|
||||||
def dialog_finished(response_id):
|
def dialog_finished(response_id):
|
||||||
def remove_ok(rc):
|
def remove_ok(rc):
|
||||||
|
@ -1199,13 +1198,13 @@ class Preferences(component.Component):
|
||||||
|
|
||||||
def remove_fail(failure):
|
def remove_fail(failure):
|
||||||
if failure.type == AuthManagerError:
|
if failure.type == AuthManagerError:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Removing Account"),
|
_("Error Removing Account"),
|
||||||
_("Auhentication failed"),
|
_("Auhentication failed"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
).run()
|
).run()
|
||||||
else:
|
else:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_("Error Removing Account"),
|
_("Error Removing Account"),
|
||||||
_("An error ocurred while removing account"),
|
_("An error ocurred while removing account"),
|
||||||
parent=self.pref_dialog, details=failure.getErrorMessage()
|
parent=self.pref_dialog, details=failure.getErrorMessage()
|
||||||
|
|
|
@ -13,10 +13,10 @@ import os.path
|
||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
|
from deluge.ui.gtkui.common import get_logo
|
||||||
from deluge.ui.gtkui.ipcinterface import process_args
|
from deluge.ui.gtkui.ipcinterface import process_args
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -35,7 +35,7 @@ class QueuedTorrents(component.Component):
|
||||||
)
|
)
|
||||||
self.builder.get_object("chk_autoadd").set_active(self.config["autoadd_queued"])
|
self.builder.get_object("chk_autoadd").set_active(self.config["autoadd_queued"])
|
||||||
self.dialog = self.builder.get_object("queued_torrents_dialog")
|
self.dialog = self.builder.get_object("queued_torrents_dialog")
|
||||||
self.dialog.set_icon(common.get_logo(32))
|
self.dialog.set_icon(get_logo(32))
|
||||||
|
|
||||||
self.builder.connect_signals({
|
self.builder.connect_signals({
|
||||||
"on_button_remove_clicked": self.on_button_remove_clicked,
|
"on_button_remove_clicked": self.on_button_remove_clicked,
|
||||||
|
|
|
@ -12,12 +12,12 @@ import os
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
import common
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from deluge.ui.gtkui import dialogs
|
from deluge.ui.gtkui import dialogs
|
||||||
|
from deluge.ui.gtkui.common import build_menu_radio_list, get_logo
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import appindicator
|
import appindicator
|
||||||
|
@ -104,7 +104,7 @@ class SystemTray(component.Component):
|
||||||
else:
|
else:
|
||||||
log.debug("Enabling the system tray icon..")
|
log.debug("Enabling the system tray icon..")
|
||||||
if deluge.common.windows_check() or deluge.common.osx_check():
|
if deluge.common.windows_check() or deluge.common.osx_check():
|
||||||
self.tray = gtk.status_icon_new_from_pixbuf(common.get_logo(32))
|
self.tray = gtk.status_icon_new_from_pixbuf(get_logo(32))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.tray = gtk.status_icon_new_from_icon_name("deluge")
|
self.tray = gtk.status_icon_new_from_icon_name("deluge")
|
||||||
|
@ -237,14 +237,14 @@ class SystemTray(component.Component):
|
||||||
|
|
||||||
def build_tray_bwsetsubmenu(self):
|
def build_tray_bwsetsubmenu(self):
|
||||||
# Create the Download speed list sub-menu
|
# Create the Download speed list sub-menu
|
||||||
submenu_bwdownset = common.build_menu_radio_list(
|
submenu_bwdownset = build_menu_radio_list(
|
||||||
self.config["tray_download_speed_list"], self.on_tray_setbwdown,
|
self.config["tray_download_speed_list"], self.on_tray_setbwdown,
|
||||||
self.max_download_speed,
|
self.max_download_speed,
|
||||||
_("KiB/s"), show_notset=True, show_other=True
|
_("KiB/s"), show_notset=True, show_other=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the Upload speed list sub-menu
|
# Create the Upload speed list sub-menu
|
||||||
submenu_bwupset = common.build_menu_radio_list(
|
submenu_bwupset = build_menu_radio_list(
|
||||||
self.config["tray_upload_speed_list"], self.on_tray_setbwup,
|
self.config["tray_upload_speed_list"], self.on_tray_setbwup,
|
||||||
self.max_upload_speed,
|
self.max_upload_speed,
|
||||||
_("KiB/s"), show_notset=True, show_other=True
|
_("KiB/s"), show_notset=True, show_other=True
|
||||||
|
|
|
@ -63,12 +63,12 @@ class TorrentDetails(component.Component):
|
||||||
self.tabs = {}
|
self.tabs = {}
|
||||||
|
|
||||||
# Add the default tabs
|
# Add the default tabs
|
||||||
from status_tab import StatusTab
|
from deluge.ui.gtkui.status_tab import StatusTab
|
||||||
from details_tab import DetailsTab
|
from deluge.ui.gtkui.details_tab import DetailsTab
|
||||||
from files_tab import FilesTab
|
from deluge.ui.gtkui.files_tab import FilesTab
|
||||||
from peers_tab import PeersTab
|
from deluge.ui.gtkui.peers_tab import PeersTab
|
||||||
from options_tab import OptionsTab
|
from deluge.ui.gtkui.options_tab import OptionsTab
|
||||||
from trackers_tab import TrackersTab
|
from deluge.ui.gtkui.trackers_tab import TrackersTab
|
||||||
|
|
||||||
default_tabs = {
|
default_tabs = {
|
||||||
"Status": StatusTab,
|
"Status": StatusTab,
|
||||||
|
|
|
@ -17,10 +17,10 @@ import pygtk
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import listview
|
|
||||||
import torrentview_data_funcs as funcs
|
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
from removetorrentdialog import RemoveTorrentDialog
|
from deluge.ui.gtkui import torrentview_data_funcs as funcs
|
||||||
|
from deluge.ui.gtkui.listview import ListView
|
||||||
|
from deluge.ui.gtkui.removetorrentdialog import RemoveTorrentDialog
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
|
||||||
|
@ -199,13 +199,13 @@ class SearchBox(object):
|
||||||
self.search_pending = reactor.callLater(0.7, self.torrentview.update)
|
self.search_pending = reactor.callLater(0.7, self.torrentview.update)
|
||||||
|
|
||||||
|
|
||||||
class TorrentView(listview.ListView, component.Component):
|
class TorrentView(ListView, component.Component):
|
||||||
"""TorrentView handles the listing of torrents."""
|
"""TorrentView handles the listing of torrents."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
component.Component.__init__(self, "TorrentView", interval=2, depend=["SessionProxy"])
|
component.Component.__init__(self, "TorrentView", interval=2, depend=["SessionProxy"])
|
||||||
self.window = component.get("MainWindow")
|
self.window = component.get("MainWindow")
|
||||||
# Call the ListView constructor
|
# Call the ListView constructor
|
||||||
listview.ListView.__init__(self, self.window.main_builder.get_object("torrent_view"), "torrentview.state")
|
ListView.__init__(self, self.window.main_builder.get_object("torrent_view"), "torrentview.state")
|
||||||
log.debug("TorrentView Init..")
|
log.debug("TorrentView Init..")
|
||||||
|
|
||||||
# If we have gotten the state yet
|
# If we have gotten the state yet
|
||||||
|
@ -352,12 +352,12 @@ class TorrentView(listview.ListView, component.Component):
|
||||||
"""
|
"""
|
||||||
Saves the state of the torrent view.
|
Saves the state of the torrent view.
|
||||||
"""
|
"""
|
||||||
listview.ListView.save_state(self, "torrentview.state")
|
ListView.save_state(self, "torrentview.state")
|
||||||
|
|
||||||
def remove_column(self, header):
|
def remove_column(self, header):
|
||||||
"""Removes the column with the name 'header' from the torrentview"""
|
"""Removes the column with the name 'header' from the torrentview"""
|
||||||
self.save_state()
|
self.save_state()
|
||||||
listview.ListView.remove_column(self, header)
|
ListView.remove_column(self, header)
|
||||||
|
|
||||||
def set_filter(self, filter_dict):
|
def set_filter(self, filter_dict):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -91,6 +91,6 @@ class TrackersTab(Tab):
|
||||||
def _on_button_edit_trackers_clicked(self, button):
|
def _on_button_edit_trackers_clicked(self, button):
|
||||||
torrent_id = component.get("TorrentView").get_selected_torrent()
|
torrent_id = component.get("TorrentView").get_selected_torrent()
|
||||||
if torrent_id:
|
if torrent_id:
|
||||||
from edittrackersdialog import EditTrackersDialog
|
from deluge.ui.gtkui.edittrackersdialog import EditTrackersDialog
|
||||||
dialog = EditTrackersDialog(torrent_id, component.get("MainWindow").window)
|
dialog = EditTrackersDialog(torrent_id, component.get("MainWindow").window)
|
||||||
dialog.run()
|
dialog.run()
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
from web import start
|
from deluge.ui.web.web import start
|
||||||
assert start # silence pyflakes
|
assert start # silence pyflakes
|
||||||
|
|
|
@ -40,6 +40,7 @@ class AuthError(Exception):
|
||||||
# Import after as json_api imports the above AuthError and AUTH_LEVEL_DEFAULT
|
# Import after as json_api imports the above AuthError and AUTH_LEVEL_DEFAULT
|
||||||
from deluge.ui.web.json_api import export, JSONComponent # isort:skip
|
from deluge.ui.web.json_api import export, JSONComponent # isort:skip
|
||||||
|
|
||||||
|
|
||||||
def make_checksum(session_id):
|
def make_checksum(session_id):
|
||||||
return reduce(lambda x, y: x + y, map(ord, session_id))
|
return reduce(lambda x, y: x + y, map(ord, session_id))
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ from deluge.ui.ui import _UI, UI
|
||||||
|
|
||||||
class WebUI(UI):
|
class WebUI(UI):
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
import server
|
from deluge.ui.web import server
|
||||||
deluge_web = server.DelugeWeb()
|
deluge_web = server.DelugeWeb()
|
||||||
deluge_web.start()
|
deluge_web.start()
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class Web(_UI):
|
||||||
self.options.user = pwd.getpwnam(self.options.user)[2]
|
self.options.user = pwd.getpwnam(self.options.user)[2]
|
||||||
os.setuid(self.options.user)
|
os.setuid(self.options.user)
|
||||||
|
|
||||||
import server
|
from deluge.ui.web import server
|
||||||
self.__server = server.DelugeWeb()
|
self.__server = server.DelugeWeb()
|
||||||
|
|
||||||
if self.options.base:
|
if self.options.base:
|
||||||
|
|
Loading…
Reference in New Issue