mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-05 16:08:40 +00:00
[GTKUI] Show magnet info in Add and Queued dialogs
* Use tooltip to show orginal torrent path or magnet uri
This commit is contained in:
parent
8345237dcc
commit
19d1afdce0
2 changed files with 15 additions and 19 deletions
|
@ -8,6 +8,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import cgi
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from urlparse import urljoin
|
from urlparse import urljoin
|
||||||
|
@ -68,7 +69,6 @@ class AddTorrentDialog(component.Component):
|
||||||
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled
|
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled
|
||||||
})
|
})
|
||||||
|
|
||||||
self.torrent_liststore = gtk.ListStore(str, str, str)
|
|
||||||
# download?, path, filesize, sequence number, inconsistent?
|
# download?, path, filesize, sequence number, inconsistent?
|
||||||
self.files_treestore = gtk.TreeStore(
|
self.files_treestore = gtk.TreeStore(
|
||||||
bool, str, gobject.TYPE_UINT64, gobject.TYPE_INT64, bool, str)
|
bool, str, gobject.TYPE_UINT64, gobject.TYPE_INT64, bool, str)
|
||||||
|
@ -112,7 +112,9 @@ class AddTorrentDialog(component.Component):
|
||||||
column.set_cell_data_func(render, cell_data_size, 2)
|
column.set_cell_data_func(render, cell_data_size, 2)
|
||||||
self.listview_files.append_column(column)
|
self.listview_files.append_column(column)
|
||||||
|
|
||||||
|
self.torrent_liststore = gtk.ListStore(str, str, str)
|
||||||
self.listview_torrents.set_model(self.torrent_liststore)
|
self.listview_torrents.set_model(self.torrent_liststore)
|
||||||
|
self.listview_torrents.set_tooltip_column(2)
|
||||||
self.listview_files.set_model(self.files_treestore)
|
self.listview_files.set_model(self.files_treestore)
|
||||||
|
|
||||||
self.listview_files.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
self.listview_files.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||||
|
@ -223,24 +225,13 @@ class AddTorrentDialog(component.Component):
|
||||||
new_row = None
|
new_row = None
|
||||||
|
|
||||||
for uri in uris:
|
for uri in uris:
|
||||||
s = uri.split("&")[0][20:]
|
magnet = deluge.common.get_magnet_info(uri)
|
||||||
if len(s) == 32:
|
if magnet["info_hash"] in self.infos:
|
||||||
info_hash = base64.b32decode(s).encode("hex")
|
log.info("Torrent already in Add Dialog list!")
|
||||||
elif len(s) == 40:
|
|
||||||
info_hash = s
|
|
||||||
if info_hash in self.infos:
|
|
||||||
log.debug("Torrent already in list!")
|
|
||||||
continue
|
continue
|
||||||
name = None
|
new_row = self.torrent_liststore.append([magnet["info_hash"], magnet["name"], cgi.escape(uri)])
|
||||||
for i in uri.split("&"):
|
self.files[magnet["info_hash"]] = magnet["files_tree"]
|
||||||
if i[:3] == "dn=":
|
self.infos[magnet["info_hash"]] = None
|
||||||
name = "%s (%s)" % (i.split("=")[1], uri)
|
|
||||||
if not name:
|
|
||||||
name = uri
|
|
||||||
new_row = self.torrent_liststore.append(
|
|
||||||
[info_hash, name, uri])
|
|
||||||
self.files[info_hash] = []
|
|
||||||
self.infos[info_hash] = None
|
|
||||||
self.listview_torrents.get_selection().select_iter(new_row)
|
self.listview_torrents.get_selection().select_iter(new_row)
|
||||||
self.set_default_options()
|
self.set_default_options()
|
||||||
self.save_torrent_options(new_row)
|
self.save_torrent_options(new_row)
|
||||||
|
|
|
@ -51,6 +51,7 @@ class QueuedTorrents(component.Component):
|
||||||
|
|
||||||
self.liststore = gtk.ListStore(str, str)
|
self.liststore = gtk.ListStore(str, str)
|
||||||
self.treeview.set_model(self.liststore)
|
self.treeview.set_model(self.liststore)
|
||||||
|
self.treeview.set_tooltip_column(1)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.dialog.set_transient_for(component.get("MainWindow").window)
|
self.dialog.set_transient_for(component.get("MainWindow").window)
|
||||||
|
@ -84,7 +85,11 @@ class QueuedTorrents(component.Component):
|
||||||
# Update the liststore
|
# Update the liststore
|
||||||
self.liststore.clear()
|
self.liststore.clear()
|
||||||
for torrent in self.queue:
|
for torrent in self.queue:
|
||||||
self.liststore.append([os.path.split(torrent)[1], torrent])
|
if deluge.common.is_magnet(torrent):
|
||||||
|
magnet = deluge.common.get_magnet_info(torrent)
|
||||||
|
row = self.liststore.append([magnet["name"], torrent])
|
||||||
|
else:
|
||||||
|
self.liststore.append([os.path.split(torrent)[1], torrent])
|
||||||
|
|
||||||
# Update the status bar
|
# Update the status bar
|
||||||
self.update_status_bar()
|
self.update_status_bar()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue