mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-26 03:09:13 +00:00
[GTKUI] All files Flake8'd and use new header
This commit is contained in:
parent
b5dcfc6f9e
commit
3315768b27
@ -1 +1,2 @@
|
||||
from gtkui import start
|
||||
assert start # silence pyflakes
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# addtorrentdialog.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import base64
|
||||
@ -57,7 +31,6 @@ from torrentview_data_funcs import cell_data_size
|
||||
|
||||
pygtk.require('2.0')
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -320,10 +293,10 @@ class AddTorrentDialog(component.Component):
|
||||
if first_slash_index == -1:
|
||||
files_storage[file_name] = (file_num, file, download)
|
||||
else:
|
||||
file_name_chunk = file_name[:first_slash_index+1]
|
||||
file_name_chunk = file_name[:first_slash_index + 1]
|
||||
if file_name_chunk not in files_storage:
|
||||
files_storage[file_name_chunk] = {}
|
||||
self.prepare_file(file, file_name[first_slash_index+1:],
|
||||
self.prepare_file(file, file_name[first_slash_index + 1:],
|
||||
file_num, download, files_storage[file_name_chunk])
|
||||
|
||||
def add_files(self, parent_iter, split_files):
|
||||
@ -771,7 +744,7 @@ class AddTorrentDialog(component.Component):
|
||||
os.path.split(filename)[-1],
|
||||
base64.encodestring(self.infos[torrent_id]),
|
||||
options
|
||||
)
|
||||
)
|
||||
|
||||
row = self.torrent_liststore.iter_next(row)
|
||||
self.hide()
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# connectionmanager.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import hashlib
|
||||
@ -76,6 +50,7 @@ HOSTLIST_STATUS = [
|
||||
"Connected"
|
||||
]
|
||||
|
||||
|
||||
def cell_render_host(column, cell, model, row, data):
|
||||
host, port, username = model.get(row, *data)
|
||||
text = host + ":" + str(port)
|
||||
@ -83,6 +58,7 @@ def cell_render_host(column, cell, model, row, data):
|
||||
text = username + "@" + text
|
||||
cell.set_property('text', text)
|
||||
|
||||
|
||||
def cell_render_status(column, cell, model, row, data):
|
||||
status = model[row][data]
|
||||
pixbuf = None
|
||||
@ -91,6 +67,7 @@ def cell_render_status(column, cell, model, row, data):
|
||||
|
||||
cell.set_property("pixbuf", pixbuf)
|
||||
|
||||
|
||||
class ConnectionManager(component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "ConnectionManager")
|
||||
@ -117,16 +94,16 @@ class ConnectionManager(component.Component):
|
||||
create_localclient_account()
|
||||
|
||||
localclient_username, localclient_password = get_localhost_auth()
|
||||
DEFAULT_CONFIG = {
|
||||
default_config = {
|
||||
"hosts": [(
|
||||
hashlib.sha1(str(time.time())).hexdigest(),
|
||||
DEFAULT_HOST,
|
||||
DEFAULT_PORT,
|
||||
localclient_username,
|
||||
localclient_password
|
||||
DEFAULT_HOST,
|
||||
DEFAULT_PORT,
|
||||
localclient_username,
|
||||
localclient_password
|
||||
)]
|
||||
}
|
||||
config = ConfigManager("hostlist.conf.1.2", DEFAULT_CONFIG)
|
||||
config = ConfigManager("hostlist.conf.1.2", default_config)
|
||||
config.run_converter((0, 1), 2, self.__migrate_config_1_to_2)
|
||||
return config
|
||||
|
||||
@ -214,7 +191,7 @@ class ConnectionManager(component.Component):
|
||||
self.hostlist.get_selection().select_path("0")
|
||||
|
||||
# Run the dialog
|
||||
response = self.connection_manager.run()
|
||||
self.connection_manager.run()
|
||||
self.running = False
|
||||
|
||||
# Save the toggle options
|
||||
@ -241,8 +218,7 @@ class ConnectionManager(component.Component):
|
||||
# Check to see if there is already an entry for this host and return
|
||||
# if thats the case
|
||||
for entry in self.liststore:
|
||||
if [entry[HOSTLIST_COL_HOST], entry[HOSTLIST_COL_PORT],
|
||||
entry[HOSTLIST_COL_USER]] == [host, port, username]:
|
||||
if [entry[HOSTLIST_COL_HOST], entry[HOSTLIST_COL_PORT], entry[HOSTLIST_COL_USER]] == [host, port, username]:
|
||||
raise Exception("Host already in list!")
|
||||
|
||||
# Host isn't in the list, so lets add it
|
||||
@ -313,6 +289,7 @@ class ConnectionManager(component.Component):
|
||||
if not self.running:
|
||||
return
|
||||
row = self.__get_host_row(host_id)
|
||||
|
||||
def on_info(info, c):
|
||||
if not self.running:
|
||||
return
|
||||
@ -349,8 +326,9 @@ class ConnectionManager(component.Component):
|
||||
port = row[HOSTLIST_COL_PORT]
|
||||
user = row[HOSTLIST_COL_USER]
|
||||
|
||||
if client.connected() and \
|
||||
(host, port, "localclient" if not user and host in ("127.0.0.1", "localhost") else user) == client.connection_info():
|
||||
if (client.connected() and
|
||||
(host, port, "localclient" if not user and host in ("127.0.0.1", "localhost") else user)
|
||||
== client.connection_info()):
|
||||
def on_info(info):
|
||||
if not self.running:
|
||||
return
|
||||
@ -389,7 +367,8 @@ class ConnectionManager(component.Component):
|
||||
"""
|
||||
self.gtkui_config["autoconnect"] = self.builder.get_object("chk_autoconnect").get_active()
|
||||
self.gtkui_config["autostart_localhost"] = self.builder.get_object("chk_autostart").get_active()
|
||||
self.gtkui_config["show_connection_manager_on_start"] = not self.builder.get_object("chk_donotshow").get_active()
|
||||
self.gtkui_config["show_connection_manager_on_start"] = not self.builder.get_object(
|
||||
"chk_donotshow").get_active()
|
||||
|
||||
def __update_buttons(self):
|
||||
"""
|
||||
@ -526,9 +505,8 @@ class ConnectionManager(component.Component):
|
||||
|
||||
if reason.check(AuthenticationRequired, BadLoginError):
|
||||
log.debug("PasswordRequired exception")
|
||||
dialog = dialogs.AuthenticationDialog(
|
||||
reason.value.message, reason.value.username
|
||||
)
|
||||
dialog = dialogs.AuthenticationDialog(reason.value.message, reason.value.username)
|
||||
|
||||
def dialog_finished(response_id, host, port, user):
|
||||
if response_id == gtk.RESPONSE_OK:
|
||||
self.__connect(host_id, host, port,
|
||||
@ -543,12 +521,11 @@ class ConnectionManager(component.Component):
|
||||
)
|
||||
return dialog.run()
|
||||
|
||||
|
||||
if try_counter:
|
||||
log.info("Retrying connection.. Retries left: %s", try_counter)
|
||||
return reactor.callLater(
|
||||
0.5, self.__connect, host_id, host, port, user, passwd,
|
||||
try_counter=try_counter-1
|
||||
try_counter=try_counter - 1
|
||||
)
|
||||
|
||||
msg = str(reason.value)
|
||||
@ -574,9 +551,8 @@ class ConnectionManager(component.Component):
|
||||
user = model[row][HOSTLIST_COL_USER]
|
||||
password = model[row][HOSTLIST_COL_PASS]
|
||||
|
||||
if status == "Offline" and \
|
||||
self.builder.get_object("chk_autostart").get_active() and \
|
||||
host in ("127.0.0.1", "localhost"):
|
||||
if (status == "Offline" and self.builder.get_object("chk_autostart").get_active() and
|
||||
host in ("127.0.0.1", "localhost")):
|
||||
if not self.start_daemon(port, deluge.configmanager.get_config_dir()):
|
||||
log.debug("Failed to auto-start daemon")
|
||||
return
|
||||
@ -727,6 +703,7 @@ class ConnectionManager(component.Component):
|
||||
elif user and password:
|
||||
# Create a new client instance
|
||||
c = deluge.ui.client.Client()
|
||||
|
||||
def on_connect(d, c):
|
||||
log.debug("on_connect")
|
||||
c.daemon.shutdown().addCallback(on_daemon_shutdown)
|
||||
|
@ -1,43 +1,15 @@
|
||||
#
|
||||
# createtorrentdialog.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import base64
|
||||
import logging
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
import gobject
|
||||
import gtk
|
||||
@ -51,6 +23,7 @@ from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CreateTorrentDialog:
|
||||
def show(self):
|
||||
self.builder = gtk.Builder()
|
||||
@ -156,10 +129,10 @@ class CreateTorrentDialog:
|
||||
log.debug("_on_button_file_clicked")
|
||||
# Setup the filechooserdialog
|
||||
chooser = gtk.FileChooserDialog(_("Choose a file"),
|
||||
self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
||||
|
||||
chooser.set_transient_for(self.dialog)
|
||||
chooser.set_select_multiple(False)
|
||||
@ -185,10 +158,10 @@ class CreateTorrentDialog:
|
||||
log.debug("_on_button_folder_clicked")
|
||||
# Setup the filechooserdialog
|
||||
chooser = gtk.FileChooserDialog(_("Choose a folder"),
|
||||
self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN,
|
||||
gtk.RESPONSE_OK))
|
||||
self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
||||
|
||||
chooser.set_transient_for(self.dialog)
|
||||
chooser.set_select_multiple(False)
|
||||
@ -220,6 +193,7 @@ class CreateTorrentDialog:
|
||||
|
||||
if response == gtk.RESPONSE_OK:
|
||||
result = entry.get_text()
|
||||
|
||||
def _on_get_path_size(size):
|
||||
log.debug("size: %s", size)
|
||||
if size > 0:
|
||||
@ -261,10 +235,10 @@ class CreateTorrentDialog:
|
||||
dialog.hide()
|
||||
else:
|
||||
# Setup the filechooserdialog
|
||||
chooser = gtk.FileChooserDialog(_("Save .torrent file"),
|
||||
self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
|
||||
chooser = gtk.FileChooserDialog(_("Save .torrent file"), self.dialog,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_SAVE, gtk.RESPONSE_OK))
|
||||
|
||||
chooser.set_transient_for(self.dialog)
|
||||
chooser.set_select_multiple(False)
|
||||
@ -337,7 +311,7 @@ class CreateTorrentDialog:
|
||||
self._on_create_torrent_progress(piece_count, num_pieces)
|
||||
if piece_count == num_pieces:
|
||||
from twisted.internet import reactor
|
||||
reactor.callLater(0.5, torrent_created) # pylint: disable-msg=E1101
|
||||
reactor.callLater(0.5, torrent_created) # pylint: disable-msg=E1101
|
||||
|
||||
client.register_event_handler("CreateTorrentProgressEvent", on_create_torrent_progress_event)
|
||||
|
||||
@ -359,17 +333,17 @@ class CreateTorrentDialog:
|
||||
self.builder.get_object("progress_dialog").hide_all()
|
||||
|
||||
deferToThread(self.create_torrent,
|
||||
path.decode('utf-8'),
|
||||
tracker,
|
||||
piece_length,
|
||||
self._on_create_torrent_progress,
|
||||
comment,
|
||||
result.decode('utf-8'),
|
||||
webseeds,
|
||||
private,
|
||||
author,
|
||||
trackers,
|
||||
add_to_session).addCallback(hide_progress)
|
||||
path.decode('utf-8'),
|
||||
tracker,
|
||||
piece_length,
|
||||
self._on_create_torrent_progress,
|
||||
comment,
|
||||
result.decode('utf-8'),
|
||||
webseeds,
|
||||
private,
|
||||
author,
|
||||
trackers,
|
||||
add_to_session).addCallback(hide_progress)
|
||||
|
||||
# Setup progress dialog
|
||||
self.builder.get_object("progress_dialog").set_transient_for(component.get("MainWindow").window)
|
||||
@ -399,11 +373,11 @@ class CreateTorrentDialog:
|
||||
{"download_location": os.path.split(path)[0]})
|
||||
|
||||
def _on_create_torrent_progress(self, value, num_pieces):
|
||||
percent = float(value)/float(num_pieces)
|
||||
percent = float(value) / float(num_pieces)
|
||||
|
||||
def update_pbar_with_gobject(percent):
|
||||
pbar = self.builder.get_object("progressbar")
|
||||
pbar.set_text("%.2f%%" % (percent*100))
|
||||
pbar.set_text("%.2f%%" % (percent * 100))
|
||||
pbar.set_fraction(percent)
|
||||
return False
|
||||
|
||||
|
@ -1,36 +1,12 @@
|
||||
#
|
||||
# dialogs.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import gtk
|
||||
from twisted.internet import defer
|
||||
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# edittrackersdialog.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
@ -46,6 +20,7 @@ from deluge.ui.client import client
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EditTrackersDialog:
|
||||
def __init__(self, torrent_id, parent=None):
|
||||
self.torrent_id = torrent_id
|
||||
@ -71,7 +46,7 @@ class EditTrackersDialog:
|
||||
self.edit_tracker_entry.set_transient_for(self.dialog)
|
||||
self.dialog.set_icon(common.get_deluge_icon())
|
||||
|
||||
if parent != None:
|
||||
if parent is not None:
|
||||
self.dialog.set_transient_for(parent)
|
||||
|
||||
# Connect the signals
|
||||
@ -104,7 +79,7 @@ class EditTrackersDialog:
|
||||
|
||||
def run(self):
|
||||
# Make sure we have a torrent_id.. if not just return
|
||||
if self.torrent_id == None:
|
||||
if self.torrent_id is None:
|
||||
return
|
||||
|
||||
# Get the trackers for this torrent
|
||||
@ -117,7 +92,6 @@ class EditTrackersDialog:
|
||||
self.deferred = defer.Deferred()
|
||||
return self.deferred
|
||||
|
||||
|
||||
def _on_delete_event(self, widget, event):
|
||||
self.deferred.callback(gtk.RESPONSE_DELETE_EVENT)
|
||||
self.dialog.destroy()
|
||||
@ -125,6 +99,7 @@ class EditTrackersDialog:
|
||||
def _on_response(self, widget, response):
|
||||
if response == 1:
|
||||
self.trackers = []
|
||||
|
||||
def each(model, path, iter, data):
|
||||
tracker = {}
|
||||
tracker["tier"] = model.get_value(iter, 0)
|
||||
@ -165,7 +140,7 @@ class EditTrackersDialog:
|
||||
def on_button_remove_clicked(self, widget):
|
||||
log.debug("on_button_remove_clicked")
|
||||
selected = self.get_selected()
|
||||
if selected != None:
|
||||
if selected is not None:
|
||||
self.liststore.remove(selected)
|
||||
|
||||
def on_button_edit_clicked(self, widget):
|
||||
@ -193,7 +168,7 @@ class EditTrackersDialog:
|
||||
log.debug("on_button_up_clicked")
|
||||
selected = self.get_selected()
|
||||
num_rows = self.liststore.iter_n_children(None)
|
||||
if selected != None and num_rows > 1:
|
||||
if selected is not None and num_rows > 1:
|
||||
tier = self.liststore.get_value(selected, 0)
|
||||
if not tier > 0:
|
||||
return
|
||||
@ -205,7 +180,7 @@ class EditTrackersDialog:
|
||||
log.debug("on_button_down_clicked")
|
||||
selected = self.get_selected()
|
||||
num_rows = self.liststore.iter_n_children(None)
|
||||
if selected != None and num_rows > 1:
|
||||
if selected is not None and num_rows > 1:
|
||||
tier = self.liststore.get_value(selected, 0)
|
||||
new_tier = tier + 1
|
||||
# Now change the tier for this tracker
|
||||
|
@ -353,10 +353,10 @@ class FilesTab(Tab):
|
||||
if first_slash_index == -1:
|
||||
files_storage[file_name] = (file_num, file)
|
||||
else:
|
||||
file_name_chunk = file_name[:first_slash_index+1]
|
||||
file_name_chunk = file_name[:first_slash_index + 1]
|
||||
if file_name_chunk not in files_storage:
|
||||
files_storage[file_name_chunk] = {}
|
||||
self.prepare_file(file, file_name[first_slash_index+1:],
|
||||
self.prepare_file(file, file_name[first_slash_index + 1:],
|
||||
file_num, files_storage[file_name_chunk])
|
||||
|
||||
def add_files(self, parent_iter, split_files):
|
||||
@ -407,7 +407,7 @@ class FilesTab(Tab):
|
||||
for row in rows:
|
||||
if row[5] > -1:
|
||||
files_list.append((row[5], row))
|
||||
self.get_files_from_tree(row.iterchildren(), files_list, indent+1)
|
||||
self.get_files_from_tree(row.iterchildren(), files_list, indent + 1)
|
||||
return None
|
||||
|
||||
def update_folder_percentages(self):
|
||||
|
@ -35,7 +35,7 @@ STATE_PIX = {
|
||||
"Active": "active",
|
||||
"Allocating": "checking",
|
||||
"Moving": "checking"
|
||||
}
|
||||
}
|
||||
|
||||
TRACKER_PIX = {
|
||||
"All": "tracker_all",
|
||||
@ -249,7 +249,7 @@ class FilterTreeView(component.Component):
|
||||
log.warning(ex)
|
||||
return self.get_transparent_pix(16, 16)
|
||||
|
||||
def get_transparent_pix(self, width, height):
|
||||
def get_transparent_pix(self, width, height):
|
||||
pix = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, width, height)
|
||||
pix.fill(0x0000000)
|
||||
return pix
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# gtkui.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
@ -72,7 +46,6 @@ gobject.set_prgname("deluge")
|
||||
# Install the twisted reactor
|
||||
reactor = gtk2reactor.install()
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
@ -436,7 +409,7 @@ class GtkUI(object):
|
||||
def dialog_finished(response_id, host, port):
|
||||
if response_id == gtk.RESPONSE_OK:
|
||||
reactor.callLater(
|
||||
0.5, do_connect, try_counter-1,
|
||||
0.5, do_connect, try_counter - 1,
|
||||
host, port, dialog.get_username(),
|
||||
dialog.get_password())
|
||||
dialog.run().addCallback(dialog_finished,
|
||||
@ -447,7 +420,7 @@ class GtkUI(object):
|
||||
log.info("Retrying connection.. Retries left: "
|
||||
"%s", try_counter)
|
||||
reactor.callLater(0.5, update_connection_manager)
|
||||
reactor.callLater(0.5, do_connect, try_counter-1,
|
||||
reactor.callLater(0.5, do_connect, try_counter - 1,
|
||||
host, port, user, passwd)
|
||||
|
||||
def do_connect(try_counter, host, port, user, passwd):
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# ipcinterface.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import base64
|
||||
|
@ -1,37 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# listview.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
@ -101,20 +74,20 @@ class ListView:
|
||||
label = gtk.Label(title)
|
||||
self.set_widget(label)
|
||||
label.show()
|
||||
label.__realize = label.connect('realize', self.onRealize)
|
||||
label.__realize = label.connect('realize', self.on_realize)
|
||||
self.title = title
|
||||
self.data_func = None
|
||||
self.data_func_data = None
|
||||
self.cell_renderer = None
|
||||
|
||||
def onRealize(self, widget):
|
||||
def on_realize(self, widget):
|
||||
widget.disconnect(widget.__realize)
|
||||
del widget.__realize
|
||||
button = widget.get_ancestor(gtk.Button)
|
||||
if button is not None:
|
||||
button.connect('button-press-event', self.onButtonPressed)
|
||||
button.connect('button-press-event', self.on_button_pressed)
|
||||
|
||||
def onButtonPressed(self, widget, event):
|
||||
def on_button_pressed(self, widget, event):
|
||||
self.emit('button-press-event', event)
|
||||
|
||||
def set_cell_data_func_attributes(self, cell_renderer, func, func_data=None):
|
||||
@ -610,8 +583,8 @@ class ListView:
|
||||
return True
|
||||
|
||||
def on_keypress_search_by_name(self, model, columnn, key, iter):
|
||||
TORRENT_NAME_COL = 5
|
||||
return not model[iter][TORRENT_NAME_COL].lower().startswith(key.lower())
|
||||
torrent_name_col = 5
|
||||
return not model[iter][torrent_name_col].lower().startswith(key.lower())
|
||||
|
||||
def restore_columns_order_from_state(self):
|
||||
if self.state is None:
|
||||
|
@ -1,37 +1,12 @@
|
||||
#
|
||||
# menubar_osx.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import gtk
|
||||
|
||||
from deluge.configmanager import ConfigManager
|
||||
|
@ -1,38 +1,11 @@
|
||||
#
|
||||
# new_release_dialog.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
|
@ -1,38 +1,11 @@
|
||||
#
|
||||
# notification.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008 Marcos Pinto ('markybob') <markybob@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
@ -40,10 +13,10 @@ import common
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.client import client
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Notification:
|
||||
def __init__(self):
|
||||
self.config = ConfigManager("gtkui.conf")
|
||||
@ -82,10 +55,8 @@ class Notification:
|
||||
if not pynotify.init("Deluge"):
|
||||
return
|
||||
title = deluge.common.xml_encode(_("Torrent complete"))
|
||||
message = deluge.common.xml_encode(
|
||||
"%s\n%s %i %s" % (status["name"],
|
||||
_("Including"), status["num_files"], _("files"))
|
||||
)
|
||||
message = deluge.common.xml_encode("%s\n%s %i %s" % (status["name"],
|
||||
_("Including"), status["num_files"], _("files")))
|
||||
self.note = pynotify.Notification(title, message)
|
||||
self.note.set_icon_from_pixbuf(common.get_logo(48))
|
||||
if not self.note.show():
|
||||
@ -113,7 +84,7 @@ class Notification:
|
||||
import smtplib
|
||||
headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (
|
||||
self.config["ntf_email_add"], self.config["ntf_email_add"],
|
||||
"Finished torrent %s" % (status["name"]))
|
||||
"Finished torrent %s" % (status["name"]))
|
||||
text = _("This email is to inform you that Deluge has finished "
|
||||
"downloading %(name)s , which includes %(num_files)i files.\n"
|
||||
"To stop receiving these alerts, simply turn off email "
|
||||
@ -125,28 +96,28 @@ class Notification:
|
||||
port = 465
|
||||
elif self.config["ntf_security"] == 'TLS':
|
||||
port = 587
|
||||
elif self.config["ntf_security"] == None:
|
||||
elif self.config["ntf_security"] is None:
|
||||
port = 25
|
||||
try:
|
||||
mailServer = smtplib.SMTP(self.config["ntf_server"], port)
|
||||
mail_server = smtplib.SMTP(self.config["ntf_server"], port)
|
||||
except Exception as ex:
|
||||
log.error("There was an error sending the notification email: %s", ex)
|
||||
return
|
||||
|
||||
if self.config["ntf_username"] and self.config["ntf_pass"]:
|
||||
if self.config["ntf_security"] == 'SSL' or 'TLS':
|
||||
mailServer.ehlo('x')
|
||||
mailServer.starttls()
|
||||
mailServer.ehlo('x')
|
||||
mail_server.ehlo('x')
|
||||
mail_server.starttls()
|
||||
mail_server.ehlo('x')
|
||||
try:
|
||||
mailServer.login(self.config["ntf_username"], self.config["ntf_pass"])
|
||||
mail_server.login(self.config["ntf_username"], self.config["ntf_pass"])
|
||||
except smtplib.SMTPHeloError:
|
||||
log.warning("The server didn't reply properly to the helo greeting")
|
||||
except smtplib.SMTPAuthenticationError:
|
||||
log.warning("The server didn't accept the username/password combination")
|
||||
try:
|
||||
mailServer.sendmail(self.config["ntf_email_add"], self.config["ntf_email_add"], message)
|
||||
mailServer.quit()
|
||||
mail_server.sendmail(self.config["ntf_email_add"], self.config["ntf_email_add"], message)
|
||||
mail_server.quit()
|
||||
except:
|
||||
log.warning("sending email notification of finished torrent failed")
|
||||
else:
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# options_tab.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import gtk.gdk
|
||||
|
@ -1,35 +1,10 @@
|
||||
#
|
||||
# path_chooser.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2013 Bro <bro.development@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -1,37 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# path_combo_chooser.py
|
||||
#
|
||||
# Copyright (C) 2013 Bro <bro.development@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# peers_tab.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -1,37 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# piecesbar.py
|
||||
#
|
||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
@ -124,16 +97,16 @@ class PiecesBar(gtk.DrawingArea):
|
||||
|
||||
def __roundcorners_border(self):
|
||||
self.__create_roundcorners_subpath(
|
||||
self.__cr, 0.5, 0.5, self.__width-1, self.__height-1
|
||||
self.__cr, 0.5, 0.5, self.__width - 1, self.__height - 1
|
||||
)
|
||||
self.__cr.set_source_rgba(0.0, 0.0, 0.0, 0.9)
|
||||
self.__cr.stroke()
|
||||
|
||||
def __create_roundcorners_subpath(self, ctx, x, y, width, height):
|
||||
aspect = 1.0
|
||||
corner_radius = height/10.0
|
||||
radius = corner_radius/aspect
|
||||
degrees = pi/180.0
|
||||
corner_radius = height / 10.0
|
||||
radius = corner_radius / aspect
|
||||
degrees = pi / 180.0
|
||||
ctx.new_sub_path()
|
||||
ctx.arc(x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees)
|
||||
ctx.arc(x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees)
|
||||
@ -152,14 +125,14 @@ class PiecesBar(gtk.DrawingArea):
|
||||
ctx = cairo.Context(self.__pieces_overlay)
|
||||
start_pos = 0
|
||||
num_pieces = self.__num_pieces and self.__num_pieces or len(self.__pieces)
|
||||
piece_width = self.__width*1.0/num_pieces
|
||||
piece_width = self.__width * 1.0 / num_pieces
|
||||
|
||||
for state in self.__pieces:
|
||||
color = self.gtkui_config["pieces_color_%s" % COLOR_STATES[state]]
|
||||
ctx.set_source_rgb(
|
||||
color[0]/65535.0,
|
||||
color[1]/65535.0,
|
||||
color[2]/65535.0,
|
||||
color[0] / 65535.0,
|
||||
color[1] / 65535.0,
|
||||
color[2] / 65535.0,
|
||||
)
|
||||
ctx.rectangle(start_pos, 0, piece_width, self.__height)
|
||||
ctx.fill()
|
||||
@ -176,15 +149,15 @@ class PiecesBar(gtk.DrawingArea):
|
||||
cairo.FORMAT_ARGB32, self.__width, self.__height
|
||||
)
|
||||
ctx = cairo.Context(self.__pieces_overlay)
|
||||
piece_width = self.__width*1.0/self.__num_pieces
|
||||
piece_width = self.__width * 1.0 / self.__num_pieces
|
||||
start = 0
|
||||
for _ in range(self.__num_pieces):
|
||||
# Like this to keep same aspect ratio
|
||||
color = self.gtkui_config["pieces_color_%s" % COLOR_STATES[3]]
|
||||
ctx.set_source_rgb(
|
||||
color[0]/65535.0,
|
||||
color[1]/65535.0,
|
||||
color[2]/65535.0,
|
||||
color[0] / 65535.0,
|
||||
color[1] / 65535.0,
|
||||
color[2] / 65535.0,
|
||||
)
|
||||
ctx.rectangle(start, 0, piece_width, self.__height)
|
||||
ctx.fill()
|
||||
@ -204,7 +177,7 @@ class PiecesBar(gtk.DrawingArea):
|
||||
)
|
||||
ctx = cairo.Context(self.__progress_overlay)
|
||||
ctx.set_source_rgba(0.1, 0.1, 0.1, 0.3) # Transparent
|
||||
ctx.rectangle(0.0, 0.0, self.__width*self.__fraction, self.__height)
|
||||
ctx.rectangle(0.0, 0.0, self.__width * self.__fraction, self.__height)
|
||||
ctx.fill()
|
||||
self.__cr.set_source_surface(self.__progress_overlay)
|
||||
self.__cr.paint()
|
||||
@ -237,15 +210,15 @@ class PiecesBar(gtk.DrawingArea):
|
||||
format = "%d%%"
|
||||
else:
|
||||
format = "%.2f%%"
|
||||
text += format % (self.__fraction*100)
|
||||
text += format % (self.__fraction * 100)
|
||||
log.trace("PiecesBar text %r", text)
|
||||
pl.set_text(text)
|
||||
plsize = pl.get_size()
|
||||
text_width = plsize[0]/pango.SCALE
|
||||
text_height = plsize[1]/pango.SCALE
|
||||
text_width = plsize[0] / pango.SCALE
|
||||
text_height = plsize[1] / pango.SCALE
|
||||
area_width_without_text = self.__width - text_width
|
||||
area_height_without_text = self.__height - text_height
|
||||
ctx.move_to(area_width_without_text/2, area_height_without_text/2)
|
||||
ctx.move_to(area_width_without_text / 2, area_height_without_text / 2)
|
||||
ctx.set_source_rgb(1.0, 1.0, 1.0)
|
||||
pg.update_layout(pl)
|
||||
pg.show_layout(pl)
|
||||
@ -287,7 +260,7 @@ class PiecesBar(gtk.DrawingArea):
|
||||
|
||||
def update_from_status(self, status):
|
||||
log.trace("Updating PiecesBar from status")
|
||||
self.set_fraction(status["progress"]/100)
|
||||
self.set_fraction(status["progress"] / 100)
|
||||
torrent_state = status["state"]
|
||||
self.set_state(torrent_state)
|
||||
if torrent_state == "Checking":
|
||||
|
@ -1,38 +1,11 @@
|
||||
#
|
||||
# pluginmanager.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
@ -43,8 +16,8 @@ from deluge.ui.client import client
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
|
||||
component.Component):
|
||||
|
||||
class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Component):
|
||||
def __init__(self):
|
||||
component.Component.__init__(self, "PluginManager")
|
||||
self.config = ConfigManager("gtkui.conf")
|
||||
|
@ -1,37 +1,11 @@
|
||||
#
|
||||
# preferences.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2011 Pedro Algarvio <pedro@algarvio.me>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
@ -194,6 +168,7 @@ class Preferences(component.Component):
|
||||
if not deluge.common.osx_check() and not deluge.common.windows_check():
|
||||
try:
|
||||
import appindicator
|
||||
assert appindicator # silence pyflakes
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
@ -370,7 +345,7 @@ class Preferences(component.Component):
|
||||
"chk_copy_torrent_file": ("active", "copy_torrent_file"),
|
||||
"chk_del_copy_torrent_file": ("active", "del_copy_torrent_file"),
|
||||
"chk_pre_allocation": ("active", "pre_allocate_storage"),
|
||||
"chk_prioritize_first_last_pieces": ("active", "prioritize_first_last_pieces"),
|
||||
"chk_prioritize_first_last_pieces": ("active", "prioritize_first_last_pieces"),
|
||||
"chk_sequential_download": ("active", "sequential_download"),
|
||||
"chk_add_paused": ("active", "add_paused"),
|
||||
"active_port_label": ("text", lambda: str(self.active_port)),
|
||||
@ -423,7 +398,7 @@ class Preferences(component.Component):
|
||||
"chk_remove_ratio": ("active", "remove_seed_at_ratio"),
|
||||
"spin_cache_size": ("value", "cache_size"),
|
||||
"spin_cache_expiry": ("value", "cache_expiry"),
|
||||
"combo_proxy_type": ("active", lambda: self.core_config["proxy"]["type"]),
|
||||
"combo_proxy_type": ("active", lambda: self.core_config["proxy"]["type"]),
|
||||
"entry_proxy_user": ("text", lambda: self.core_config["proxy"]["username"]),
|
||||
"entry_proxy_pass": ("text", lambda: self.core_config["proxy"]["password"]),
|
||||
"entry_proxy_host": ("text", lambda: self.core_config["proxy"]["hostname"]),
|
||||
|
@ -1,36 +1,10 @@
|
||||
#
|
||||
# queuedtorrents.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -1,36 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# removetorrentdialog.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
# Copyright (C) 2007-2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -1,50 +1,23 @@
|
||||
#
|
||||
# sidebar.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
import gtk
|
||||
|
||||
import deluge.common
|
||||
import deluge.component as component
|
||||
from deluge.configmanager import ConfigManager
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SideBar(component.Component):
|
||||
"""
|
||||
manages the sidebar-tabs.
|
||||
@ -84,12 +57,12 @@ class SideBar(component.Component):
|
||||
|
||||
def add_tab(self, widget, tab_name, label):
|
||||
"""Adds a tab object to the notebook."""
|
||||
log.debug("add tab:%s" % tab_name )
|
||||
log.debug("add tab: %s", tab_name)
|
||||
self.tabs[tab_name] = widget
|
||||
scrolled = gtk.ScrolledWindow()
|
||||
scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
scrolled.add(widget)
|
||||
pos = self.notebook.insert_page(scrolled, gtk.Label(label), -1)
|
||||
self.notebook.insert_page(scrolled, gtk.Label(label), -1)
|
||||
scrolled.show_all()
|
||||
|
||||
self.after_update()
|
||||
|
@ -1,37 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# status_tab.py
|
||||
#
|
||||
# Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
@ -1,38 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# statusbar.py
|
||||
# Copyright (C) 2007-2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
|
@ -1,42 +1,11 @@
|
||||
#
|
||||
# systemtray.py
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
#
|
||||
|
||||
try:
|
||||
import appindicator
|
||||
except ImportError:
|
||||
appindicator = None
|
||||
|
||||
import logging
|
||||
import os
|
||||
@ -50,6 +19,11 @@ from deluge.configmanager import ConfigManager
|
||||
from deluge.ui.client import client
|
||||
from deluge.ui.gtkui import dialogs
|
||||
|
||||
try:
|
||||
import appindicator
|
||||
except ImportError:
|
||||
appindicator = None
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -77,7 +77,7 @@ class TorrentDetails(component.Component):
|
||||
"Peers": PeersTab,
|
||||
"Options": OptionsTab,
|
||||
"Trackers": TrackersTab
|
||||
}
|
||||
}
|
||||
|
||||
# tab_name, visible
|
||||
default_order = [
|
||||
|
@ -65,8 +65,8 @@ def seed_peer_column_sort(model, iter1, iter2, data):
|
||||
v1 = model[iter1][data] # num seeds/peers
|
||||
v3 = model[iter2][data] # num seeds/peers
|
||||
if v1 == v3:
|
||||
v2 = model[iter1][data+1] # total seeds/peers
|
||||
v4 = model[iter2][data+1] # total seeds/peers
|
||||
v2 = model[iter1][data + 1] # total seeds/peers
|
||||
v4 = model[iter2][data + 1] # total seeds/peers
|
||||
return queue_peer_seed_sort_function(v2, v4)
|
||||
return queue_peer_seed_sort_function(v1, v3)
|
||||
|
||||
|
@ -1,36 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# torrentview_data_funcs.py
|
||||
#
|
||||
# Copyright (C) 2007, 2008 Andrew Resch <andrewresch@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
||||
# the additional special exception to link portions of this program with the OpenSSL library.
|
||||
# See LICENSE for more details.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
|
Loading…
x
Reference in New Issue
Block a user