Author: andar Revision: 5417
Log:
Add a Cache preferences page to adjust cache settings and examine cache
status
Diff:
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-06-24 05:41:30 UTC (rev 5416)
+++ trunk/ChangeLog 2009-06-25 23:58:54 UTC (rev 5417)
@@ -15,6 +15,7 @@
* Add an error category to the tracker sidebar list
* Add Find More Plugins button to Plugins preference page
* Fix #518 remove header in add torrent dialog to save vertical space
+ * Add a Cache preferences page to adjust cache settings and examine cache
status
==== ConsoleUI ====
* Changed to use curses for a more interactive client
Modified: trunk/deluge/core/core.py
===================================================================
--- trunk/deluge/core/core.py 2009-06-24 05:41:30 UTC (rev 5416)
+++ trunk/deluge/core/core.py 2009-06-25 23:58:54 UTC (rev 5417)
@@ -338,6 +338,35 @@
return status
@export
+ def get_cache_status(self):
+ """
+ Returns a dictionary of the session's cache status.
+
+ :returns: a dict of the cache status
+
+ """
+
+ status = self.session.get_cache_status()
+ cache = {}
+ for attr in dir(status):
+ if attr.startswith("_"):
+ continue
+ cache[attr] = getattr(status, attr)
+
+ # Add in a couple ratios
+ try:
+ cache["write_hit_ratio"] = float((cache["blocks_written"] -
cache["writes"])) / float(cache["blocks_written"])
+ except ZeroDivisionError:
+ cache["write_hit_ratio"] = 0.0
+
+ try:
+ cache["read_hit_ratio"] = float(cache["blocks_read_hit"]) /
float(cache["blocks_read"])
+ except ZeroDivisionError:
+ cache["read_hit_ratio"] = 0.0
+
+ return cache
+
+ @export
def force_reannounce(self, torrent_ids):
log.debug("Forcing reannouncment to: %s", torrent_ids)
for torrent_id in torrent_ids:
Modified: trunk/deluge/core/preferencesmanager.py
===================================================================
--- trunk/deluge/core/preferencesmanager.py 2009-06-24 05:41:30 UTC (rev
5416)
+++ trunk/deluge/core/preferencesmanager.py 2009-06-25 23:58:54 UTC (rev
5417)
@@ -144,7 +144,9 @@
"random_outgoing_ports": True,
"peer_tos": "0x00",
"rate_limit_ip_overhead": True,
- "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat"
+ "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
+ "cache_size": 512,
+ "cache_expiry": 60
}
class PreferencesManager(component.Component):
@@ -227,6 +229,10 @@
self._on_rate_limit_ip_overhead)
self.config.register_set_function("geoip_db_location",
self._on_geoip_db_location)
+ self.config.register_set_function("cache_size",
+ self._on_cache_size)
+ self.config.register_set_function("cache_expiry",
+ self._on_cache_expiry)
self.config.register_change_callback(self._on_config_value_change)
@@ -516,3 +522,13 @@
except Exception, e:
log.error("Unable to load geoip database!")
log.exception(e)
+
+ def _on_cache_size(self, key, value):
+ log.debug("%s: %s", key, value)
+ self.settings.cache_size = value
+ self.session.set_settings(self.settings)
+
+ def _on_cache_expiry(self, key, value):
+ log.debug("%s: %s", key, value)
+ self.settings.cache_expiry = value
+ self.session.set_settings(self.settings)
Modified: trunk/deluge/ui/gtkui/glade/preferences_dialog.glade
===================================================================
--- trunk/deluge/ui/gtkui/glade/preferences_dialog.glade 2009-06-24
05:41:30 UTC (rev 5416)
+++ trunk/deluge/ui/gtkui/glade/preferences_dialog.glade 2009-06-25
23:58:54 UTC (rev 5417)
@@ -4283,6 +4283,554 @@
</packing>
</child>
<child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow13">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <widget class="GtkViewport" id="viewport13">
+ <property name="visible">True</property>
+ <property name="resize_mode">queue</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <widget class="GtkVBox" id="vbox30">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkLabel" id="label111">
+ <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="xpad">10</property>
+ <property name="ypad">10</property>
+ <property name="label"
translatable="yes"><b><i><big>Cache</big></i></b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHSeparator" id="hseparator11">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment52">
+ <property name="visible">True</property>
+ <property name="right_padding">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox31">
+ <property name="visible">True</property>
+ <property
name="orientation">vertical</property>
+ <child>
+ <widget class="GtkFrame" id="frame32">
+ <property
name="visible">True</property>
+ <property
name="label_xalign">0</property>
+ <property
name="shadow_type">none</property>
+ <child>
+ <widget class="GtkAlignment"
id="alignment53">
+ <property
name="visible">True</property>
+ <property
name="top_padding">5</property>
+ <property
name="left_padding">12</property>
+ <child>
+ <widget class="GtkTable"
id="table14">
+ <property
name="visible">True</property>
+ <property
name="n_rows">2</property>
+ <property
name="n_columns">2</property>
+ <property
name="column_spacing">5</property>
+ <child>
+ <widget class="GtkLabel"
id="label114">
+ <property
name="visible">True</property>
+ <property
name="xalign">0</property>
+ <property name="label"
translatable="yes">Cache Size (16 KiB blocks):</property>
+ </widget>
+ <packing>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label115">
+ <property
name="visible">True</property>
+ <property
name="has_tooltip">True</property>
+ <property name="tooltip"
translatable="yes">The number of seconds from the last cached write to a piece
in the write cache, to when it's forcefully flushed to disk. Default is 60
seconds.</property>
+ <property
name="xalign">0</property>
+ <property name="label"
translatable="yes">Cache Expiry (seconds):</property>
+ </widget>
+ <packing>
+ <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_cache_size">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="invisible_char">●</property>
+ <property
name="xalign">1</property>
+ <property
name="adjustment">512 0 99999 1 10 10</property>
+ <property
name="numeric">True</property>
+ <property
name="update_policy">if-valid</property>
+ </widget>
+ <packing>
+ <property
name="left_attach">1</property>
+ <property
name="right_attach">2</property>
+ <property
name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkSpinButton" id="spin_cache_expiry">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="max_length">5</property>
+ <property
name="invisible_char">●</property>
+ <property
name="width_chars">5</property>
+ <property
name="xalign">1</property>
+ <property
name="adjustment">60 1 32000 1 10 10</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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label112">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Settings</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame33">
+ <property
name="visible">True</property>
+ <property
name="label_xalign">0</property>
+ <property
name="shadow_type">none</property>
+ <child>
+ <widget class="GtkAlignment"
id="alignment54">
+ <property
name="visible">True</property>
+ <property
name="top_padding">5</property>
+ <property
name="left_padding">12</property>
+ <child>
+ <widget class="GtkVBox"
id="vbox32">
+ <property
name="visible">True</property>
+ <property
name="orientation">vertical</property>
+ <child>
+ <widget class="GtkFrame"
id="frame34">
+ <property
name="visible">True</property>
+ <property
name="label_xalign">0</property>
+ <property
name="shadow_type">none</property>
+ <child>
+ <widget
class="GtkAlignment" id="alignment55">
+ <property
name="visible">True</property>
+ <property
name="left_padding">12</property>
+ <child>
+ <widget
class="GtkTable" id="table18">
+ <property
name="visible">True</property>
+ <property
name="n_rows">3</property>
+ <property
name="n_columns">2</property>
+ <property
name="column_spacing">5</property>
+ <child>
+ <widget
class="GtkLabel" id="label116">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The total number of 16 KiB blocks written to
disk since this session was started.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Blocks Written:</property>
+ </widget>
+ <packing>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label120">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The total number of write operations
performed since this session was started.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Writes:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">1</property>
+ <property
name="bottom_attach">2</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label124">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The ratio (blocks_written - writes) /
blocks_written represents the number of saved write operations per total write
operations, i.e. a kind of cache hit ratio for the write cache.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Write Cache Hit Ratio:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">2</property>
+ <property
name="bottom_attach">3</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_blocks_written">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ </widget>
+ <packing>
+ <property
name="left_attach">1</property>
+ <property
name="right_attach">2</property>
+ <property
name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_writes">
+ <property
name="visible">True</property>
+ <property
name="xalign">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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_write_hit_ratio">
+ <property
name="visible">True</property>
+ <property
name="xalign">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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label132">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Write</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame"
id="frame35">
+ <property
name="visible">True</property>
+ <property
name="label_xalign">0</property>
+ <property
name="shadow_type">none</property>
+ <child>
+ <widget
class="GtkAlignment" id="alignment56">
+ <property
name="visible">True</property>
+ <property
name="left_padding">12</property>
+ <child>
+ <widget
class="GtkTable" id="table19">
+ <property
name="visible">True</property>
+ <property
name="n_rows">4</property>
+ <property
name="n_columns">2</property>
+ <property
name="column_spacing">5</property>
+ <child>
+ <widget
class="GtkLabel" id="label118">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The number of blocks that were requested from
the bittorrent engine (from peers), that were served from disk or
cache.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Blocks Read:</property>
+ </widget>
+ <packing>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label119">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The number of blocks that were served from
cache.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Blocks Read Hit:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">1</property>
+ <property
name="bottom_attach">2</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label122">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The cache hit ratio for the read
cache.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Read Cache Hit Ratio:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">3</property>
+ <property
name="bottom_attach">4</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_blocks_read">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ </widget>
+ <packing>
+ <property
name="left_attach">1</property>
+ <property
name="right_attach">2</property>
+ <property
name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_blocks_read_hit">
+ <property
name="visible">True</property>
+ <property
name="xalign">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"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_read_hit_ratio">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ </widget>
+ <packing>
+ <property
name="left_attach">1</property>
+ <property
name="right_attach">2</property>
+ <property
name="top_attach">3</property>
+ <property
name="bottom_attach">4</property>
+ <property
name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label121">
+ <property
name="visible">True</property>
+ <property
name="has_tooltip">True</property>
+ <property
name="tooltip" translatable="yes">The total number of read operations performed
since this session was started.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Reads:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">2</property>
+ <property
name="bottom_attach">3</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_reads">
+ <property
name="visible">True</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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label133">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Read</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame"
id="frame36">
+ <property
name="visible">True</property>
+ <property
name="label_xalign">0</property>
+ <property
name="shadow_type">none</property>
+ <child>
+ <widget
class="GtkAlignment" id="alignment57">
+ <property
name="visible">True</property>
+ <property
name="left_padding">12</property>
+ <child>
+ <widget
class="GtkTable" id="table20">
+ <property
name="visible">True</property>
+ <property
name="n_rows">2</property>
+ <property
name="n_columns">2</property>
+ <property
name="column_spacing">5</property>
+ <child>
+ <widget
class="GtkLabel" id="label123">
+ <property
name="visible">True</property>
+ <property
name="tooltip" translatable="yes">The number of 16 KiB blocks currently in the
disk cache. This includes both read and write cache.</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Cache Size:</property>
+ </widget>
+ <packing>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label117">
+ <property
name="visible">True</property>
+ <property
name="xalign">0</property>
+ <property
name="label" translatable="yes">Read Cache Size:</property>
+ </widget>
+ <packing>
+ <property
name="top_attach">1</property>
+ <property
name="bottom_attach">2</property>
+ <property
name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_cache_size">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ </widget>
+ <packing>
+ <property
name="left_attach">1</property>
+ <property
name="right_attach">2</property>
+ <property
name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkLabel" id="label_cache_read_cache_size">
+ <property
name="visible">True</property>
+ <property
name="xalign">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"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label134">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Size</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget
class="GtkHButtonBox" id="hbuttonbox3">
+ <property
name="visible">True</property>
+ <property
name="layout_style">start</property>
+ <child>
+ <widget
class="GtkButton" id="button_cache_refresh">
+ <property name="label"
translatable="yes">gtk-refresh</property>
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="receives_default">True</property>
+ <property
name="use_stock">True</property>
+ <signal name="clicked"
handler="on_button_cache_refresh_clicked"/>
+ </widget>
+ <packing>
+ <property
name="expand">False</property>
+ <property
name="fill">False</property>
+ <property
name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label113">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Status</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">9</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -4687,7 +5235,7 @@
</child>
</widget>
<packing>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
<child>
@@ -4696,15 +5244,6 @@
<property name="type">tab</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
</widget>
<packing>
<property name="resize">True</property>
Modified: trunk/deluge/ui/gtkui/preferences.py
===================================================================
--- trunk/deluge/ui/gtkui/preferences.py 2009-06-24 05:41:30 UTC (rev
5416)
+++ trunk/deluge/ui/gtkui/preferences.py 2009-06-25 23:58:54 UTC (rev
5417)
@@ -69,7 +69,8 @@
# Add the default categories
i = 0
for category in [_("Downloads"), _("Network"), _("Bandwidth"),
_("Interface"),
- _("Other"), _("Daemon"), _("Queue"), _("Proxy"),
_("Notification"), _("Plugins")]:
+ _("Other"), _("Daemon"), _("Queue"), _("Proxy"), _("Notification"),
+ _("Cache"), _("Plugins")]:
self.liststore.append([i, category])
i += 1
@@ -188,6 +189,10 @@
def _on_get_listen_port(port):
self.active_port = port
+
client.core.get_cache_status().addCallback(_on_get_cache_status)
+
+ def _on_get_cache_status(status):
+ self.cache_status = status
self._show()
# This starts a series of client.core requests prior to showing
the window
@@ -281,6 +286,8 @@
"chk_seed_ratio": ("active",
self.core_config["stop_seed_at_ratio"]),
"spin_share_ratio": ("value",
self.core_config["stop_seed_ratio"]),
"chk_remove_ratio": ("active",
self.core_config["remove_seed_at_ratio"]),
+ "spin_cache_size": ("value", self.core_config["cache_size"]),
+ "spin_cache_expiry": ("value",
self.core_config["cache_expiry"])
}
# Add proxy stuff
for t in ("peer", "web_seed", "tracker", "dht"):
@@ -409,6 +416,8 @@
"spin_share_ratio_limit",
"spin_seed_time_ratio_limit",
"spin_seed_time_limit",
+ "spin_cache_size",
+ "spin_cache_expiry"
]
for t in ("peer", "web_seed", "tracker", "dht"):
core_widget_list.append("spin_proxy_port_%s" % t)
@@ -478,6 +487,9 @@
elif self.gtkui_config["ntf_security"] == 'TLS':
self.glade.get_widget("rad_ntf_tls").set_active(True)
+ ## Cache tab ##
+ self.__update_cache_status()
+
## Plugins tab ##
all_plugins = self.all_plugins
enabled_plugins = self.enabled_plugins
@@ -754,6 +766,25 @@
def hide(self):
self.pref_dialog.hide()
+ def __update_cache_status(self):
+ # Updates the cache status labels with the info in the dict
+ for widget in self.glade.get_widget_prefix("label_cache_"):
+ key = widget.get_name()[len("label_cache_"):]
+ value = self.cache_status[key]
+ if type(value) == float:
+ value = "%.2f" % value
+ else:
+ value = str(value)
+
+ widget.set_text(value)
+
+ def on_button_cache_refresh_clicked(self, widget):
+ def on_get_cache_status(status):
+ self.cache_status = status
+ self.__update_cache_status()
+
+ client.core.get_cache_status().addCallback(on_get_cache_status)
+
def on_pref_dialog_delete_event(self, widget, event):
self.hide()
return True
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---
