Now, when the authentication dialog appears, user fills in the password and hits ENTER, the authentication call will be made.

Implement tooltips on treeview's headers when adding columns.
Renamed the "public" state of a torrent to "shared", ie, shared among other deluge users. Allow changing shared state from clients and currently from the    GtkUi.
This commit is contained in:
Pedro Algarvio 2010-12-23 13:46:32 +00:00
parent e63c33c496
commit fe12552590
12 changed files with 257 additions and 142 deletions

View File

@ -599,6 +599,13 @@ class Core(component.Component):
self.torrentmanager[torrent_id].set_owner(username)
return None
@export
def set_torrents_shared(self, torrent_ids, shared):
if isinstance(torrent_ids, basestring):
torrent_ids = [torrent_ids]
for torrent_id in torrent_ids:
self.torrentmanager[torrent_id].set_options({"shared": shared})
@export
def get_path_size(self, path):
"""Returns the size of the file or folder 'path' and -1 if the path is

View File

@ -142,7 +142,7 @@ DEFAULT_PREFS = {
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
"cache_size": 512,
"cache_expiry": 60,
"public": False
"shared": False
}
class PreferencesManager(component.Component):
@ -150,6 +150,11 @@ class PreferencesManager(component.Component):
component.Component.__init__(self, "PreferencesManager")
self.config = deluge.configmanager.ConfigManager("core.conf", DEFAULT_PREFS)
if 'public' in self.config:
log.debug("Updating configuration file: Renamed torrent's public "
"attribute to shared.")
self.config["shared"] = self.config["public"]
del self.config["public"]
def start(self):
self.core = component.get("Core")

View File

@ -69,7 +69,7 @@ class TorrentOptions(dict):
"move_completed": "move_completed",
"move_completed_path": "move_completed_path",
"add_paused": "add_paused",
"public": "public"
"shared": "shared"
}
for opt_k, conf_k in options_conf_map.iteritems():
self[opt_k] = config[conf_k]
@ -610,7 +610,7 @@ class Torrent(object):
"paused": self.status.paused,
"prioritize_first_last": self.options["prioritize_first_last_pieces"],
"progress": progress,
"public": self.options["public"],
"shared": self.options["shared"],
"remove_at_ratio": self.options["remove_at_ratio"],
"save_path": self.options["download_location"],
"seeding_time": self.status.seeding_time,

View File

@ -86,7 +86,7 @@ class TorrentState:
magnet=None,
time_added=-1,
owner="",
public=False
shared=False
):
self.torrent_id = torrent_id
self.filename = filename
@ -114,7 +114,7 @@ class TorrentState:
self.remove_at_ratio = remove_at_ratio
self.move_completed = move_completed
self.move_completed_path = move_completed_path
self.public = public
self.shared = shared
class TorrentManagerState:
def __init__(self):
@ -286,8 +286,8 @@ class TorrentManager(component.Component):
current_user = component.get("RPCServer").get_session_user()
for torrent_id in torrent_ids[:]:
torrent_status = self[torrent_id].get_status(["owner", "public"])
if torrent_status["owner"] != current_user and torrent_status["public"] == False:
torrent_status = self[torrent_id].get_status(["owner", "shared"])
if torrent_status["owner"] != current_user and torrent_status["shared"] == False:
torrent_ids.pop(torrent_ids.index(torrent_id))
return torrent_ids
@ -368,7 +368,7 @@ class TorrentManager(component.Component):
options["move_completed"] = state.move_completed
options["move_completed_path"] = state.move_completed_path
options["add_paused"] = state.paused
options["public"] = state.public
options["shared"] = state.shared
ti = self.get_torrent_info_from_file(
os.path.join(get_config_dir(),
@ -662,7 +662,7 @@ class TorrentManager(component.Component):
torrent.magnet,
torrent.time_added,
torrent.owner,
torrent.options["public"]
torrent.options["shared"]
)
state.torrents.append(torrent_state)

View File

@ -66,7 +66,7 @@ class DetailsTab(Tab):
(glade.get_widget("summary_hash"), str, ("hash",)),
(glade.get_widget("summary_comments"), str, ("comment",)),
(glade.get_widget("summary_owner"), str, ("owner",)),
(glade.get_widget("summary_public"), str, ("public",))
(glade.get_widget("summary_shared"), str, ("shared",))
]
def update(self):
@ -82,9 +82,9 @@ class DetailsTab(Tab):
return
# Get the torrent status
status_keys = ["name", "total_size", "num_files",
"tracker", "save_path", "message", "hash", "comment", "owner",
"public"]
status_keys = ["name", "total_size", "num_files", "tracker",
"save_path", "message", "hash", "comment", "owner",
"shared"]
session = component.get("SessionProxy")
session.get_torrent_status(selected, status_keys).addCallback(self._on_get_torrent_status)

View File

@ -223,6 +223,7 @@ class AuthenticationDialog(BaseDialog):
self.password_label.set_padding(5, 5)
self.password_entry = gtk.Entry()
self.password_entry.set_visibility(False)
self.password_entry.connect("activate", self.on_password_activate)
table.attach(self.password_label, 0, 1, 1, 2)
table.attach(self.password_entry, 1, 2, 1, 2)
@ -241,3 +242,6 @@ class AuthenticationDialog(BaseDialog):
def get_password(self):
return self.password_entry.get_text()
def on_password_activate(self, widget):
self.response(gtk.RESPONSE_OK)

View File

@ -39,6 +39,7 @@ import gtk.glade
import logging
import pkg_resources
from twisted.internet import defer
import deluge.common
import common
from deluge.ui.client import client
@ -91,6 +92,10 @@ class EditTrackersDialog:
self.treeview.set_model(self.liststore)
self.liststore.set_sort_column_id(0, gtk.SORT_ASCENDING)
self.dialog.connect("delete-event", self._on_delete_event)
self.dialog.connect("response", self._on_response)
self.changed = False
def run(self):
# Make sure we have a torrent_id.. if not just return
if self.torrent_id == None:
@ -101,6 +106,18 @@ class EditTrackersDialog:
session.get_torrent_status(self.torrent_id, ["trackers"]).addCallback(self._on_get_torrent_status)
client.force_call()
self.deferred = defer.Deferred()
return self.deferred
def _on_delete_event(self, widget, event):
self.deferred.callback(gtk.RESPONSE_DELETE_EVENT)
self.dialog.destroy()
def _on_response(self, widget, response):
self.deferred.callback(response)
self.dialog.destroy()
def _on_get_torrent_status(self, status):
"""Display trackers dialog"""
for tracker in status["trackers"]:
@ -111,6 +128,7 @@ class EditTrackersDialog:
def add_tracker(self, tier, url):
"""Adds a tracker to the list"""
self.liststore.append([tier, url])
self.changed = True
def get_selected(self):
"""Returns the selected tracker"""
@ -125,18 +143,21 @@ class EditTrackersDialog:
new_tier = tier + 1
# Now change the tier for this tracker
self.liststore.set_value(selected, 0, new_tier)
self.changed = True
def on_button_add_clicked(self, widget):
log.debug("on_button_add_clicked")
# Show the add tracker dialog
self.add_tracker_dialog.show()
self.glade.get_widget("textview_trackers").grab_focus()
self.changed = True
def on_button_remove_clicked(self, widget):
log.debug("on_button_remove_clicked")
selected = self.get_selected()
if selected != None:
self.liststore.remove(selected)
self.changed = True
def on_button_edit_clicked(self, widget):
"""edits an existing tracker"""
@ -158,6 +179,7 @@ class EditTrackersDialog:
tracker = self.glade.get_widget("entry_edit_tracker").get_text()
self.liststore.set_value(selected, 1, tracker)
self.edit_tracker_entry.hide()
self.changed = True
def on_button_down_clicked(self, widget):
log.debug("on_button_down_clicked")
@ -170,6 +192,7 @@ class EditTrackersDialog:
new_tier = tier - 1
# Now change the tier for this tracker
self.liststore.set_value(selected, 0, new_tier)
self.changed = True
def on_button_ok_clicked(self, widget):
log.debug("on_button_ok_clicked")
@ -182,11 +205,14 @@ class EditTrackersDialog:
self.liststore.foreach(each, None)
# Set the torrens trackers
client.core.set_torrent_trackers(self.torrent_id, self.trackers)
self.dialog.destroy()
if self.changed:
self.dialog.response(gtk.RESPONSE_OK)
else:
self.dialog.response(gtk.RESPONSE_CANCEL)
def on_button_cancel_clicked(self, widget):
log.debug("on_button_cancel_clicked")
self.dialog.destroy()
self.dialog.response(gtk.RESPONSE_CANCEL)
def on_button_add_ok_clicked(self, widget):
log.debug("on_button_add_ok_clicked")

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Fri Sep 19 19:14:24 2008 -->
<?xml version="1.0"?>
<glade-interface>
<!-- interface-requires gtk+ 2.6 -->
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkDialog" id="edit_trackers_dialog">
<property name="width_request">400</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Edit Trackers</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">400</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -36,6 +36,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -57,6 +58,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -69,9 +71,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<widget class="GtkTreeView" id="tracker_treeview">
<property name="visible">True</property>
@ -80,81 +82,92 @@
</widget>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVButtonBox" id="vbuttonbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">1</property>
<property name="layout_style">GTK_BUTTONBOX_CENTER</property>
<property name="layout_style">center</property>
<child>
<widget class="GtkButton" id="button_up">
<property name="label">gtk-go-up</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-go-up</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_up_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_add">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="no">gtk-add</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_add_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_exit">
<property name="label">gtk-edit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-edit</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_remove">
<property name="label">gtk-remove</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-remove</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_remove_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_down">
<property name="label">gtk-go-down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-go-down</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_down_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
@ -179,38 +192,45 @@
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="button_cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_cancel_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_ok">
<property name="label">gtk-ok</property>
<property name="response_id">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_ok_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>
@ -222,9 +242,9 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Add Tracker</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">dialog</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@ -251,6 +271,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -270,6 +291,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -297,15 +319,16 @@
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<widget class="GtkTextView" id="textview_trackers">
<property name="visible">True</property>
@ -334,40 +357,48 @@
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="button_add_cancel">
<property name="label">gtk-cancel</property>
<property name="response_id">-6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_button_add_cancel_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_add_ok">
<property name="label">gtk-ok</property>
<property name="response_id">-5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="on_button_add_ok_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>
@ -378,9 +409,9 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Edit Tracker</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="type_hint">dialog</property>
<property name="decorated">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@ -407,6 +438,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -426,6 +458,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -452,6 +485,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -483,40 +517,47 @@
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="button_add_cancel1">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_cancel_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_add_ok1">
<property name="label">gtk-ok</property>
<property name="response_id">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_edit_ok_clicked"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>

View File

@ -11,7 +11,6 @@
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkMenuBar" id="menubar">
<property name="visible">True</property>
@ -470,7 +469,6 @@
<child>
<widget class="GtkVPaned" id="vpaned">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHPaned" id="hpaned">
<property name="visible">True</property>
@ -674,7 +672,6 @@
<widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkProgressBar" id="progressbar">
@ -1561,9 +1558,10 @@
<child>
<widget class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Torrent is shared between other Deluge users or not.</property>
<property name="xalign">0</property>
<property name="ypad">1</property>
<property name="label" translatable="yes">&lt;b&gt;Public:&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Shared:&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@ -1589,32 +1587,9 @@
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="summary_public">
<widget class="GtkLabel" id="summary_shared">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Torrent is shared between other Deluge users or not.</property>
<property name="xalign">0</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
@ -1627,6 +1602,30 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
@ -1990,7 +1989,6 @@
<child>
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkCheckButton" id="chk_auto_managed">
<property name="label" translatable="yes">Auto Managed</property>
@ -2008,7 +2006,6 @@
<child>
<widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
@ -2149,7 +2146,6 @@
<child>
<widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
@ -2165,7 +2161,6 @@
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkCheckButton" id="chk_private">
<property name="label" translatable="yes">Private</property>
@ -2173,6 +2168,7 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip" translatable="yes">If checked this torrent won't be shared among trackers, DHT nodes, etc...</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
@ -2195,6 +2191,20 @@
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="chk_shared">
<property name="label" translatable="yes">Shared</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip" translatable="yes">Torrent is shared between other Deluge users or not.</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_chk_shared_toggled"/>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_edit_trackers">
<property name="visible">True</property>
@ -2236,7 +2246,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</widget>
@ -2275,6 +2285,7 @@
<widget class="GtkButton" id="button_apply">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
@ -2357,13 +2368,11 @@
<widget class="GtkVBox" id="dialog-vbox3">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkHBox" id="hbox1">
@ -2555,13 +2564,11 @@
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="border_width">10</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkHBox" id="hbox3">

View File

@ -427,7 +427,7 @@ class ListView:
def add_column(self, header, render, col_types, hidden, position,
status_field, sortid, text=0, value=0, pixbuf=0, function=None,
column_type=None, sort_func=None):
column_type=None, sort_func=None, tooltip=None):
"""Adds a column to the ListView"""
# Add the column types to liststore_columns
column_indices = []
@ -504,6 +504,9 @@ class ListView:
column.connect('button-press-event',
self.on_treeview_header_right_clicked)
if tooltip:
column.get_widget().set_tooltip_markup(tooltip)
# Check for loaded state and apply
if self.state != None:
for column_state in self.state:
@ -514,7 +517,9 @@ class ListView:
column.set_fixed_width(column_state.width)
if column_state.sort is not None and column_state.sort > -1:
self.model_filter.set_sort_column_id(column_state.sort, column_state.sort_order)
self.model_filter.set_sort_column_id(
column_state.sort, column_state.sort_order
)
column.set_visible(column_state.visible)
position = column_state.position
@ -531,76 +536,66 @@ class ListView:
return True
def add_text_column(self, header, col_type=str, hidden=False,
position=None,
status_field=None,
sortid=0,
column_type="text",
sort_func=None):
def add_text_column(self, header, col_type=str, hidden=False, position=None,
status_field=None, sortid=0, column_type="text",
sort_func=None, tooltip=None):
"""Add a text column to the listview. Only the header name is required.
"""
render = gtk.CellRendererText()
self.add_column(header, render, col_type, hidden, position,
status_field, sortid, column_type=column_type, sort_func=sort_func)
status_field, sortid, column_type=column_type,
sort_func=sort_func, tooltip=tooltip)
return True
def add_bool_column(self, header, col_type=bool, hidden=False,
position=None,
status_field=None,
sortid=0,
column_type="bool"):
position=None, status_field=None, sortid=0,
column_type="bool", tooltip=None):
"""Add a bool column to the listview"""
render = gtk.CellRendererToggle()
self.add_column(header, render, col_type, hidden, position,
status_field, sortid, column_type=column_type)
status_field, sortid, column_type=column_type,
tooltip=tooltip)
def add_func_column(self, header, function, col_types, sortid=0,
hidden=False, position=None, status_field=None,
column_type="func", sort_func=None):
hidden=False, position=None, status_field=None,
column_type="func", sort_func=None, tooltip=None):
"""Add a function column to the listview. Need a header name, the
function and the column types."""
render = gtk.CellRendererText()
self.add_column(header, render, col_types, hidden, position,
status_field, sortid, column_type=column_type,
function=function, sort_func=sort_func)
status_field, sortid, column_type=column_type,
function=function, sort_func=sort_func, tooltip=tooltip)
return True
def add_progress_column(self, header, col_types=[float, str],
sortid=0,
hidden=False,
position=None,
status_field=None,
function=None,
column_type="progress"):
def add_progress_column(self, header, col_types=[float, str], sortid=0,
hidden=False, position=None, status_field=None,
function=None, column_type="progress",
tooltip=None):
"""Add a progress column to the listview."""
render = gtk.CellRendererProgress()
self.add_column(header, render, col_types, hidden, position,
status_field, sortid, function=function,
column_type=column_type,
value=0, text=1)
status_field, sortid, function=function,
column_type=column_type, value=0, text=1,
tooltip=tooltip)
return True
def add_texticon_column(self, header, col_types=[str, str],
sortid=1,
hidden=False,
position=None,
status_field=None,
column_type="texticon",
function=None):
def add_texticon_column(self, header, col_types=[str, str], sortid=1,
hidden=False, position=None, status_field=None,
column_type="texticon", function=None,
tooltip=None):
"""Adds a texticon column to the listview."""
render1 = gtk.CellRendererPixbuf()
render2 = gtk.CellRendererText()
self.add_column(header, (render1, render2), col_types, hidden,
position, status_field, sortid,
column_type=column_type, function=function,
pixbuf=0, text=1)
self.add_column(header, (render1, render2), col_types, hidden, position,
status_field, sortid, column_type=column_type,
function=function, pixbuf=0, text=1, tooltip=tooltip)
return True

View File

@ -60,6 +60,8 @@ class OptionsTab(Tab):
self.chk_move_completed = glade.get_widget("chk_move_completed")
self.filechooser_move_completed = glade.get_widget("filechooser_move_completed")
self.entry_move_completed = glade.get_widget("entry_move_completed")
self.chk_shared = glade.get_widget("chk_shared")
self.button_apply = glade.get_widget("button_apply")
self.prev_torrent_id = None
self.prev_status = None
@ -68,7 +70,8 @@ class OptionsTab(Tab):
"on_button_apply_clicked": self._on_button_apply_clicked,
"on_button_edit_trackers_clicked": self._on_button_edit_trackers_clicked,
"on_chk_move_completed_toggled": self._on_chk_move_completed_toggled,
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled
"on_chk_stop_at_ratio_toggled": self._on_chk_stop_at_ratio_toggled,
"on_chk_shared_toggled": self._on_chk_shared_toggled
})
def start(self):
@ -98,8 +101,8 @@ class OptionsTab(Tab):
if torrent_id != self.prev_torrent_id:
self.prev_status = None
component.get("SessionProxy").get_torrent_status(torrent_id,
["max_download_speed",
component.get("SessionProxy").get_torrent_status(torrent_id, [
"max_download_speed",
"max_upload_speed",
"max_connections",
"max_upload_slots",
@ -110,7 +113,9 @@ class OptionsTab(Tab):
"stop_ratio",
"remove_at_ratio",
"move_on_completed",
"move_on_completed_path"]).addCallback(self._on_get_torrent_status)
"move_on_completed_path",
"shared"
]).addCallback(self._on_get_torrent_status)
self.prev_torrent_id = torrent_id
def clear(self):
@ -153,6 +158,11 @@ class OptionsTab(Tab):
self.filechooser_move_completed.set_current_folder(status["move_on_completed_path"])
else:
self.entry_move_completed.set_text(status["move_on_completed_path"])
if status["shared"] != self.prev_status["shared"]:
self.chk_shared.set_active(status["shared"])
if self.button_apply.is_sensitive():
self.button_apply.set_sensitive(False)
self.prev_status = status
@ -183,14 +193,21 @@ class OptionsTab(Tab):
else:
path = self.entry_move_completed.get_text()
client.core.set_torrent_move_completed_path(self.prev_torrent_id, path)
if self.chk_shared.get_active() != self.prev_status["shared"]:
client.core.set_torrents_shared(self.prev_torrent_id, self.chk_shared.get_active())
self.button_apply.set_sensitive(False)
def _on_button_edit_trackers_clicked(self, button):
from edittrackersdialog import EditTrackersDialog
dialog = EditTrackersDialog(
self.prev_torrent_id,
component.get("MainWindow").window)
dialog.run()
def on_response(result):
if result:
self.button_apply.set_sensitive(True)
dialog.run().addCallback(on_response)
def _on_chk_move_completed_toggled(self, widget):
value = self.chk_move_completed.get_active()
@ -201,8 +218,18 @@ class OptionsTab(Tab):
widget.set_sensitive(value)
if not self.button_apply.is_sensitive():
self.button_apply.set_sensitive(True)
def _on_chk_stop_at_ratio_toggled(self, widget):
value = widget.get_active()
self.spin_stop_ratio.set_sensitive(value)
self.chk_remove_at_ratio.set_sensitive(value)
if not self.button_apply.is_sensitive():
self.button_apply.set_sensitive(True)
def _on_chk_shared_toggled(self, widget):
if not self.button_apply.is_sensitive():
self.button_apply.set_sensitive(True)

View File

@ -247,6 +247,9 @@ class TorrentView(listview.ListView, component.Component):
self.add_text_column(_("Owner"), status_field=["owner"])
self.add_bool_column(_("Public"), status_field=["public"])
self.restore_columns_order_from_state()
self.add_bool_column(_("Shared"), status_field=["shared"],
tooltip=_("Torrent is shared between other Deluge "
"users or not."))
# Set filter to None for now
self.filter = None