Registering a signal receiver with the core is done with the clients ip

address.
Minor UI fix-ups.
Hook up autoadd folder options in Preferences.
This commit is contained in:
Andrew Resch 2007-11-25 09:58:12 +00:00
parent fe33a72022
commit fcd70cbb44
13 changed files with 1001 additions and 901 deletions

4
TODO
View File

@ -20,3 +20,7 @@
* Add sidebar for labels and other things.. Plugins should be able to add their * Add sidebar for labels and other things.. Plugins should be able to add their
own section to this. own section to this.
* Option for adding torrents in paused/active state * Option for adding torrents in paused/active state
* Add filtering to torrentview to use with the sidebar
* Fix up preferences for when using a remote host.. the download folders, etc..
* Add decay items to statusbar.. items that will disappear after X seconds

View File

@ -90,7 +90,7 @@ def get_pixmap(fname):
"""Returns a pixmap file included with deluge""" """Returns a pixmap file included with deluge"""
return pkg_resources.resource_filename("deluge", os.path.join("data", \ return pkg_resources.resource_filename("deluge", os.path.join("data", \
"pixmaps", fname)) "pixmaps", fname))
def get_logo(size): def get_logo(size):
"""Returns a deluge logo pixbuf based on the size parameter.""" """Returns a deluge logo pixbuf based on the size parameter."""
import gtk import gtk

View File

@ -79,7 +79,9 @@ DEFAULT_PREFS = {
"max_upload_slots_global": -1, "max_upload_slots_global": -1,
"max_connections_per_torrent": -1, "max_connections_per_torrent": -1,
"max_upload_slots_per_torrent": -1, "max_upload_slots_per_torrent": -1,
"enabled_plugins": [] "enabled_plugins": [],
"autoadd_location": "",
"autoadd_enable": False
} }
class Core( class Core(
@ -90,6 +92,8 @@ class Core(
log.debug("Core init..") log.debug("Core init..")
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.client_address = None
# Get config # Get config
self.config = ConfigManager("core.conf", DEFAULT_PREFS) self.config = ConfigManager("core.conf", DEFAULT_PREFS)
@ -130,6 +134,14 @@ class Core(
gettext.install("deluge", gettext.install("deluge",
pkg_resources.resource_filename( pkg_resources.resource_filename(
"deluge", "i18n")) "deluge", "i18n"))
def get_request(self):
"""Get the request and client address from the socket.
We override this so that we can get the ip address of the client.
"""
request, client_address = self.socket.accept()
self.client_address = client_address[0]
return (request, client_address)
def run(self): def run(self):
"""Starts the core""" """Starts the core"""
@ -230,14 +242,14 @@ class Core(
# Make shutdown an async call # Make shutdown an async call
gobject.idle_add(self._shutdown) gobject.idle_add(self._shutdown)
def export_register_client(self, uri): def export_register_client(self, port):
"""Registers a client with the signal manager so that signals are """Registers a client with the signal manager so that signals are
sent to it.""" sent to it."""
self.signals.register_client(uri) self.signals.register_client(self.client_address, port)
def export_deregister_client(self, uri): def export_deregister_client(self):
"""De-registers a client with the signal manager.""" """De-registers a client with the signal manager."""
self.signals.deregister_client(uri) self.signals.deregister_client(self.client_address)
def export_add_torrent_file(self, filename, save_path, filedump): def export_add_torrent_file(self, filename, save_path, filedump):
"""Adds a torrent file to the libtorrent session """Adds a torrent file to the libtorrent session

View File

@ -39,13 +39,17 @@ class SignalManager:
def __init__(self): def __init__(self):
self.clients = {} self.clients = {}
def deregister_client(self, uri): def deregister_client(self, address):
"""Deregisters a client""" """Deregisters a client"""
log.debug("Deregistering %s as a signal reciever..", uri) log.debug("Deregistering %s as a signal reciever..", address)
del self.clients[uri] for client in self.clients:
if client[:len(address)] == address:
def register_client(self, uri): del self.clients[client]
break
def register_client(self, address, port):
"""Registers a client to emit signals to.""" """Registers a client to emit signals to."""
uri = "http://" + str(address) + ":" + str(port)
log.debug("Registering %s as a signal reciever..", uri) log.debug("Registering %s as a signal reciever..", uri)
self.clients[uri] = xmlrpclib.ServerProxy(uri) self.clients[uri] = xmlrpclib.ServerProxy(uri)

View File

@ -66,9 +66,11 @@ class CoreProxy:
self._core = None self._core = None
return return
if uri != self._uri: if uri != self._uri and self._uri != None:
self._core = None self._core = None
for callback in self._on_no_core_callbacks:
callback()
self._uri = uri self._uri = uri
# Get a new core # Get a new core
self.get_core() self.get_core()

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.0 on Fri Nov 23 19:15:27 2007 --> <!--Generated with glade3 3.4.0 on Sat Nov 24 21:20:04 2007 -->
<glade-interface> <glade-interface>
<widget class="GtkDialog" id="pref_dialog"> <widget class="GtkDialog" id="pref_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -249,34 +249,76 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<widget class="GtkHBox" id="hbox11"> <widget class="GtkVBox" id="vbox9">
<property name="visible">True</property> <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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child> <child>
<widget class="GtkCheckButton" id="chk_autoadd_folder"> <widget class="GtkHBox" id="hbox11">
<property name="visible">True</property> <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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Automatically add torrent files that are placed in this folder.</property> <property name="spacing">5</property>
<property name="label" translatable="yes">Auto Add Folder:</property> <child>
<property name="response_id">0</property> <widget class="GtkCheckButton" id="chk_autoadd_folder">
<property name="draw_indicator">True</property> <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="tooltip" translatable="yes">Automatically add torrent files that are placed in this folder.</property>
<property name="label" translatable="yes">Client Auto Add:</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="autoadd_folder_button">
<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="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget> </widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child> </child>
<child> <child>
<widget class="GtkFileChooserButton" id="autoadd_folder_button"> <widget class="GtkHBox" id="hbox13">
<property name="visible">True</property> <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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property> <property name="spacing">5</property>
<child>
<widget class="GtkCheckButton" id="chk_autoadd_daemon">
<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="label" translatable="yes">Daemon Auto Add:</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry_autoadd_daemon">
<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>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
@ -1036,40 +1078,71 @@ Either</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">15</property> <property name="column_spacing">15</property>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload_slots_global"> <widget class="GtkLabel" id="label16">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="tooltip" translatable="yes">The maximum upload slots for all torrents. Set -1 for unlimited.</property> <property name="xalign">0</property>
<property name="xalign">1</property> <property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</property>
<property name="adjustment">-1 -1 9000 1 10 10</property> </widget>
<property name="climb_rate">1</property> <packing>
<property name="snap_to_ticks">True</property> <property name="top_attach">2</property>
<property name="numeric">True</property> <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Slots:</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload"> <widget class="GtkSpinButton" id="spin_max_connections_global">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property> <property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="max_length">4</property>
<property name="xalign">1</property> <property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property> <property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="digits">1</property> <property name="snap_to_ticks">True</property>
<property name="numeric">True</property> <property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property> <property name="x_options">GTK_FILL</property>
<property name="bottom_attach">3</property> </packing>
</child>
<child>
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Download Speed (KiB/s):</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
@ -1094,74 +1167,43 @@ Either</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label13"> <widget class="GtkSpinButton" id="spin_max_upload">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property> <property name="can_focus">True</property>
<property name="xalign">0</property> <property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Download Speed (KiB/s):</property> <property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="digits">1</property>
<property name="numeric">True</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">1</property> <property name="left_attach">1</property>
<property name="bottom_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_connections_global"> <widget class="GtkSpinButton" id="spin_max_upload_slots_global">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property> <property name="tooltip" translatable="yes">The maximum upload slots for all torrents. Set -1 for unlimited.</property>
<property name="max_length">4</property>
<property name="xalign">1</property> <property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property> <property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property> <property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property> <property name="snap_to_ticks">True</property>
<property name="numeric">True</property> <property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Slots:</property>
</widget>
<packing>
<property name="top_attach">3</property> <property name="top_attach">3</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum number of connections allowed. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum upload speed for all torrents. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -1205,24 +1247,29 @@ Either</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">15</property> <property name="column_spacing">15</property>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload_slots_per_torrent"> <widget class="GtkLabel" id="label18">
<property name="visible">True</property> <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="tooltip" translatable="yes">The maximum upload slots per torrent. Set -1 for unlimited.</property> <property name="xalign">0</property>
<property name="xalign">1</property> <property name="label" translatable="yes">Maximum Upload Slots:</property>
<property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label17">
<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="xalign">0</property>
<property name="label" translatable="yes">Maximum Connections:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_connections_per_torrent"> <widget class="GtkSpinButton" id="spin_max_connections_per_torrent">
<property name="visible">True</property> <property name="visible">True</property>
@ -1240,24 +1287,19 @@ Either</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label17"> <widget class="GtkSpinButton" id="spin_max_upload_slots_per_torrent">
<property name="visible">True</property> <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="can_focus">True</property>
<property name="xalign">0</property> <property name="tooltip" translatable="yes">The maximum upload slots per torrent. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Connections:</property> <property name="xalign">1</property>
</widget> <property name="adjustment">-1 -1 9000 1 10 10</property>
<packing> <property name="climb_rate">1</property>
<property name="x_options">GTK_FILL</property> <property name="snap_to_ticks">True</property>
</packing> <property name="numeric">True</property>
</child>
<child>
<widget class="GtkLabel" id="label18">
<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="xalign">0</property>
<property name="label" translatable="yes">Maximum Upload Slots:</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -1508,33 +1550,15 @@ Either</property>
<property name="n_columns">2</property> <property name="n_columns">2</property>
<property name="column_spacing">10</property> <property name="column_spacing">10</property>
<child> <child>
<widget class="GtkRadioButton" id="radio_open_folder_stock"> <widget class="GtkEntry" id="txt_open_folder_location">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Open folder with:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle"/>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="radio_open_folder_custom">
<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="label" translatable="yes">Custom:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_open_folder_stock</property>
<signal name="toggled" handler="on_toggle"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
@ -1564,20 +1588,38 @@ Thunar</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkEntry" id="txt_open_folder_location"> <widget class="GtkRadioButton" id="radio_open_folder_custom">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Custom:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_open_folder_stock</property>
<signal name="toggled" handler="on_toggle"/>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="bottom_attach">2</property> <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkRadioButton" id="radio_open_folder_stock">
<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="label" translatable="yes">Open folder with:</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle"/>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>

View File

@ -85,7 +85,9 @@ DEFAULT_PREFS = {
"autoconnect": False, "autoconnect": False,
"autoconnect_host_uri": None, "autoconnect_host_uri": None,
"autostart_localhost": False, "autostart_localhost": False,
"autoadd_queued": False "autoadd_queued": False,
"autoadd_enable": False,
"autoadd_location": ""
} }
class GtkUI: class GtkUI:

View File

@ -306,7 +306,7 @@ class ListView:
self.columns[header].column_indices[text]) self.columns[header].column_indices[text])
elif column_type == None: elif column_type == None:
return return
column.set_sort_column_id(self.columns[header].column_indices[sortid]) column.set_sort_column_id(self.columns[header].column_indices[sortid])
column.set_clickable(True) column.set_clickable(True)
column.set_resizable(True) column.set_resizable(True)

View File

@ -158,6 +158,10 @@ class Preferences(component.Component):
("filename", self.core_config["download_location"]), ("filename", self.core_config["download_location"]),
"torrent_files_button": \ "torrent_files_button": \
("filename", self.core_config["torrentfiles_location"]), ("filename", self.core_config["torrentfiles_location"]),
"chk_autoadd_daemon": \
("active", self.core_config["autoadd_enable"]),
"entry_autoadd_daemon": \
("text", self.core_config["autoadd_location"]),
"radio_compact_allocation": \ "radio_compact_allocation": \
("active", self.core_config["compact_allocation"]), ("active", self.core_config["compact_allocation"]),
"radio_full_allocation": \ "radio_full_allocation": \
@ -220,6 +224,8 @@ class Preferences(component.Component):
core_widget_list = [ core_widget_list = [
"download_path_button", "download_path_button",
"torrent_files_button", "torrent_files_button",
"chk_autoadd_daemon",
"entry_autoadd_daemon",
"radio_compact_allocation", "radio_compact_allocation",
"radio_full_allocation", "radio_full_allocation",
"chk_prioritize_first_last_pieces", "chk_prioritize_first_last_pieces",
@ -258,6 +264,10 @@ class Preferences(component.Component):
self.gtkui_config["interactive_add"]) self.gtkui_config["interactive_add"])
self.glade.get_widget("radio_save_all_to").set_active( self.glade.get_widget("radio_save_all_to").set_active(
not self.gtkui_config["interactive_add"]) not self.gtkui_config["interactive_add"])
self.glade.get_widget("chk_autoadd_folder").set_active(
self.gtkui_config["autoadd_enable"])
self.glade.get_widget("autoadd_folder_button").set_filename(
self.gtkui_config["autoadd_location"])
self.glade.get_widget("chk_enable_files_dialog").set_active( self.glade.get_widget("chk_enable_files_dialog").set_active(
self.gtkui_config["enable_files_dialog"]) self.gtkui_config["enable_files_dialog"])
@ -318,6 +328,14 @@ class Preferences(component.Component):
self.glade.get_widget("download_path_button").get_filename() self.glade.get_widget("download_path_button").get_filename()
new_core_config["torrentfiles_location"] = \ new_core_config["torrentfiles_location"] = \
self.glade.get_widget("torrent_files_button").get_filename() self.glade.get_widget("torrent_files_button").get_filename()
new_gtkui_config["autoadd_enable"] = \
self.glade.get_widget("chk_autoadd_folder").get_active()
new_gtkui_config["autoadd_location"] = \
self.glade.get_widget("autoadd_folder_button").get_filename()
new_core_config["autoadd_enable"] = \
self.glade.get_widget("chk_autoadd_daemon").get_active()
new_core_config["autoadd_location"] = \
self.glade.get_widget("entry_autoadd_daemon").get_text()
new_core_config["compact_allocation"] = \ new_core_config["compact_allocation"] = \
self.glade.get_widget("radio_compact_allocation").get_active() self.glade.get_widget("radio_compact_allocation").get_active()
new_core_config["prioritize_first_last_pieces"] = \ new_core_config["prioritize_first_last_pieces"] = \

View File

@ -35,6 +35,7 @@ import gtk
import gtk.glade import gtk.glade
import deluge.ui.component as component import deluge.ui.component as component
import deluge.common
from deluge.log import LOG as log from deluge.log import LOG as log
class SideBar(component.Component): class SideBar(component.Component):
@ -49,9 +50,16 @@ class SideBar(component.Component):
# Create the liststore # Create the liststore
self.liststore = gtk.ListStore(str, gtk.gdk.Pixbuf) self.liststore = gtk.ListStore(str, gtk.gdk.Pixbuf)
self.liststore.append([_("All"), None])
self.liststore.append([_("Downloading"),
gtk.gdk.pixbuf_new_from_file(
deluge.common.get_pixmap("downloading16.png"))])
self.liststore.append([_("Seeding"),
gtk.gdk.pixbuf_new_from_file(
deluge.common.get_pixmap("seeding16.png"))])
# Create the column # Create the column
column = gtk.TreeViewColumn(_("Labels")) column = gtk.TreeViewColumn(_("Labels"))
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
render = gtk.CellRendererPixbuf() render = gtk.CellRendererPixbuf()
column.pack_start(render, expand=False) column.pack_start(render, expand=False)
column.add_attribute(render, 'pixbuf', 1) column.add_attribute(render, 'pixbuf', 1)

View File

@ -55,7 +55,9 @@ class TorrentDetails(component.Component):
# Don't show tabs if there is only 1 # Don't show tabs if there is only 1
if self.notebook.get_n_pages() < 2: if self.notebook.get_n_pages() < 2:
self.notebook.set_show_tabs(False) self.notebook.set_show_tabs(False)
else:
self.notebook.set_show_tabs(True)
self.is_visible = True self.is_visible = True
# Get the labels we need to update. # Get the labels we need to update.

View File

@ -77,15 +77,14 @@ class SignalReceiver(
# Register the signal receiver with the core # Register the signal receiver with the core
# FIXME: send actual URI not localhost # FIXME: send actual URI not localhost
core = client.get_core() core = client.get_core()
core.register_client("http://localhost:" + str(port)) core.register_client(str(port))
def shutdown(self): def shutdown(self):
"""Shutdowns receiver thread""" """Shutdowns receiver thread"""
self._shutdown = True self._shutdown = True
# De-register with the daemon so it doesn't try to send us more signals # De-register with the daemon so it doesn't try to send us more signals
try: try:
client.get_core().deregister_client( client.get_core().deregister_client()
"http://localhost:" + str(self.port))
except (socket.error, AttributeError): except (socket.error, AttributeError):
pass pass