deluge.ui package¶
Subpackages¶
- deluge.ui.console package
- Subpackages
- deluge.ui.console.commands package
- Submodules
- deluge.ui.console.commands.add module
- deluge.ui.console.commands.cache module
- deluge.ui.console.commands.config module
- deluge.ui.console.commands.connect module
- deluge.ui.console.commands.debug module
- deluge.ui.console.commands.gui module
- deluge.ui.console.commands.halt module
- deluge.ui.console.commands.help module
- deluge.ui.console.commands.info module
- deluge.ui.console.commands.manage module
- deluge.ui.console.commands.move module
- deluge.ui.console.commands.pause module
- deluge.ui.console.commands.plugin module
- deluge.ui.console.commands.quit module
- deluge.ui.console.commands.recheck module
- deluge.ui.console.commands.resume module
- deluge.ui.console.commands.rm module
- deluge.ui.console.commands.status module
- deluge.ui.console.commands.update-tracker module
- Module contents
- deluge.ui.console.modes package
- Submodules
- deluge.ui.console.modes.add_util module
- deluge.ui.console.modes.addtorrents module
- deluge.ui.console.modes.alltorrents module
- deluge.ui.console.modes.basemode module
- deluge.ui.console.modes.column module
- deluge.ui.console.modes.connectionmanager module
- deluge.ui.console.modes.eventview module
- deluge.ui.console.modes.format_utils module
- deluge.ui.console.modes.input_popup module
- deluge.ui.console.modes.legacy module
- deluge.ui.console.modes.popup module
- deluge.ui.console.modes.preference_panes module
- deluge.ui.console.modes.preferences module
- deluge.ui.console.modes.torrent_actions module
- deluge.ui.console.modes.torrentdetail module
- Module contents
- deluge.ui.console.commands package
- Submodules
- deluge.ui.console.colors module
- deluge.ui.console.commander module
- deluge.ui.console.eventlog module
- deluge.ui.console.main module
- deluge.ui.console.statusbars module
- Module contents
- Subpackages
- deluge.ui.gtkui package
- Submodules
- deluge.ui.gtkui.aboutdialog module
- deluge.ui.gtkui.addtorrentdialog module
- deluge.ui.gtkui.common module
- deluge.ui.gtkui.connectionmanager module
- deluge.ui.gtkui.createtorrentdialog module
- deluge.ui.gtkui.details_tab module
- deluge.ui.gtkui.dialogs module
- deluge.ui.gtkui.edittrackersdialog module
- deluge.ui.gtkui.files_tab module
- deluge.ui.gtkui.filtertreeview module
- deluge.ui.gtkui.gtkui module
- deluge.ui.gtkui.ipcinterface module
- deluge.ui.gtkui.listview module
- deluge.ui.gtkui.mainwindow module
- deluge.ui.gtkui.menubar module
- deluge.ui.gtkui.menubar_osx module
- deluge.ui.gtkui.new_release_dialog module
- deluge.ui.gtkui.notification module
- deluge.ui.gtkui.options_tab module
- deluge.ui.gtkui.path_chooser module
- deluge.ui.gtkui.path_combo_chooser module
- deluge.ui.gtkui.peers_tab module
- deluge.ui.gtkui.piecesbar module
- deluge.ui.gtkui.pluginmanager module
- deluge.ui.gtkui.preferences module
- deluge.ui.gtkui.queuedtorrents module
- deluge.ui.gtkui.removetorrentdialog module
- deluge.ui.gtkui.sidebar module
- deluge.ui.gtkui.status_tab module
- deluge.ui.gtkui.statusbar module
- deluge.ui.gtkui.systemtray module
- deluge.ui.gtkui.toolbar module
- deluge.ui.gtkui.torrentdetails module
- deluge.ui.gtkui.torrentview module
- deluge.ui.gtkui.torrentview_data_funcs module
- Module contents
- deluge.ui.web package
Submodules¶
deluge.ui.Win32IconImagePlugin module¶
deluge.ui.client module¶
- class deluge.ui.client.Client¶
Bases: object
This class is used to connect to a daemon process and issue RPC requests.
- auth_levels_mapping¶
- auth_levels_mapping_reverse¶
- connect(host='127.0.0.1', port=58846, username='', password='', skip_authentication=False)¶
Connects to a daemon process.
Parameters: - host – str, the hostname of the daemon
- port – int, the port of the daemon
- username – str, the username to login with
- password – str, the password to login with
Returns: a Deferred object that will be called once the connection has been established or fails
- connected()¶
Check to see if connected to a daemon.
Returns: bool, True if connected
- connection_info()¶
Get some info about the connection or return None if not connected.
Returns: a tuple of (host, port, username) or None if not connected
- deregister_event_handler(event, handler)¶
Deregisters a event handler.
Parameters: - event – str, the name of the event
- handler – function, the function registered
- disconnect()¶
Disconnects from the daemon.
- force_call(block=False)¶
- get_auth_level()¶
Returns the authentication level the daemon returned upon authentication.
Returns: the authentication level Return type: int
- get_auth_user()¶
Returns the current authenticated username.
Returns: the authenticated username Return type: str
- get_bytes_recv()¶
Returns the number of bytes received from the daemon.
Returns: the number of bytes received Return type: int
- get_bytes_sent()¶
Returns the number of bytes sent to the daemon.
Returns: the number of bytes sent Return type: int
- is_classicmode()¶
Checks to see if the client has been started in classic mode.
Returns: bool, True if in classic mode
- is_localhost()¶
Checks if the current connected host is a localhost or not.
Returns: bool, True if connected to a localhost
- register_event_handler(event, handler)¶
Registers a handler that will be called when an event is received from the daemon.
Params event: str, the event to handle Params handler: func, the handler function, f(args)
- set_disconnect_callback(cb)¶
Set a function to be called whenever the client is disconnected from the daemon for any reason.
- start_classic_mode()¶
Starts a daemon in the same process as the client.
- start_daemon(port, config)¶
Starts a daemon process.
Parameters: - port (int) – the port for the daemon to listen on
- config (str) – the path to the current config folder
Returns: True if started, False if not
Return type: bool
Raises OSError: received from subprocess.call()
- stop_classic_mode()¶
Stops the daemon process in the client.
- class deluge.ui.client.DaemonClassicProxy(event_handlers=None)¶
Bases: deluge.ui.client.DaemonProxy
- call(method, *args, **kwargs)¶
- deregister_event_handler(event, handler)¶
Deregisters a event handler.
Parameters: - event (str) – the name of the event
- handler (function) – the function registered
- disconnect()¶
- register_event_handler(event, handler)¶
Registers a handler function to be called when :param:event is received from the daemon.
Parameters: - event (str) – the name of the event to handle
- handler (function) – the function to be called when :param:event is emitted from the daemon
- class deluge.ui.client.DaemonProxy¶
Bases: object
- class deluge.ui.client.DaemonSSLProxy(event_handlers=None)¶
Bases: deluge.ui.client.DaemonProxy
- authenticate(username, password)¶
- call(method, *args, **kwargs)¶
Makes a RPCRequest to the daemon. All methods should be in the form of ‘component.method’.
Params method: str, the method to call in the form of ‘component.method’ Params args: the arguments to call the remote method with Params kwargs: the keyword arguments to call the remote method with Returns: a twisted.Deferred object that will be activated when a RPCResponse or RPCError is received from the daemon
- connect(host, port)¶
Connects to a daemon at host:port
Parameters: - host – str, the host to connect to
- port – int, the listening port on the daemon
Returns: twisted.Deferred
- deregister_event_handler(event, handler)¶
Deregisters a event handler.
Parameters: - event (str) – the name of the event
- handler (function) – the function registered
- disconnect()¶
- get_bytes_recv()¶
- get_bytes_sent()¶
- pop_deferred(request_id)¶
Pops a Deferred object. This is generally called once we receive the reply we were waiting on from the server.
Parameters: request_id (int) – the request_id of the Deferred to pop
- register_event_handler(event, handler)¶
Registers a handler function to be called when :param:event is received from the daemon.
Parameters: - event (str) – the name of the event to handle
- handler (function) – the function to be called when :param:event is emitted from the daemon
- set_disconnect_callback(cb)¶
Set a function to be called when the connection to the daemon is lost for any reason.
- class deluge.ui.client.DelugeRPCClientFactory(daemon, event_handlers)¶
Bases: twisted.internet.protocol.ClientFactory
- clientConnectionFailed(connector, reason)¶
- clientConnectionLost(connector, reason)¶
- protocol¶
alias of DelugeRPCProtocol
- startedConnecting(connector)¶
- class deluge.ui.client.DelugeRPCProtocol¶
Bases: deluge.transfer.DelugeTransferProtocol
- connectionMade()¶
- message_received(request)¶
This method is called whenever we receive a message from the daemon.
Parameters: request – a tuple that should be either a RPCResponse, RCPError or RPCSignal
- send_request(request)¶
Sends a RPCRequest to the server.
Parameters: request – RPCRequest
- class deluge.ui.client.DelugeRPCRequest¶
Bases: object
This object is created whenever there is a RPCRequest to be sent to the daemon. It is generally only used by the DaemonProxy’s call method.
- __repr__()¶
- Returns a string of the RPCRequest in the following form:
- method(arg, kwarg=foo, ...)
- args = None¶
- format_message()¶
Returns a properly formatted RPCRequest based on the properties. Will raise a TypeError if the properties haven’t been set yet.
Returns: a properly formated RPCRequest
- kwargs = None¶
- method = None¶
- request_id = None¶
- class deluge.ui.client.DottedObject(daemon, method)¶
Bases: object
This is used for dotted name calls to client
- class deluge.ui.client.RemoteMethod(daemon, method)¶
Bases: deluge.ui.client.DottedObject
This is used when something like ‘client.core.get_something()’ is attempted.
- deluge.ui.client.client¶
This class is used to connect to a daemon process and issue RPC requests.
- deluge.ui.client.format_kwargs(kwargs)¶
deluge.ui.common module¶
The ui common module contains methods and classes that are deemed useful for all the interfaces.
- class deluge.ui.common.FileTree(paths)¶
Bases: object
Convert a list of paths in a file tree.
Parameters: paths (list) – The paths to be converted. - get_tree()¶
Return the tree, after first converting all file lists to a tuple.
Returns: the file tree. Return type: dictionary
- walk(callback)¶
Walk through the file tree calling the callback function on each item contained.
Parameters: callback (function) – The function to be used as a callback, it should have the signature func(item, path) where item is a tuple for a file and dict for a directory.
- class deluge.ui.common.FileTree2(paths)¶
Bases: object
Converts a list of paths in to a file tree.
Parameters: paths (list) – The paths to be converted - get_tree()¶
Return the tree.
Returns: the file tree. Return type: dictionary
- walk(callback)¶
Walk through the file tree calling the callback function on each item contained.
Parameters: callback (function) – The function to be used as a callback, it should have the signature func(item, path) where item is a tuple for a file and dict for a directory.
- class deluge.ui.common.TorrentInfo(filename, filetree=1)¶
Bases: object
Collects information about a torrent file.
Parameters: filename (string) – The path to the torrent - as_dict(*keys)¶
Return the torrent info as a dictionary, only including the passed in keys.
Parameters: keys (string) – a number of key strings
- filedata¶
The torrents file data. This will be the bencoded dictionary read from the torrent file.
Return type: string
- files¶
A list of the files that the torrent contains.
Return type: list
- files_tree¶
A dictionary based tree of the files.
{ "some_directory": { "some_file": (index, size, download) } }
Return type: dictionary
- info_hash¶
The torrents info_hash
Return type: string
- metadata¶
The torrents metadata.
Return type: dictionary
- name¶
The name of the torrent.
Return type: string
- deluge.ui.common.get_localhost_auth()¶
Grabs the localclient auth line from the ‘auth’ file and creates a localhost uri
Returns: with the username and password to login as Return type: tuple
deluge.ui.coreconfig module¶
- class deluge.ui.coreconfig.CoreConfig¶
Bases: deluge.component.Component
- start()¶
- stop()¶
deluge.ui.countries module¶
deluge.ui.languages module¶
deluge.ui.sessionproxy module¶
- class deluge.ui.sessionproxy.SessionProxy¶
Bases: deluge.component.Component
The SessionProxy component is used to cache session information client-side to reduce the number of RPCs needed to provide a rich user interface.
It will query the Core for only changes in the status of the torrents and will try to satisfy client requests from the cache.
- create_status_dict(torrent_ids, keys)¶
Creates a status dict from the cache.
Parameters: - torrent_ids (list of strings) – the torrent_ids
- keys (list of strings) – the status keys
Returns: a dict with the status information for the torrent_ids
Return type: dict
- get_torrent_status(torrent_id, keys)¶
Get a status dict for one torrent.
Parameters: - torrent_id (string) – the torrent_id
- keys (list of strings) – the status keys
Returns: a dict of status information
Return type: dict
- get_torrents_status(filter_dict, keys)¶
Get a dict of torrent statuses.
The filter can take 2 keys, state and id. The state filter can be one of the torrent states or the special one Active. The id key is simply a list of torrent_ids.
Parameters: - filter_dict (dict) – the filter used for this query
- keys (list of strings) – the status keys
Returns: a dict of torrent_ids and their status dicts
Return type: dict
- on_torrent_added(torrent_id, from_state)¶
- on_torrent_removed(torrent_id)¶
- on_torrent_state_changed(torrent_id, state)¶
- start()¶
- stop()¶
deluge.ui.tracker_icons module¶
- class deluge.ui.tracker_icons.FaviconParser¶
Bases: HTMLParser.HTMLParser
A HTMLParser which extracts favicons from a HTML page
- get_icons()¶
Returns a list of favicons extracted from the HTML page
Returns: a list of favicons Return type: list
- handle_endtag(tag)¶
- handle_starttag(tag, attrs)¶
- exception deluge.ui.tracker_icons.InvalidIconError¶
Bases: exceptions.Exception
- exception deluge.ui.tracker_icons.NoIconsError¶
Bases: exceptions.Exception
- class deluge.ui.tracker_icons.TrackerIcon(filename)¶
Bases: object
Represents a tracker’s icon
- __eq__(other)¶
Compares this TrackerIcon with another to determine if they’re equal
Parameters: other (TrackerIcon) – the TrackerIcon to compare to Returns: whether or not they’re equal Return type: boolean
- get_cached_icon()¶
Returns the cached icon data.
- get_data()¶
Returns the TrackerIcon’s image data as a string
Returns: the image data Return type: string
- get_filename(full=True)¶
Returns the TrackerIcon image’s filename
Parameters: full (boolean) – an (optional) arg to indicate whether or not to return the full path Returns: the path of the TrackerIcon’s image Return type: string
- get_mimetype()¶
Returns the mimetype of this TrackerIcon’s image
Returns: the mimetype of the image Return type: string
- set_cached_icon(data)¶
Set the cached icon data.
- class deluge.ui.tracker_icons.TrackerIcons(icon_dir=None, no_icon=None)¶
Bases: deluge.component.Component
A TrackerIcon factory class
- check_icon_is_valid(*args, **kwargs)¶
Performs a sanity check on icon_name
Parameters: icon_name (string) – the name of the icon to check Returns: the name of the validated icon Return type: string Raises: InvalidIconError
- download_icon(icons, host)¶
Downloads the first available icon from icons
Parameters: - icons (list) – a list of icons
- host (string) – the tracker’s host name
Returns: a Deferred which fires with the downloaded icon’s filename
Return type: Deferred
- download_page(host, url=None)¶
Downloads a tracker host’s page If no url is provided, it bases the url on the host
Parameters: - host (string) – the tracker host
- url (string) – the (optional) url of the host
Returns: the filename of the tracker host’s page
Return type: Deferred
- fetch(host)¶
Fetches (downloads) the icon for the given host. When the icon is downloaded a callback is fired on the the queue of callers to this function.
Parameters: host (string) – the host to obtain the TrackerIcon for Returns: a Deferred which fires with the TrackerIcon for the given host Return type: Deferred
- get(host)¶
Returns a TrackerIcon for the given tracker’s host from the icon cache.
Parameters: host (string) – the host for the TrackerIcon Returns: the TrackerIcon for the host Return type: TrackerIcon
- has(host)¶
Returns True or False if the tracker icon for the given host exists or not.
Parameters: host (string) – the host for the TrackerIcon Returns: True or False Return type: bool
- host_to_url(host)¶
Given a host, returns the URL to fetch
Parameters: host (string) – the tracker host Returns: the url of the tracker Return type: string
- on_download_icon_complete(icon_name, host)¶
Runs any download cleanup functions
Parameters: - icon_name (string) – the filename of the icon that finished downloading
- host (string) – the host the icon completed to download for
Returns: the icon that finished downloading
Return type: TrackerIcon
- on_download_icon_fail(f, host, icons=[])¶
Recovers from a download error
Parameters: - f (Failure) – the failure that occurred
- host (string) – the host the icon failed to download for
- icons (list) – the (optional) list of remaining icons
Returns: a Deferred if recovery was possible else the original failure
Return type: Deferred or Failure
- on_download_page_complete(page)¶
Runs any download clean up functions
Parameters: page (string) – the page that finished downloading Returns: the page that finished downloading Return type: string
- on_download_page_fail(f, host)¶
Recovers from download error
Parameters: - f (Failure) – the failure that occurred
- host (string) – the name of the host whose page failed to download
Returns: a Deferred if recovery was possible else the original failure
Return type: Deferred or Failure
- on_parse_complete(icons, host)¶
Runs any parse clean up functions
Parameters: - icons (list) – the icons that were extracted from the page
- host (string) – the host the icons are for
Returns: the icons that were extracted from the page
Return type: list
- on_parse_fail(f)¶
Recovers from a parse error
Parameters: f (Failure) – the failure that occurred Returns: a Deferred if recovery was possible else the original failure Return type: Deferred or Failure
- parse_html_page(*args, **kwargs)¶
Parses the html page for favicons
Parameters: page (string) – the page to parse Returns: a Deferred which callbacks a list of available favicons (url, type) Return type: Deferred
- resize_icon(*args, **kwargs)¶
Resizes the given icon to be 16x16 pixels
Parameters: icon (TrackerIcon) – the icon to resize Returns: the resized icon Return type: TrackerIcon
- store_icon(icon, host)¶
Stores the icon for the given host Callbacks any pending deferreds waiting on this icon
Parameters: - icon (TrackerIcon or None) – the icon to store
- host (string) – the host to store it for
Returns: the stored icon
Return type: TrackerIcon or None
- deluge.ui.tracker_icons.extension_to_mimetype(extension)¶
Given a filename extension, returns the appropriate mimetype
Parameters: extension (string) – the filename extension Returns: the mimetype for the given filename extension Return type: string Raises KeyError: if given an invalid filename extension
- deluge.ui.tracker_icons.host_to_icon_name(host, mimetype)¶
Given a host, returns the appropriate icon name
Parameters: - host (string) – the host in question
- mimetype (string) – the mimetype of the icon
Returns: the icon’s filename
Return type: string
- deluge.ui.tracker_icons.icon_name_to_host(icon)¶
Given a host’s icon name, returns the host name
Parameters: icon (string) – the icon name Returns: the host name Return type: string
- deluge.ui.tracker_icons.mimetype_to_extension(mimetype)¶
Given a mimetype, returns the appropriate filename extension
Parameters: mimetype (string) – the mimetype Returns: the filename extension for the given mimetype Return type: string Raises KeyError: if given an invalid mimetype
- deluge.ui.tracker_icons.url_to_host(url)¶
Given a URL, returns the host it belongs to
Parameters: url (string) – the URL in question Returns: the host of the given URL Return type: string
deluge.ui.ui module¶
- class deluge.ui.ui.UI(options, args, ui_args)¶
- deluge.ui.ui.setproctitle(t)¶
- deluge.ui.ui.version_callback(option, opt_str, value, parser)¶