Updates to last patch and updates to the preferences dialog.

This commit is contained in:
Andrew Resch 2007-09-16 04:26:32 +00:00
commit 379eff9767
4 changed files with 233 additions and 223 deletions

View file

@ -64,6 +64,29 @@ def get_default_plugin_dir():
"""Returns the default plugin directory""" """Returns the default plugin directory"""
return os.path.join(get_config_dir(), "plugins") return os.path.join(get_config_dir(), "plugins")
def windows_check():
"""Checks if the current platform is Windows. Returns True if it is Windows
and False if not."""
import platform
if platform.system() in ('Windows', 'Microsoft'):
return True
else:
return False
def get_pixmap(fname):
"""Returns a pixmap file included with deluge"""
return pkg_resources.resource_filename("deluge", os.path.join("data", \
"pixmaps", fname))
def get_logo(size):
"""Returns a deluge logo pixbuf based on the size parameter."""
import gtk
if windows_check():
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.png"), \
size, size)
else:
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \
size, size)
## Formatting text functions ## Formatting text functions
def fsize(fsize_b): def fsize(fsize_b):
@ -116,24 +139,4 @@ def ftime(seconds):
return '%dw %dd' % (weeks, days) return '%dw %dd' % (weeks, days)
return 'unknown' return 'unknown'
def windows_check():
import platform
if platform.system() in ('Windows', 'Microsoft'):
return True
else:
return False
def get_pixmap(fname):
import pkg_resources
from os import path
return pkg_resources.resource_filename("deluge", path.join("data", \
"pixmaps", fname))
def get_logo(size):
import gtk
if windows_check():
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.png"), \
size, size)
else:
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.svg"), \
size, size)

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.2.2 on Sat Sep 15 15:10:00 2007 by andrew@fragment--> <!--Generated with glade3 3.2.0 on Sat Sep 15 20:42:30 2007 by andrew@delicious-->
<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>
@ -38,7 +38,6 @@
</widget> </widget>
<packing> <packing>
<property name="resize">False</property> <property name="resize">False</property>
<property name="shrink">True</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -107,7 +106,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Ask where to save each download</property> <property name="label" translatable="yes">Ask where to save each download</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -123,7 +121,6 @@
<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">Store all downloads in:</property> <property name="tooltip" translatable="yes">Store all downloads in:</property>
<property name="label" translatable="yes">Store all downloads in:</property> <property name="label" translatable="yes">Store all downloads in:</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">radio_ask_save</property> <property name="group">radio_ask_save</property>
@ -196,7 +193,6 @@
<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">Full allocation preallocates all of the space that is needed for the torrent and prevents disk fragmentation</property> <property name="tooltip" translatable="yes">Full allocation preallocates all of the space that is needed for the torrent and prevents disk fragmentation</property>
<property name="label" translatable="yes">Use Full Allocation</property> <property name="label" translatable="yes">Use Full Allocation</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -212,7 +208,6 @@
<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">Compact allocation only allocates space as needed</property> <property name="tooltip" translatable="yes">Compact allocation only allocates space as needed</property>
<property name="label" translatable="yes">Use Compact Allocation</property> <property name="label" translatable="yes">Use Compact Allocation</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">radio_full_allocation</property> <property name="group">radio_full_allocation</property>
</widget> </widget>
@ -265,7 +260,6 @@
<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">Enable selecting files for torrents before loading</property> <property name="tooltip" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="label" translatable="yes">Enable selecting files for torrents before loading</property> <property name="label" translatable="yes">Enable selecting files for torrents before loading</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -279,7 +273,6 @@
<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">Prioritize first and last pieces of files in torrent</property> <property name="tooltip" translatable="yes">Prioritize first and last pieces of files in torrent</property>
<property name="label" translatable="yes">Prioritize first and last pieces of files in torrent</property> <property name="label" translatable="yes">Prioritize first and last pieces of files in torrent</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -443,7 +436,6 @@
<property name="receives_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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Test Active Port</property> <property name="label" translatable="yes">Test Active Port</property>
<property name="response_id">0</property>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -468,7 +460,6 @@
<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">Deluge will automatically choose a different port to use every time.</property> <property name="tooltip" translatable="yes">Deluge will automatically choose a different port to use every time.</property>
<property name="label" translatable="yes">Use Random Ports</property> <property name="label" translatable="yes">Use Random Ports</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle"/> <signal name="toggled" handler="on_toggle"/>
</widget> </widget>
@ -562,7 +553,6 @@
<property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property> <property name="tooltip" translatable="yes">Distributed hash table may improve the amount of active connections.</property>
<property name="label" translatable="yes">Enable Mainline DHT</property> <property name="label" translatable="yes">Enable Mainline DHT</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -609,7 +599,6 @@
<property name="tooltip" translatable="yes">Universal Plug and Play</property> <property name="tooltip" translatable="yes">Universal Plug and Play</property>
<property name="label" translatable="yes">UPnP</property> <property name="label" translatable="yes">UPnP</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -625,7 +614,6 @@
<property name="tooltip" translatable="yes">NAT Port Mapping Protocol</property> <property name="tooltip" translatable="yes">NAT Port Mapping Protocol</property>
<property name="label" translatable="yes">NAT-PMP</property> <property name="label" translatable="yes">NAT-PMP</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -642,7 +630,6 @@
<property name="tooltip" translatable="yes">µTorrent Peer-Exchange</property> <property name="tooltip" translatable="yes">µTorrent Peer-Exchange</property>
<property name="label" translatable="yes">µTorrent-PeX</property> <property name="label" translatable="yes">µTorrent-PeX</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property> <property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
@ -777,7 +764,6 @@ Full Stream</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Prefer to encrypt the entire stream</property> <property name="label" translatable="yes">Prefer to encrypt the entire stream</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
<packing> <packing>
@ -882,71 +868,40 @@ Full Stream</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="GtkLabel" id="label16"> <widget class="GtkSpinButton" id="spin_max_upload_slots_global">
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum upload 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 slots for all torrents. Set -1 for unlimited.</property>
<property name="label" translatable="yes">Maximum Upload Speed (KiB/s):</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="top_attach">2</property> <property name="snap_to_ticks">True</property>
<property name="bottom_attach">3</property> <property name="numeric">True</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_connections_global"> <widget class="GtkSpinButton" id="spin_max_upload">
<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 speed 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="digits">1</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> <property name="top_attach">2</property>
</packing> <property name="bottom_attach">3</property>
</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>
@ -971,43 +926,74 @@ Full Stream</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload"> <widget class="GtkLabel" id="label13">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</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="xalign">1</property> <property name="label" translatable="yes">Maximum Download Speed (KiB/s):</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="left_attach">1</property> <property name="top_attach">1</property>
<property name="right_attach">2</property> <property name="bottom_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_upload_slots_global"> <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 slots 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="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>
@ -1051,29 +1037,24 @@ Full Stream</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="GtkLabel" id="label18"> <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 Upload Slots:</property> <property name="xalign">1</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>
@ -1091,19 +1072,24 @@ Full Stream</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkSpinButton" id="spin_max_upload_slots_per_torrent"> <widget class="GtkLabel" id="label17">
<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 Connections:</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="x_options">GTK_FILL</property>
<property name="numeric">True</property> </packing>
</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>
@ -1207,9 +1193,8 @@ Full Stream</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Enable system tray icon</property> <property name="label" translatable="yes">Enable system tray icon</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle"/>
</widget> </widget>
</child> </child>
<child> <child>
@ -1222,7 +1207,6 @@ Full Stream</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="label" translatable="yes">Minimize to tray on close</property> <property name="label" translatable="yes">Minimize to tray on close</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -1241,7 +1225,6 @@ Full Stream</property>
<property name="sensitive">False</property> <property name="sensitive">False</property>
<property name="label" translatable="yes">Start in tray</property> <property name="label" translatable="yes">Start in tray</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -1262,8 +1245,8 @@ Full Stream</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Password protect system tray</property> <property name="label" translatable="yes">Password protect system tray</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<signal name="toggled" handler="on_toggle"/>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -1282,8 +1265,9 @@ Full Stream</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
<widget class="GtkLabel" id="label19"> <widget class="GtkLabel" id="password_label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property> <property name="label" translatable="yes">Password:</property>
</widget> </widget>
@ -1343,6 +1327,7 @@ Full Stream</property>
<widget class="GtkAlignment" id="alignment23"> <widget class="GtkAlignment" id="alignment23">
<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="top_padding">2</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<widget class="GtkTable" id="table2"> <widget class="GtkTable" id="table2">
@ -1352,14 +1337,31 @@ Full Stream</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="GtkEntry" id="txt_open_folder_location"> <widget class="GtkRadioButton" id="radio_open_folder_stock">
<property name="visible">True</property> <property name="visible">True</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="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="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>
@ -1389,36 +1391,20 @@ Thunar</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkRadioButton" id="radio_open_folder_custom"> <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">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>
</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>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>
@ -1452,20 +1438,26 @@ Thunar</property>
<widget class="GtkAlignment" id="alignment5"> <widget class="GtkAlignment" id="alignment5">
<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="top_padding">2</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<widget class="GtkVBox" id="vbox9"> <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>
<child> <child>
<widget class="GtkCheckButton" id="chk_new_releases"> <widget class="GtkAlignment" id="alignment10">
<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">Deluge will check our servers and will tell you if a newer version has been released</property> <child>
<property name="label" translatable="yes">Be alerted about new releases</property> <widget class="GtkCheckButton" id="chk_new_releases1">
<property name="response_id">0</property> <property name="visible">True</property>
<property name="draw_indicator">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">Deluge will check our servers and will tell you if a newer version has been released</property>
<property name="label" translatable="yes">Be alerted about new releases</property>
<property name="draw_indicator">True</property>
</widget>
</child>
</widget> </widget>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1536,7 +1528,6 @@ Thunar</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">Yes, please send anonymous statistics</property> <property name="label" translatable="yes">Yes, please send anonymous statistics</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
</widget> </widget>
</child> </child>
@ -1639,7 +1630,6 @@ Thunar</property>
</widget> </widget>
<packing> <packing>
<property name="resize">False</property> <property name="resize">False</property>
<property name="shrink">True</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -1654,7 +1644,6 @@ Thunar</property>
</widget> </widget>
<packing> <packing>
<property name="resize">False</property> <property name="resize">False</property>
<property name="shrink">True</property>
</packing> </packing>
</child> </child>
</widget> </widget>
@ -1679,10 +1668,6 @@ Thunar</property>
</packing> </packing>
</child> </child>
</widget> </widget>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child> </child>
</widget> </widget>
<packing> <packing>
@ -1702,7 +1687,6 @@ Thunar</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">gtk-cancel</property> <property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_cancel_clicked"/> <signal name="clicked" handler="on_button_cancel_clicked"/>
</widget> </widget>
</child> </child>
@ -1714,7 +1698,6 @@ Thunar</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">gtk-apply</property> <property name="label" translatable="yes">gtk-apply</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_apply_clicked"/> <signal name="clicked" handler="on_button_apply_clicked"/>
</widget> </widget>
<packing> <packing>
@ -1729,7 +1712,6 @@ Thunar</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">gtk-ok</property> <property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_button_ok_clicked"/> <signal name="clicked" handler="on_button_ok_clicked"/>
</widget> </widget>
<packing> <packing>

