mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-18 22:36:51 +00:00
Preferences dialog now sets core configuration options.
This commit is contained in:
parent
a46610a04a
commit
4691dcbaa2
@ -114,6 +114,10 @@ class Config:
|
|||||||
log.warning("Key does not exist, returning None")
|
log.warning("Key does not exist, returning None")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_config(self):
|
||||||
|
"""Returns the entire configuration as a dictionary."""
|
||||||
|
return self.config
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return self.config[key]
|
return self.config[key]
|
||||||
|
|
||||||
|
@ -52,7 +52,23 @@ DEFAULT_PREFS = {
|
|||||||
"download_location": deluge.common.get_default_download_dir(),
|
"download_location": deluge.common.get_default_download_dir(),
|
||||||
"listen_ports": [6881, 6891],
|
"listen_ports": [6881, 6891],
|
||||||
"torrentfiles_location": deluge.common.get_default_torrent_dir(),
|
"torrentfiles_location": deluge.common.get_default_torrent_dir(),
|
||||||
"plugins_location": deluge.common.get_default_plugin_dir()
|
"plugins_location": deluge.common.get_default_plugin_dir(),
|
||||||
|
"prioritize_first_last_pieces": False,
|
||||||
|
"random_port": False,
|
||||||
|
"dht": False,
|
||||||
|
"upnp": False,
|
||||||
|
"natpmp": False,
|
||||||
|
"utpex": False,
|
||||||
|
"enc_in_policy": 1,
|
||||||
|
"enc_out_policy": 1,
|
||||||
|
"enc_level": 1,
|
||||||
|
"enc_prefer_rc4": True,
|
||||||
|
"max_connections_global": -1,
|
||||||
|
"max_upload_speed": -1.0,
|
||||||
|
"max_download_speed": -1.0,
|
||||||
|
"max_upload_slots_global": -1,
|
||||||
|
"max_connections_per_torrent": -1,
|
||||||
|
"max_upload_slots_per_torrent": -1
|
||||||
}
|
}
|
||||||
|
|
||||||
class Core(dbus.service.Object):
|
class Core(dbus.service.Object):
|
||||||
@ -189,6 +205,32 @@ class Core(dbus.service.Object):
|
|||||||
# Have the TorrentManager save it's state
|
# Have the TorrentManager save it's state
|
||||||
self.torrents.save_state()
|
self.torrents.save_state()
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
|
in_signature="",
|
||||||
|
out_signature="ay")
|
||||||
|
def get_config(self):
|
||||||
|
"""Get all the preferences as a dictionary"""
|
||||||
|
config = self.config.get_config()
|
||||||
|
config = pickle.dumps(config)
|
||||||
|
return config
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
|
in_signature="ay")
|
||||||
|
def set_config(self, config):
|
||||||
|
"""Set the config with values from dictionary"""
|
||||||
|
# Convert the byte array into the dictionary
|
||||||
|
config = "".join(chr(b) for b in config)
|
||||||
|
config = pickle.loads(config)
|
||||||
|
# Load all the values into the configuration
|
||||||
|
for key in config.keys():
|
||||||
|
self.config[key] = config[key]
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
|
out_signature="i")
|
||||||
|
def get_listen_port(self):
|
||||||
|
"""Returns the active listen port"""
|
||||||
|
return self.session.listen_port()
|
||||||
|
|
||||||
# Signals
|
# Signals
|
||||||
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
|
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
signature="s")
|
signature="s")
|
||||||
|
@ -38,7 +38,7 @@ import logging
|
|||||||
# Setup the logger
|
# Setup the logger
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format="[%(levelname)-8s] %(name)s:%(module)s:%(lineno)d %(message)s"
|
format="[%(levelname)-8s] %(module)s:%(lineno)d %(message)s"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get the logger
|
# Get the logger
|
||||||
|
@ -129,3 +129,25 @@ def get_session_state(core=None):
|
|||||||
# De-serialize the object
|
# De-serialize the object
|
||||||
state = pickle.loads(state)
|
state = pickle.loads(state)
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
def get_config(core=None):
|
||||||
|
if core is None:
|
||||||
|
core = get_core()
|
||||||
|
config = core.get_config()
|
||||||
|
config = "".join(chr(b) for b in config)
|
||||||
|
config = pickle.loads(config)
|
||||||
|
return config
|
||||||
|
|
||||||
|
def set_config(config, core=None):
|
||||||
|
if config == {}:
|
||||||
|
return
|
||||||
|
if core is None:
|
||||||
|
core = get_core()
|
||||||
|
config = pickle.dumps(config)
|
||||||
|
core.set_config(config)
|
||||||
|
|
||||||
|
def get_listen_port(core=None):
|
||||||
|
if core is None:
|
||||||
|
core = get_core()
|
||||||
|
return int(core.get_listen_port())
|
||||||
|
|
||||||
|
@ -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 Wed Sep 12 05:11:04 2007 by andrew@fragment-->
|
<!--Generated with glade3 3.2.2 on Fri Sep 14 02:19:37 2007 by andrew@fragment-->
|
||||||
<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>
|
||||||
@ -23,12 +23,18 @@
|
|||||||
<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>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkViewport" id="viewport6">
|
||||||
|
<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="resize_mode">GTK_RESIZE_QUEUE</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="treeview">
|
<widget class="GtkTreeView" id="treeview">
|
||||||
<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="headers_clickable">True</property>
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
@ -120,6 +126,8 @@
|
|||||||
<property name="response_id">0</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>
|
||||||
|
<signal name="toggled" handler="on_radio_save_all_to_toggled"/>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -206,6 +214,7 @@
|
|||||||
<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="response_id">0</property>
|
||||||
<property name="draw_indicator">True</property>
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">radio_full_allocation</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -385,9 +394,12 @@
|
|||||||
<widget class="GtkSpinButton" id="spin_port_min">
|
<widget class="GtkSpinButton" id="spin_port_min">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="max_length">5</property>
|
||||||
<property name="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
<property name="adjustment">0 0 65535 1 10 10</property>
|
<property name="adjustment">0 0 65535 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="numeric">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -411,9 +423,12 @@
|
|||||||
<widget class="GtkSpinButton" id="spin_port_max">
|
<widget class="GtkSpinButton" id="spin_port_max">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="max_length">5</property>
|
||||||
<property name="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
<property name="adjustment">0 0 65535 1 10 10</property>
|
<property name="adjustment">0 0 65535 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="numeric">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -756,7 +771,7 @@ Full Stream</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="chk_pref_rc">
|
<widget class="GtkCheckButton" id="chk_pref_rc4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</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>
|
||||||
@ -866,54 +881,60 @@ 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="xalign">1</property>
|
<property name="xalign">1</property>
|
||||||
<property name="adjustment">-1 -1 1000 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="numeric">True</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="bottom_attach">3</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSpinButton" id="spin_max_download">
|
||||||
|
<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 download speed for all torrents. Set -1 for unlimited.</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>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<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>
|
||||||
@ -931,57 +952,61 @@ Full Stream</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkSpinButton" id="spin_max_download">
|
<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="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 number of connections allowed. Set -1 for unlimited.</property>
|
||||||
<property name="tooltip" translatable="yes">The maximum download speed for all torrents. Set -1 for unlimited.</property>
|
<property name="max_length">4</property>
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">0 -1 9000 1 10 10</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">1</property>
|
|
||||||
<property name="bottom_attach">2</property>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_max_upload">
|
|
||||||
<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="xalign">1</property>
|
|
||||||
<property name="adjustment">0 -1 9000 1 10 10</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</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>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_max_upload_slots_global">
|
|
||||||
<property name="visible">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="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="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>
|
||||||
@ -1025,18 +1050,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="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="GtkSpinButton" id="spin_max_connections_per_torrent">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">The maximum number of connections per torrent. Set -1 for unlimited.</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<property name="adjustment">-1 -1 9000 1 10 10</property>
|
||||||
|
<property name="snap_to_ticks">True</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label17">
|
<widget class="GtkLabel" id="label17">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -1049,31 +1096,13 @@ Full Stream</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkSpinButton" id="spin_max_connections_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 number of connections 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 1000 1 10 10</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="x_options">GTK_FILL</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_max_upload_slots_per_torrent">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="tooltip" translatable="yes">The maximum upload slots per torrent. Set -1 for unlimited.</property>
|
|
||||||
<property name="xalign">1</property>
|
|
||||||
<property name="adjustment">-1 -1 1000 1 10 10</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
</widget>
|
|
||||||
<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>
|
||||||
@ -1322,14 +1351,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="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>
|
||||||
|
<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>
|
||||||
</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>
|
||||||
@ -1359,35 +1405,19 @@ 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="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>
|
|
||||||
</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>
|
||||||
@ -1485,7 +1515,7 @@ Thunar</property>
|
|||||||
<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="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
<property name="label" translatable="yes">Help us improve Deluge by sending us your Python and PyGTK versions, OS and processor types. Absolutely no other information is sent.</property>
|
<property name="label" translatable="yes">Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent.</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -70,7 +70,6 @@ class MenuBar:
|
|||||||
## Edit Menu
|
## Edit Menu
|
||||||
"on_menuitem_preferences_activate": \
|
"on_menuitem_preferences_activate": \
|
||||||
self.on_menuitem_preferences_activate,
|
self.on_menuitem_preferences_activate,
|
||||||
"on_menuitem_plugins_activate": self.on_menuitem_plugins_activate,
|
|
||||||
|
|
||||||
## View Menu
|
## View Menu
|
||||||
"on_menuitem_toolbar_toggled": self.on_menuitem_toolbar_toggled,
|
"on_menuitem_toolbar_toggled": self.on_menuitem_toolbar_toggled,
|
||||||
@ -121,9 +120,6 @@ class MenuBar:
|
|||||||
log.debug("on_menuitem_preferences_activate")
|
log.debug("on_menuitem_preferences_activate")
|
||||||
self.window.preferences.show()
|
self.window.preferences.show()
|
||||||
|
|
||||||
def on_menuitem_plugins_activate(self, data=None):
|
|
||||||
log.debug("on_menuitem_plugins_activate")
|
|
||||||
|
|
||||||
## Torrent Menu ##
|
## Torrent Menu ##
|
||||||
def on_menuitem_pause_activate(self, data=None):
|
def on_menuitem_pause_activate(self, data=None):
|
||||||
log.debug("on_menuitem_pause_activate")
|
log.debug("on_menuitem_pause_activate")
|
||||||
|
@ -37,16 +37,18 @@ import gtk, gtk.glade
|
|||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
import deluge.ui.functions as functions
|
||||||
|
|
||||||
class Preferences:
|
class Preferences:
|
||||||
def __init__(self, window):
|
def __init__(self, window):
|
||||||
self.window = window
|
self.window = window
|
||||||
self.pref_glade = gtk.glade.XML(
|
self.glade = gtk.glade.XML(
|
||||||
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.pref_glade.get_widget("pref_dialog")
|
self.pref_dialog = self.glade.get_widget("pref_dialog")
|
||||||
self.treeview = self.pref_glade.get_widget("treeview")
|
self.treeview = self.glade.get_widget("treeview")
|
||||||
self.notebook = self.pref_glade.get_widget("notebook")
|
self.notebook = self.glade.get_widget("notebook")
|
||||||
|
self.core = functions.get_core()
|
||||||
# Setup the liststore for the categories (tab pages)
|
# Setup the liststore for the categories (tab pages)
|
||||||
self.liststore = gtk.ListStore(int, str)
|
self.liststore = gtk.ListStore(int, str)
|
||||||
self.treeview.set_model(self.liststore)
|
self.treeview.set_model(self.liststore)
|
||||||
@ -54,27 +56,167 @@ class Preferences:
|
|||||||
column = gtk.TreeViewColumn("Categories", render, text=1)
|
column = gtk.TreeViewColumn("Categories", render, text=1)
|
||||||
self.treeview.append_column(column)
|
self.treeview.append_column(column)
|
||||||
# Add the default categories
|
# Add the default categories
|
||||||
self.liststore.append([0, "Downloads"])
|
i = 0
|
||||||
self.liststore.append([1, "Network"])
|
for category in ["Downloads", "Network", "Bandwidth", "Other",
|
||||||
self.liststore.append([2, "Bandwidth"])
|
"Plugins"]:
|
||||||
self.liststore.append([3, "Other"])
|
self.liststore.append([i, category])
|
||||||
self.liststore.append([4, "Plugins"])
|
i += 1
|
||||||
|
|
||||||
# Connect to the 'changed' event of TreeViewSelection to get selection
|
# Connect to the 'changed' event of TreeViewSelection to get selection
|
||||||
# changes.
|
# changes.
|
||||||
self.treeview.get_selection().connect("changed",
|
self.treeview.get_selection().connect("changed",
|
||||||
self.on_selection_changed)
|
self.on_selection_changed)
|
||||||
|
|
||||||
self.pref_glade.signal_autoconnect({
|
self.glade.signal_autoconnect({
|
||||||
"on_pref_dialog_delete_event": self.on_pref_dialog_delete_event,
|
"on_pref_dialog_delete_event": self.on_pref_dialog_delete_event,
|
||||||
"on_button_ok_clicked": self.on_button_ok_clicked,
|
"on_button_ok_clicked": self.on_button_ok_clicked,
|
||||||
"on_button_apply_clicked": self.on_button_apply_clicked,
|
"on_button_apply_clicked": self.on_button_apply_clicked,
|
||||||
"on_button_cancel_clicked": self.on_button_cancel_clicked
|
"on_button_cancel_clicked": self.on_button_cancel_clicked,
|
||||||
|
"on_radio_save_all_to_toggled": self.on_toggle
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def add_page(self, name, widget):
|
||||||
|
"""Add a another page to the notebook"""
|
||||||
|
index = self.notebook.append_page(widget)
|
||||||
|
self.liststore.append([index, name])
|
||||||
|
|
||||||
|
def get_config(self):
|
||||||
|
"""Get the configuration from the core."""
|
||||||
|
# Get the config dictionary from the core
|
||||||
|
self.config = functions.get_config(self.core)
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
|
self.get_config()
|
||||||
|
# Update the preferences dialog to reflect current config settings
|
||||||
|
|
||||||
|
## Downloads tab ##
|
||||||
|
# FIXME: Add GtkUI specific prefs here
|
||||||
|
# Core specific options for Downloads tab
|
||||||
|
|
||||||
|
# This one will need to be re-evaluated if the core is running on a
|
||||||
|
# different machine.. We won't be able to use the local file browser to
|
||||||
|
# choose a download location.. It will be specific to the machine core
|
||||||
|
# is running on.
|
||||||
|
self.glade.get_widget("download_path_button").set_filename(
|
||||||
|
self.config["download_location"])
|
||||||
|
self.glade.get_widget("radio_compact_allocation").set_active(
|
||||||
|
self.config["compact_allocation"])
|
||||||
|
self.glade.get_widget("radio_full_allocation").set_active(
|
||||||
|
not self.config["compact_allocation"])
|
||||||
|
self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(
|
||||||
|
self.config["prioritize_first_last_pieces"])
|
||||||
|
|
||||||
|
## Network tab ##
|
||||||
|
self.glade.get_widget("spin_port_min").set_value(
|
||||||
|
self.config["listen_ports"][0])
|
||||||
|
self.glade.get_widget("spin_port_max").set_value(
|
||||||
|
self.config["listen_ports"][1])
|
||||||
|
self.glade.get_widget("active_port_label").set_text(
|
||||||
|
str(functions.get_listen_port(self.core)))
|
||||||
|
self.glade.get_widget("chk_random_port").set_active(
|
||||||
|
self.config["random_port"])
|
||||||
|
self.glade.get_widget("chk_dht").set_active(
|
||||||
|
self.config["dht"])
|
||||||
|
self.glade.get_widget("chk_upnp").set_active(
|
||||||
|
self.config["upnp"])
|
||||||
|
self.glade.get_widget("chk_natpmp").set_active(
|
||||||
|
self.config["natpmp"])
|
||||||
|
self.glade.get_widget("chk_utpex").set_active(
|
||||||
|
self.config["utpex"])
|
||||||
|
self.glade.get_widget("combo_encin").set_active(
|
||||||
|
self.config["enc_in_policy"])
|
||||||
|
self.glade.get_widget("combo_encout").set_active(
|
||||||
|
self.config["enc_out_policy"])
|
||||||
|
self.glade.get_widget("combo_enclevel").set_active(
|
||||||
|
self.config["enc_level"])
|
||||||
|
self.glade.get_widget("chk_pref_rc4").set_active(
|
||||||
|
self.config["enc_prefer_rc4"])
|
||||||
|
|
||||||
|
## Bandwidth tab ##
|
||||||
|
self.glade.get_widget("spin_max_connections_global").set_value(
|
||||||
|
self.config["max_connections_global"])
|
||||||
|
self.glade.get_widget("spin_max_download").set_value(
|
||||||
|
self.config["max_download_speed"])
|
||||||
|
self.glade.get_widget("spin_max_upload").set_value(
|
||||||
|
self.config["max_upload_speed"])
|
||||||
|
self.glade.get_widget("spin_max_upload_slots_global").set_value(
|
||||||
|
self.config["max_upload_slots_global"])
|
||||||
|
self.glade.get_widget("spin_max_connections_per_torrent").set_value(
|
||||||
|
self.config["max_connections_per_torrent"])
|
||||||
|
self.glade.get_widget("spin_max_upload_slots_per_torrent").set_value(
|
||||||
|
self.config["max_upload_slots_per_torrent"])
|
||||||
|
|
||||||
|
## Other tab ##
|
||||||
|
# All of it is UI only.
|
||||||
|
|
||||||
|
# Now show the dialog
|
||||||
self.pref_dialog.show()
|
self.pref_dialog.show()
|
||||||
|
|
||||||
|
def set_config(self):
|
||||||
|
"""Sets all altered config values in the core"""
|
||||||
|
# Get the values from the dialog
|
||||||
|
new_config = {}
|
||||||
|
## Downloads tab ##
|
||||||
|
new_config["download_location"] = \
|
||||||
|
self.glade.get_widget("download_path_button").get_filename()
|
||||||
|
new_config["compact_allocation"] = \
|
||||||
|
self.glade.get_widget("radio_compact_allocation").get_active()
|
||||||
|
new_config["prioritize_first_last_pieces"] = \
|
||||||
|
self.glade.get_widget(
|
||||||
|
"chk_prioritize_first_last_pieces").get_active()
|
||||||
|
|
||||||
|
## Network tab ##
|
||||||
|
listen_ports = []
|
||||||
|
listen_ports.append(
|
||||||
|
self.glade.get_widget("spin_port_min").get_value_as_int())
|
||||||
|
listen_ports.append(
|
||||||
|
self.glade.get_widget("spin_port_max").get_value_as_int())
|
||||||
|
new_config["listen_ports"] = listen_ports
|
||||||
|
new_config["random_port"] = \
|
||||||
|
self.glade.get_widget("chk_random_port").get_active()
|
||||||
|
new_config["dht"] = self.glade.get_widget("chk_dht").get_active()
|
||||||
|
new_config["upnp"] = self.glade.get_widget("chk_upnp").get_active()
|
||||||
|
new_config["natpmp"] = self.glade.get_widget("chk_natpmp").get_active()
|
||||||
|
new_config["utpex"] = self.glade.get_widget("chk_utpex").get_active()
|
||||||
|
new_config["enc_in_policy"] = \
|
||||||
|
self.glade.get_widget("combo_encin").get_active()
|
||||||
|
new_config["enc_out_policy"] = \
|
||||||
|
self.glade.get_widget("combo_encout").get_active()
|
||||||
|
new_config["enc_level"] = \
|
||||||
|
self.glade.get_widget("combo_enclevel").get_active()
|
||||||
|
new_config["enc_prefer_rc4"] = \
|
||||||
|
self.glade.get_widget("chk_pref_rc4").get_active()
|
||||||
|
|
||||||
|
## Bandwidth tab ##
|
||||||
|
new_config["max_connections_global"] = \
|
||||||
|
self.glade.get_widget(
|
||||||
|
"spin_max_connections_global").get_value_as_int()
|
||||||
|
new_config["max_download_speed"] = \
|
||||||
|
self.glade.get_widget("spin_max_download").get_value()
|
||||||
|
new_config["max_upload_speed"] = \
|
||||||
|
self.glade.get_widget("spin_max_upload").get_value()
|
||||||
|
new_config["max_upload_slots_global"] = \
|
||||||
|
self.glade.get_widget(
|
||||||
|
"spin_max_upload_slots_global").get_value_as_int()
|
||||||
|
new_config["max_connections_per_torrent"] = \
|
||||||
|
self.glade.get_widget(
|
||||||
|
"spin_max_connections_per_torrent").get_value_as_int()
|
||||||
|
new_config["max_upload_slots_per_torrent"] = \
|
||||||
|
self.glade.get_widget(
|
||||||
|
"spin_max_upload_slots_per_torrent").get_value_as_int()
|
||||||
|
|
||||||
|
config_to_set = {}
|
||||||
|
for key in new_config.keys():
|
||||||
|
# The values do not match so this needs to be updated
|
||||||
|
if self.config[key] != new_config[key]:
|
||||||
|
config_to_set[key] = new_config[key]
|
||||||
|
|
||||||
|
# Set each changed config value in the core
|
||||||
|
functions.set_config(config_to_set, self.core)
|
||||||
|
|
||||||
|
# Update the configuration
|
||||||
|
self.config.update(config_to_set)
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
self.pref_dialog.hide()
|
self.pref_dialog.hide()
|
||||||
|
|
||||||
@ -82,14 +224,26 @@ class Preferences:
|
|||||||
self.hide()
|
self.hide()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def on_toggle(self, widget):
|
||||||
|
"""Handles widget sensitivity based on radio/check button values."""
|
||||||
|
value = widget.get_active()
|
||||||
|
if widget == self.glade.get_widget('radio_save_all_to'):
|
||||||
|
self.glade.get_widget('download_path_button').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.hide()
|
||||||
|
return True
|
||||||
|
|
||||||
def on_button_apply_clicked(self, data):
|
def on_button_apply_clicked(self, data):
|
||||||
log.debug("on_button_apply_clicked")
|
log.debug("on_button_apply_clicked")
|
||||||
|
self.set_config()
|
||||||
|
|
||||||
def on_button_cancel_clicked(self, data):
|
def on_button_cancel_clicked(self, data):
|
||||||
log.debug("on_button_cancel_clicked")
|
log.debug("on_button_cancel_clicked")
|
||||||
|
self.hide()
|
||||||
|
return True
|
||||||
|
|
||||||
def on_selection_changed(self, treeselection):
|
def on_selection_changed(self, treeselection):
|
||||||
# Show the correct notebook page based on what row is selected.
|
# Show the correct notebook page based on what row is selected.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user