Update the about dialog and have it show the core version and libtorrent version

This commit is contained in:
Andrew Resch 2009-09-19 00:18:14 +00:00
commit 3f8441af6a
2 changed files with 50 additions and 24 deletions

View file

@ -260,7 +260,7 @@ class Core(component.Component):
:type uri: string :type uri: string
:param options: the options to apply to the torrent on add :param options: the options to apply to the torrent on add
:type options: dict :type options: dict
:returns: the torrent_id :returns: the torrent_id
:rtype: string :rtype: string
@ -280,9 +280,9 @@ class Core(component.Component):
:type remove_data: boolean :type remove_data: boolean
:returns: True if removed successfully :returns: True if removed successfully
:rtype: bool :rtype: bool
:raises InvalidTorrentError: if the torrent_id does not exist in the session :raises InvalidTorrentError: if the torrent_id does not exist in the session
""" """
log.debug("Removing torrent %s from the core.", torrent_id) log.debug("Removing torrent %s from the core.", torrent_id)
return self.torrentmanager.remove(torrent_id, remove_data) return self.torrentmanager.remove(torrent_id, remove_data)
@ -291,7 +291,7 @@ class Core(component.Component):
def get_stats(self): def get_stats(self):
""" """
Deprecated: please use get_session_status() Deprecated: please use get_session_status()
""" """
warnings.warn("Use get_session_status() instead of get_stats()", DeprecationWarning) warnings.warn("Use get_session_status() instead of get_stats()", DeprecationWarning)
stats = self.get_session_status(["payload_download_rate", "payload_upload_rate", stats = self.get_session_status(["payload_download_rate", "payload_upload_rate",
@ -674,20 +674,20 @@ class Core(component.Component):
def rename_files(self, torrent_id, filenames): def rename_files(self, torrent_id, filenames):
""" """
Rename files in torrent_id. Since this is an asynchronous operation by Rename files in torrent_id. Since this is an asynchronous operation by
libtorrent, watch for the TorrentFileRenamedEvent to know when the libtorrent, watch for the TorrentFileRenamedEvent to know when the
files have been renamed. files have been renamed.
:param torrent_id: the torrent_id to rename files :param torrent_id: the torrent_id to rename files
:type torrent_id: string :type torrent_id: string
:param filenames: a list of index, filename pairs :param filenames: a list of index, filename pairs
:type filenames: ((index, filename), ...) :type filenames: ((index, filename), ...)
:raises InvalidTorrentError: if torrent_id is invalid :raises InvalidTorrentError: if torrent_id is invalid
""" """
if torrent_id not in self.torrentmanager.torrents: if torrent_id not in self.torrentmanager.torrents:
raise InvalidTorrentError("torrent_id is not in session") raise InvalidTorrentError("torrent_id is not in session")
self.torrentmanager[torrent_id].rename_files(filenames) self.torrentmanager[torrent_id].rename_files(filenames)
@export @export
@ -696,20 +696,20 @@ class Core(component.Component):
Renames the 'folder' to 'new_folder' in 'torrent_id'. Watch for the Renames the 'folder' to 'new_folder' in 'torrent_id'. Watch for the
TorrentFolderRenamedEvent which is emitted when the folder has been TorrentFolderRenamedEvent which is emitted when the folder has been
renamed successfully. renamed successfully.
:param torrent_id: the torrent to rename folder in :param torrent_id: the torrent to rename folder in
:type torrent_id: string :type torrent_id: string
:param folder: the folder to rename :param folder: the folder to rename
:type folder: string :type folder: string
:param new_folder: the new folder name :param new_folder: the new folder name
:type new_folder: string :type new_folder: string
:raises InvalidTorrentError: if the torrent_id is invalid :raises InvalidTorrentError: if the torrent_id is invalid
""" """
if torrent_id not in self.torrentmanager.torrents: if torrent_id not in self.torrentmanager.torrents:
raise InvalidTorrentError("torrent_id is not in session") raise InvalidTorrentError("torrent_id is not in session")
self.torrentmanager[torrent_id].rename_folder(folder, new_folder) self.torrentmanager[torrent_id].rename_folder(folder, new_folder)
@export @export
@ -770,13 +770,13 @@ class Core(component.Component):
def test_listen_port(self): def test_listen_port(self):
""" """
Checks if the active port is open Checks if the active port is open
:returns: True if the port is open, False if not :returns: True if the port is open, False if not
:rtype: bool :rtype: bool
""" """
from twisted.web.client import getPage from twisted.web.client import getPage
d = getPage("http://deluge-torrent.org/test_port.php?port=%s" % self.get_listen_port()) d = getPage("http://deluge-torrent.org/test_port.php?port=%s" % self.get_listen_port())
def on_get_page(result): def on_get_page(result):
@ -790,14 +790,25 @@ class Core(component.Component):
def get_free_space(self, path): def get_free_space(self, path):
""" """
Returns the number of free bytes at path Returns the number of free bytes at path
:param path: the path to check free space at :param path: the path to check free space at
:type path: string :type path: string
:returns: the number of free bytes at path :returns: the number of free bytes at path
:rtype: int :rtype: int
:raises InvalidPathError: if the path is invalid :raises InvalidPathError: if the path is invalid
""" """
return deluge.common.free_space(path) return deluge.common.free_space(path)
@export
def get_libtorrent_version(self):
"""
Returns the libtorrent version.
:returns: the version
:rtype: string
"""
return lt.version

File diff suppressed because one or more lines are too long