View file

@ -42,7 +42,7 @@ from toolbar import ToolBar
from torrentview import TorrentView from torrentview import TorrentView
from torrentdetails import TorrentDetails from torrentdetails import TorrentDetails
from preferences import Preferences from preferences import Preferences
from deluge.common import get_logo import deluge.common
from deluge.log import LOG as log from deluge.log import LOG as log
@ -54,7 +54,7 @@ class MainWindow:
"glade/main_window.glade")) "glade/main_window.glade"))
self.window = self.main_glade.get_widget("main_window") self.window = self.main_glade.get_widget("main_window")
self.window.set_icon(get_logo(32)) self.window.set_icon(deluge.common.get_logo(32))
# Initialize various components of the gtkui # Initialize various components of the gtkui
self.menubar = MenuBar(self) self.menubar = MenuBar(self)

View file

@ -38,7 +38,7 @@ import pkg_resources
from deluge.log import LOG as log from deluge.log import LOG as log
import deluge.ui.functions as functions import deluge.ui.functions as functions
from deluge.common import get_logo import deluge.common
class Preferences: class Preferences:
def __init__(self, window): def __init__(self, window):
@ -47,7 +47,7 @@ class Preferences:
pkg_resources.resource_filename("deluge.ui.gtkui", pkg_resources.resource_filename("deluge.ui.gtkui",
"glade/preferences_dialog.glade")) "glade/preferences_dialog.glade"))
self.pref_dialog = self.glade.get_widget("pref_dialog") self.pref_dialog = self.glade.get_widget("pref_dialog")
self.pref_dialog.set_icon(get_logo(32)) self.pref_dialog.set_icon(deluge.common.get_logo(32))
self.treeview = self.glade.get_widget("treeview") self.treeview = self.glade.get_widget("treeview")
self.notebook = self.glade.get_widget("notebook") self.notebook = self.glade.get_widget("notebook")
self.core = functions.get_core() self.core = functions.get_core()
@ -82,13 +82,13 @@ class Preferences:
index = self.notebook.append_page(widget) index = self.notebook.append_page(widget)
self.liststore.append([index, name]) self.liststore.append([index, name])
def get_config(self): def get_core_config(self):
"""Get the configuration from the core.""" """Get the configuration from the core."""
# Get the config dictionary from the core # Get the config dictionary from the core
self.config = functions.get_config(self.core) self.core_config = functions.get_config(self.core)
def show(self): def show(self):
self.get_config() self.get_core_config()
# Update the preferences dialog to reflect current config settings # Update the preferences dialog to reflect current config settings
## Downloads tab ## ## Downloads tab ##
@ -100,53 +100,53 @@ class Preferences:
# choose a download location.. It will be specific to the machine core # choose a download location.. It will be specific to the machine core
# is running on. # is running on.
self.glade.get_widget("download_path_button").set_filename( self.glade.get_widget("download_path_button").set_filename(
self.config["download_location"]) self.core_config["download_location"])
self.glade.get_widget("radio_compact_allocation").set_active( self.glade.get_widget("radio_compact_allocation").set_active(
self.config["compact_allocation"]) self.core_config["compact_allocation"])
self.glade.get_widget("radio_full_allocation").set_active( self.glade.get_widget("radio_full_allocation").set_active(
not self.config["compact_allocation"]) not self.core_config["compact_allocation"])
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active( self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(
self.config["prioritize_first_last_pieces"]) self.core_config["prioritize_first_last_pieces"])
## Network tab ## ## Network tab ##
self.glade.get_widget("spin_port_min").set_value( self.glade.get_widget("spin_port_min").set_value(
self.config["listen_ports"][0]) self.core_config["listen_ports"][0])
self.glade.get_widget("spin_port_max").set_value( self.glade.get_widget("spin_port_max").set_value(
self.config["listen_ports"][1]) self.core_config["listen_ports"][1])
self.glade.get_widget("active_port_label").set_text( self.glade.get_widget("active_port_label").set_text(
str(functions.get_listen_port(self.core))) str(functions.get_listen_port(self.core)))
self.glade.get_widget("chk_random_port").set_active( self.glade.get_widget("chk_random_port").set_active(
self.config["random_port"]) self.core_config["random_port"])
self.glade.get_widget("chk_dht").set_active( self.glade.get_widget("chk_dht").set_active(
self.config["dht"]) self.core_config["dht"])
self.glade.get_widget("chk_upnp").set_active( self.glade.get_widget("chk_upnp").set_active(
self.config["upnp"]) self.core_config["upnp"])
self.glade.get_widget("chk_natpmp").set_active( self.glade.get_widget("chk_natpmp").set_active(
self.config["natpmp"]) self.core_config["natpmp"])
self.glade.get_widget("chk_utpex").set_active( self.glade.get_widget("chk_utpex").set_active(
self.config["utpex"]) self.core_config["utpex"])
self.glade.get_widget("combo_encin").set_active( self.glade.get_widget("combo_encin").set_active(
self.config["enc_in_policy"]) self.core_config["enc_in_policy"])
self.glade.get_widget("combo_encout").set_active( self.glade.get_widget("combo_encout").set_active(
self.config["enc_out_policy"]) self.core_config["enc_out_policy"])
self.glade.get_widget("combo_enclevel").set_active( self.glade.get_widget("combo_enclevel").set_active(
self.config["enc_level"]) self.core_config["enc_level"])
self.glade.get_widget("chk_pref_rc4").set_active( self.glade.get_widget("chk_pref_rc4").set_active(
self.config["enc_prefer_rc4"]) self.core_config["enc_prefer_rc4"])
## Bandwidth tab ## ## Bandwidth tab ##
self.glade.get_widget("spin_max_connections_global").set_value( self.glade.get_widget("spin_max_connections_global").set_value(
self.config["max_connections_global"]) self.core_config["max_connections_global"])
self.glade.get_widget("spin_max_download").set_value( self.glade.get_widget("spin_max_download").set_value(
self.config["max_download_speed"]) self.core_config["max_download_speed"])
self.glade.get_widget("spin_max_upload").set_value( self.glade.get_widget("spin_max_upload").set_value(
self.config["max_upload_speed"]) self.core_config["max_upload_speed"])
self.glade.get_widget("spin_max_upload_slots_global").set_value( self.glade.get_widget("spin_max_upload_slots_global").set_value(
self.config["max_upload_slots_global"]) self.core_config["max_upload_slots_global"])
self.glade.get_widget("spin_max_connections_per_torrent").set_value( self.glade.get_widget("spin_max_connections_per_torrent").set_value(
self.config["max_connections_per_torrent"]) self.core_config["max_connections_per_torrent"])
self.glade.get_widget("spin_max_upload_slots_per_torrent").set_value( self.glade.get_widget("spin_max_upload_slots_per_torrent").set_value(
self.config["max_upload_slots_per_torrent"]) self.core_config["max_upload_slots_per_torrent"])
## Other tab ## ## Other tab ##
# All of it is UI only. # All of it is UI only.
@ -157,13 +157,13 @@ class Preferences:
def set_config(self): def set_config(self):
"""Sets all altered config values in the core""" """Sets all altered config values in the core"""
# Get the values from the dialog # Get the values from the dialog
new_config = {} new_core_config = {}
## Downloads tab ## ## Downloads tab ##
new_config["download_location"] = \ new_core_config["download_location"] = \
self.glade.get_widget("download_path_button").get_filename() self.glade.get_widget("download_path_button").get_filename()
new_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_config["prioritize_first_last_pieces"] = \ new_core_config["prioritize_first_last_pieces"] = \
self.glade.get_widget( self.glade.get_widget(
"chk_prioritize_first_last_pieces").get_active() "chk_prioritize_first_last_pieces").get_active()
@ -173,51 +173,51 @@ class Preferences:
self.glade.get_widget("spin_port_min").get_value_as_int()) self.glade.get_widget("spin_port_min").get_value_as_int())
listen_ports.append( listen_ports.append(
self.glade.get_widget("spin_port_max").get_value_as_int()) self.glade.get_widget("spin_port_max").get_value_as_int())
new_config["listen_ports"] = listen_ports new_core_config["listen_ports"] = listen_ports
new_config["random_port"] = \ new_core_config["random_port"] = \
self.glade.get_widget("chk_random_port").get_active() self.glade.get_widget("chk_random_port").get_active()
new_config["dht"] = self.glade.get_widget("chk_dht").get_active() new_core_config["dht"] = self.glade.get_widget("chk_dht").get_active()
new_config["upnp"] = self.glade.get_widget("chk_upnp").get_active() new_core_config["upnp"] = self.glade.get_widget("chk_upnp").get_active()
new_config["natpmp"] = self.glade.get_widget("chk_natpmp").get_active() new_core_config["natpmp"] = self.glade.get_widget("chk_natpmp").get_active()
new_config["utpex"] = self.glade.get_widget("chk_utpex").get_active() new_core_config["utpex"] = self.glade.get_widget("chk_utpex").get_active()
new_config["enc_in_policy"] = \ new_core_config["enc_in_policy"] = \
self.glade.get_widget("combo_encin").get_active() self.glade.get_widget("combo_encin").get_active()
new_config["enc_out_policy"] = \ new_core_config["enc_out_policy"] = \
self.glade.get_widget("combo_encout").get_active() self.glade.get_widget("combo_encout").get_active()
new_config["enc_level"] = \ new_core_config["enc_level"] = \
self.glade.get_widget("combo_enclevel").get_active() self.glade.get_widget("combo_enclevel").get_active()
new_config["enc_prefer_rc4"] = \ new_core_config["enc_prefer_rc4"] = \
self.glade.get_widget("chk_pref_rc4").get_active() self.glade.get_widget("chk_pref_rc4").get_active()
## Bandwidth tab ## ## Bandwidth tab ##
new_config["max_connections_global"] = \ new_core_config["max_connections_global"] = \
self.glade.get_widget( self.glade.get_widget(
"spin_max_connections_global").get_value_as_int() "spin_max_connections_global").get_value_as_int()
new_config["max_download_speed"] = \ new_core_config["max_download_speed"] = \
self.glade.get_widget("spin_max_download").get_value() self.glade.get_widget("spin_max_download").get_value()
new_config["max_upload_speed"] = \ new_core_config["max_upload_speed"] = \
self.glade.get_widget("spin_max_upload").get_value() self.glade.get_widget("spin_max_upload").get_value()
new_config["max_upload_slots_global"] = \ new_core_config["max_upload_slots_global"] = \
self.glade.get_widget( self.glade.get_widget(
"spin_max_upload_slots_global").get_value_as_int() "spin_max_upload_slots_global").get_value_as_int()
new_config["max_connections_per_torrent"] = \ new_core_config["max_connections_per_torrent"] = \
self.glade.get_widget( self.glade.get_widget(
"spin_max_connections_per_torrent").get_value_as_int() "spin_max_connections_per_torrent").get_value_as_int()
new_config["max_upload_slots_per_torrent"] = \ new_core_config["max_upload_slots_per_torrent"] = \
self.glade.get_widget( self.glade.get_widget(
"spin_max_upload_slots_per_torrent").get_value_as_int() "spin_max_upload_slots_per_torrent").get_value_as_int()
config_to_set = {} config_to_set = {}
for key in new_config.keys(): for key in new_core_config.keys():
# The values do not match so this needs to be updated # The values do not match so this needs to be updated
if self.config[key] != new_config[key]: if self.core_config[key] != new_core_config[key]:
config_to_set[key] = new_config[key] config_to_set[key] = new_core_config[key]
# Set each changed config value in the core # Set each changed config value in the core
functions.set_config(config_to_set, self.core) functions.set_config(config_to_set, self.core)
# Update the configuration # Update the configuration
self.config.update(config_to_set) self.core_config.update(config_to_set)
def hide(self): def hide(self):
self.pref_dialog.hide() self.pref_dialog.hide()
@ -229,14 +229,39 @@ class Preferences:
def on_toggle(self, widget): def on_toggle(self, widget):
"""Handles widget sensitivity based on radio/check button values.""" """Handles widget sensitivity based on radio/check button values."""
value = widget.get_active() value = widget.get_active()
if widget == self.glade.get_widget('radio_save_all_to'): # Disable the download path button if user wants to pick where each
self.glade.get_widget('download_path_button').set_sensitive(value) # new torrent is saved.
if widget == self.glade.get_widget("radio_save_all_to"):
self.glade.get_widget("download_path_button").set_sensitive(value)
self.glade.get_widget('spin_port_min').set_sensitive( # Disable the port spinners if random ports is selected.
not self.glade.get_widget('chk_random_port').get_active()) if widget == self.glade.get_widget("chk_random_port"):
self.glade.get_widget('spin_port_max').set_sensitive( self.glade.get_widget("spin_port_min").set_sensitive(not value)
not self.glade.get_widget('chk_random_port').get_active()) self.glade.get_widget("spin_port_max").set_sensitive(not value)
# Disable all the tray options if tray is not used.
if widget == self.glade.get_widget("chk_use_tray"):
self.glade.get_widget("chk_min_on_close").set_sensitive(value)
self.glade.get_widget("chk_start_in_tray").set_sensitive(value)
self.glade.get_widget("chk_lock_tray").set_sensitive(value)
if value == True:
lock = self.glade.get_widget("chk_lock_tray").get_active()
self.glade.get_widget("txt_tray_passwd").set_sensitive(lock)
self.glade.get_widget("password_label").set_sensitive(lock)
else:
self.glade.get_widget("txt_tray_passwd").set_sensitive(value)
self.glade.get_widget("password_label").set_sensitive(value)
if widget == self.glade.get_widget("chk_lock_tray"):
self.glade.get_widget("txt_tray_passwd").set_sensitive(value)
self.glade.get_widget("password_label").set_sensitive(value)
# Disable the file manager combo box if custom is selected.
if widget == self.glade.get_widget("radio_open_folder_custom"):
self.glade.get_widget("combo_file_manager").set_sensitive(not value)
self.glade.get_widget("txt_open_folder_location").set_sensitive(
value)
def on_button_ok_clicked(self, data): def on_button_ok_clicked(self, data):
log.debug("on_button_ok_clicked") log.debug("on_button_ok_clicked")
self.set_config() self.set_config()