Merge Heads.
This commit is contained in:
parent
7061e09a8e
commit
67c0f8609b
|
@ -49,6 +49,7 @@ class DelugeEventMetaClass(type):
|
|||
"""
|
||||
def __init__(cls, name, bases, dct):
|
||||
super(DelugeEventMetaClass, cls).__init__(name, bases, dct)
|
||||
if name != "DelugeEvent":
|
||||
known_events[name] = cls
|
||||
|
||||
class DelugeEvent(object):
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
cd /home/vampas/projects/DelugeNotify/deluge/plugins/freespace
|
||||
mkdir temp
|
||||
export PYTHONPATH=./temp
|
||||
python setup.py build develop --install-dir ./temp
|
||||
cp ./temp/FreeSpace.egg-link .config/plugins
|
||||
rm -fr ./temp
|
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# __init__.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
from deluge.plugins.init import PluginInitBase
|
||||
|
||||
class CorePlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from core import Core as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(CorePlugin, self).__init__(plugin_name)
|
||||
|
||||
class GtkUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from gtkui import GtkUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(GtkUIPlugin, self).__init__(plugin_name)
|
||||
|
||||
class WebUIPlugin(PluginInitBase):
|
||||
def __init__(self, plugin_name):
|
||||
from webui import WebUI as _plugin_cls
|
||||
self._plugin_cls = _plugin_cls
|
||||
super(WebUIPlugin, self).__init__(plugin_name)
|
|
@ -0,0 +1,42 @@
|
|||
#
|
||||
# common.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
def get_resource(filename):
|
||||
import pkg_resources, os
|
||||
return pkg_resources.resource_filename("freespace", os.path.join("data", filename))
|
|
@ -0,0 +1,201 @@
|
|||
#
|
||||
# core.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
|
||||
import os, statvfs
|
||||
from datetime import datetime, timedelta
|
||||
from twisted.internet import task
|
||||
from deluge.log import LOG as log
|
||||
from deluge.plugins.pluginbase import CorePluginBase
|
||||
from deluge.event import DelugeEvent
|
||||
import deluge.component as component
|
||||
import deluge.configmanager
|
||||
from deluge.core.rpcserver import export
|
||||
|
||||
|
||||
class LowDiskSpaceEvent(DelugeEvent):
|
||||
"""Triggered when the available space for a specific path is getting
|
||||
too low.
|
||||
"""
|
||||
def __init__(self, percents_dict):
|
||||
"""
|
||||
:param percents: dictionary of path keys with their respecive
|
||||
occupation percentages.
|
||||
"""
|
||||
self._args = [percents_dict]
|
||||
|
||||
DEFAULT_PREFS = {
|
||||
"enabled": False,
|
||||
"percent": 90
|
||||
}
|
||||
|
||||
class Core(CorePluginBase):
|
||||
CLEANUP_TIMEOUT_SECS = 3600 # One hour
|
||||
|
||||
def enable(self):
|
||||
self.config = deluge.configmanager.ConfigManager("freespace.conf",
|
||||
DEFAULT_PREFS)
|
||||
self.notifications_sent = {}
|
||||
|
||||
if not self._timer:
|
||||
self._timer = task.LoopingCall(self.update)
|
||||
else:
|
||||
self._timer.stop()
|
||||
self._interval = 15 #60
|
||||
if self.config['enabled']:
|
||||
self._timer.start(self._interval, False)
|
||||
|
||||
self._cleanup = task.LoopingCall(self.__cleanup_notifications)
|
||||
self._cleanup.start(self._interval, False)
|
||||
|
||||
try:
|
||||
component.get("CorePlugin.Notifications"). \
|
||||
register_custom_email_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_email_notification
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
component.get("EventManager").register_event_handler(
|
||||
"PluginEnabledEvent", self.__on_plugin_enabled
|
||||
)
|
||||
component.get("EventManager").register_event_handler(
|
||||
"PluginDisabledEvent", self.__on_plugin_disabled
|
||||
)
|
||||
|
||||
def disable(self):
|
||||
try:
|
||||
component.get("CorePlugin.Notifications"). \
|
||||
deregister_custom_email_notification("LowDiskSpaceEvent")
|
||||
except KeyError:
|
||||
pass
|
||||
component.get("EventManager").deregister_event_handler(
|
||||
"PluginEnabledEvent", self.__on_plugin_enabled
|
||||
)
|
||||
component.get("EventManager").deregister_event_handler(
|
||||
"PluginDisabledEvent", self.__on_plugin_disabled
|
||||
)
|
||||
self._cleanup.stop()
|
||||
|
||||
def update(self):
|
||||
log.debug('\n\nUpdating %s FreeSpace', self.__class__.__name__)
|
||||
nots = {}
|
||||
for path in self.__gather_paths_to_check():
|
||||
log.debug("Checking path %s", path)
|
||||
free_percent = self.__get_free_space(path)
|
||||
if (100 - free_percent) > self.config['percent']:
|
||||
if path not in self.notifications_sent:
|
||||
self.notifications_sent[path] = datetime.utcnow()
|
||||
nots[path] = (100 - free_percent)
|
||||
else:
|
||||
log.warning("Running low on disk space on %s but "
|
||||
"notifications were already triggered.", path)
|
||||
if nots:
|
||||
component.get("EventManager").emit(LowDiskSpaceEvent(nots))
|
||||
|
||||
|
||||
@export
|
||||
def set_config(self, config):
|
||||
"sets the config dictionary"
|
||||
if not self.config['enabled'] and config['enabled']:
|
||||
self._timer.start(self._interval, False)
|
||||
elif self.config['enabled'] and not config['enabled']:
|
||||
self._timer.stop()
|
||||
|
||||
for key in config.keys():
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
@export
|
||||
def get_config(self):
|
||||
"returns the config dictionary"
|
||||
return self.config.config
|
||||
|
||||
def __gather_paths_to_check(self):
|
||||
self.over_percentage = {}
|
||||
torrent_manager = component.get('TorrentManager')
|
||||
paths = set()
|
||||
for torrent_id in torrent_manager.get_torrent_list():
|
||||
status = torrent_manager[torrent_id].get_status([
|
||||
'is_finished',
|
||||
'move_on_completed_path',
|
||||
'save_path'
|
||||
])
|
||||
if not status['is_finished']:
|
||||
paths.add(status['move_on_completed_path'])
|
||||
paths.add(status['save_path'])
|
||||
return paths
|
||||
|
||||
def __get_free_space(self, path):
|
||||
log.debug("Calculating free space on %s", path)
|
||||
stat = os.statvfs(path)
|
||||
free_blocks = stat[statvfs.F_BAVAIL]
|
||||
total_blocks = stat[statvfs.F_BLOCKS]
|
||||
free_percent = free_blocks * 100 / total_blocks
|
||||
return free_percent
|
||||
|
||||
def __custom_email_notification(self, ocupied_percents):
|
||||
|
||||
subject = _("Low Disk Space Warning")
|
||||
message = _("You're running low on disk space:\n")
|
||||
|
||||
for path, ocupied_percent in ocupied_percents.iteritems():
|
||||
message += _(' %s%% ocupation in %s\n') % (ocupied_percent, path)
|
||||
# "\"%s\"%% space occupation on %s") % (ocupied_percent, path)
|
||||
return subject, message
|
||||
|
||||
def __on_plugin_enabled(self, plugin_name):
|
||||
if plugin_name == 'Notifications':
|
||||
component.get("CorePlugin.Notifications"). \
|
||||
register_custom_email_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_email_notification
|
||||
)
|
||||
|
||||
def __on_plugin_disabled(self, plugin_name):
|
||||
if plugin_name == 'Notifications':
|
||||
component.get("CorePlugin.Notifications"). \
|
||||
deregister_custom_email_notification("LowDiskSpaceEvent")
|
||||
|
||||
def __cleanup_notifications(self):
|
||||
now = datetime.now()
|
||||
for path, when in self.notifications_sent.copy().iteritems():
|
||||
if when <= (now -timedelta(seconds=self.CLEANUP_TIMEOUT_SECS)):
|
||||
log.debug("Removing old(%s) path from notified paths: %s",
|
||||
when, path)
|
||||
self.notifications_sent.pop(path)
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<child>
|
||||
<widget class="GtkHBox" id="prefs_box">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="enabled">
|
||||
<property name="label" translatable="yes">Consider low when</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSpinButton" id="percent">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="max_length">2</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="adjustment">90 0 99 1 10 0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label14">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">%</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">of the disk is occupied.</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Free Space Checking</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>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
Script: freespace.js
|
||||
The client-side javascript code for the FreeSpace plugin.
|
||||
|
||||
Copyright:
|
||||
(C) Pedro Algarvio 2009 <damoxc@gmail.com>
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, write to:
|
||||
The Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
In addition, as a special exception, the copyright holders give
|
||||
permission to link the code of portions of this program with the OpenSSL
|
||||
library.
|
||||
You must obey the GNU General Public License in all respects for all of
|
||||
the code used other than OpenSSL. If you modify file(s) with this
|
||||
exception, you may extend this exception to your version of the file(s),
|
||||
but you are not obligated to do so. If you do not wish to do so, delete
|
||||
this exception statement from your version. If you delete this exception
|
||||
statement from all source files in the program, then also delete it here.
|
||||
*/
|
||||
|
||||
FreeSpacePlugin = Ext.extend(Deluge.Plugin, {
|
||||
constructor: function(config) {
|
||||
config = Ext.apply({
|
||||
name: "FreeSpace"
|
||||
}, config);
|
||||
FreeSpacePlugin.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
onDisable: function() {
|
||||
|
||||
},
|
||||
|
||||
onEnable: function() {
|
||||
|
||||
}
|
||||
});
|
||||
new FreeSpacePlugin();
|
|
@ -0,0 +1,174 @@
|
|||
#
|
||||
# gtkui.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
import gtk
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.ui.client import client
|
||||
from deluge.plugins.pluginbase import GtkPluginBase
|
||||
import deluge.component as component
|
||||
import deluge.common
|
||||
|
||||
from common import get_resource
|
||||
|
||||
class GtkUI(GtkPluginBase):
|
||||
|
||||
def enable(self):
|
||||
log.debug('\n\nEnabling %s FreeSpace', self.__class__.__name__)
|
||||
self.glade = gtk.glade.XML(get_resource("config.glade"))
|
||||
self.prefs = self.glade.get_widget('prefs_box')
|
||||
parent = self.prefs.get_parent()
|
||||
if parent:
|
||||
parent.remove(self.prefs)
|
||||
|
||||
# chk_ap = component.get("Preferences").glade.get_widget('chk_add_paused')
|
||||
# downloads_vbox = chk_ap.get_parent().get_parent().get_parent().get_parent()
|
||||
|
||||
downloads_vbox = component.get("Preferences").glade.get_widget('vbox1')
|
||||
downloads_vbox.pack_start(self.prefs, False, True, 0)
|
||||
# self.prefs.set_parent(frame)
|
||||
|
||||
# component.get("Preferences").add_page("FreeSpace", self.glade.get_widget("prefs_box"))
|
||||
component.get("PluginManager").register_hook("on_apply_prefs",
|
||||
self.on_apply_prefs)
|
||||
component.get("PluginManager").register_hook("on_show_prefs",
|
||||
self.on_show_prefs)
|
||||
|
||||
try:
|
||||
notifications = component.get("GtkPlugin.Notifications")
|
||||
notifications.register_custom_popup_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_popup_notification
|
||||
)
|
||||
notifications.register_custom_blink_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_blink_notification
|
||||
)
|
||||
notifications.register_custom_sound_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_sound_notification
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
client.register_event_handler("PluginEnabledEvent",
|
||||
self.__on_plugin_enabled)
|
||||
|
||||
client.register_event_handler("PluginDisabledEvent",
|
||||
self.__on_plugin_disabled)
|
||||
|
||||
def disable(self):
|
||||
component.get("Preferences").remove_page("FreeSpace")
|
||||
component.get("PluginManager").deregister_hook("on_apply_prefs",
|
||||
self.on_apply_prefs)
|
||||
component.get("PluginManager").deregister_hook("on_show_prefs",
|
||||
self.on_show_prefs)
|
||||
try:
|
||||
notifications = component.get("GtkPlugin.Notifications")
|
||||
notifications.deregister_custom_popup_notification(
|
||||
"LowDiskSpaceEvent"
|
||||
)
|
||||
notifications.deregister_custom_blink_notification(
|
||||
"LowDiskSpaceEvent"
|
||||
)
|
||||
notifications.deregister_custom_sound_notification(
|
||||
"LowDiskSpaceEvent"
|
||||
)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
client.deregister_event_handler("PluginEnabledEvent",
|
||||
self.__on_plugin_enabled)
|
||||
|
||||
client.deregister_event_handler("PluginDisabledEvent",
|
||||
self.__on_plugin_disabled)
|
||||
|
||||
def on_apply_prefs(self):
|
||||
log.debug("applying prefs for FreeSpace")
|
||||
config = {
|
||||
"enabled": self.glade.get_widget('enabled').get_active(),
|
||||
"percent": self.glade.get_widget('percent').get_value()
|
||||
}
|
||||
client.freespace.set_config(config)
|
||||
|
||||
def on_show_prefs(self):
|
||||
client.freespace.get_config().addCallback(self.cb_get_config)
|
||||
|
||||
def cb_get_config(self, config):
|
||||
"callback for on show_prefs"
|
||||
self.glade.get_widget('enabled').set_active(config['enabled'])
|
||||
self.glade.get_widget('percent').set_value(config['percent'])
|
||||
|
||||
def __custom_popup_notification(self, ocupied_percents):
|
||||
title = _("Low Free Space")
|
||||
message = ''
|
||||
for path, percent in ocupied_percents.iteritems():
|
||||
message += '%s%% %s\n' % (percent, path)
|
||||
message += '\n'
|
||||
return title, message
|
||||
|
||||
def __custom_blink_notification(self, ocupied_percents):
|
||||
return True # Yes, do blink
|
||||
|
||||
def __custom_sound_notification(self, ocupied_percents):
|
||||
return '' # Use default sound
|
||||
|
||||
def __on_plugin_enabled(self, plugin_name):
|
||||
if plugin_name == 'Notifications':
|
||||
notifications = component.get("GtkPlugin.Notifications")
|
||||
notifications.register_custom_popup_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_popup_notification
|
||||
)
|
||||
notifications.register_custom_blink_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_blink_notification
|
||||
)
|
||||
notifications.register_custom_sound_notification(
|
||||
"LowDiskSpaceEvent", self.__custom_sound_notification
|
||||
)
|
||||
|
||||
def __on_plugin_disabled(self, plugin_name):
|
||||
pass
|
||||
# if plugin_name == 'Notifications':
|
||||
# notifications = component.get("GtkPlugin.Notifications")
|
||||
# notifications.deregister_custom_popup_notification(
|
||||
# "LowDiskSpaceEvent"
|
||||
# )
|
||||
# notifications.deregister_custom_blink_notification(
|
||||
# "LowDiskSpaceEvent"
|
||||
# )
|
||||
# notifications.deregister_custom_sound_notification(
|
||||
# "LowDiskSpaceEvent"
|
||||
# )
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# webui.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
from deluge.log import LOG as log
|
||||
from deluge.ui.client import client
|
||||
from deluge import component
|
||||
from deluge.plugins.pluginbase import WebPluginBase
|
||||
|
||||
from common import get_resource
|
||||
|
||||
class WebUI(WebPluginBase):
|
||||
|
||||
scripts = [get_resource("freespace.js")]
|
||||
|
||||
def enable(self):
|
||||
pass
|
||||
|
||||
def disable(self):
|
||||
pass
|
|
@ -0,0 +1,73 @@
|
|||
#
|
||||
# setup.py
|
||||
#
|
||||
# Copyright (C) 2009 Pedro Algarvio <ufs@ufsoft.org>
|
||||
#
|
||||
# Basic plugin template created by:
|
||||
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
|
||||
# Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com>
|
||||
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
||||
#
|
||||
# Deluge is free software.
|
||||
#
|
||||
# You may redistribute it and/or modify it under the terms of the
|
||||
# GNU General Public License, as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# deluge is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with deluge. If not, write to:
|
||||
# The Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# In addition, as a special exception, the copyright holders give
|
||||
# permission to link the code of portions of this program with the OpenSSL
|
||||
# library.
|
||||
# You must obey the GNU General Public License in all respects for all of
|
||||
# the code used other than OpenSSL. If you modify file(s) with this
|
||||
# exception, you may extend this exception to your version of the file(s),
|
||||
# but you are not obligated to do so. If you do not wish to do so, delete
|
||||
# this exception statement from your version. If you delete this exception
|
||||
# statement from all source files in the program, then also delete it here.
|
||||
#
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
__plugin_name__ = "FreeSpace"
|
||||
__author__ = "Pedro Algarvio"
|
||||
__author_email__ = "ufs@ufsoft.org"
|
||||
__version__ = "0.1"
|
||||
__url__ = "http://deluge.ufsoft.org/hg/Notification/"
|
||||
__license__ = "GPLv3"
|
||||
__description__ = ""
|
||||
__long_description__ = """"""
|
||||
__pkg_data__ = {__plugin_name__.lower(): ["template/*", "data/*"]}
|
||||
|
||||
setup(
|
||||
name=__plugin_name__,
|
||||
version=__version__,
|
||||
description=__description__,
|
||||
author=__author__,
|
||||
author_email=__author_email__,
|
||||
url=__url__,
|
||||
license=__license__,
|
||||
long_description=__long_description__ if __long_description__ else __description__,
|
||||
|
||||
packages=[__plugin_name__.lower()],
|
||||
package_data = __pkg_data__,
|
||||
|
||||
entry_points="""
|
||||
[deluge.plugin.core]
|
||||
%s = %s:CorePlugin
|
||||
[deluge.plugin.gtkui]
|
||||
%s = %s:GtkUIPlugin
|
||||
[deluge.plugin.webui]
|
||||
%s = %s:WebUIPlugin
|
||||
""" % ((__plugin_name__, __plugin_name__.lower())*3)
|
||||
)
|
|
@ -55,6 +55,8 @@ except ImportError:
|
|||
try:
|
||||
import pynotify
|
||||
POPUP_AVAILABLE = True
|
||||
if deluge.common.windows_check():
|
||||
POPUP_AVAILABLE = False
|
||||
except ImportError:
|
||||
POPUP_AVAILABLE = False
|
||||
|
||||
|
@ -65,11 +67,10 @@ def get_resource(filename):
|
|||
os.path.join("data", filename))
|
||||
|
||||
|
||||
class CustomNotifications(component.Component):
|
||||
class CustomNotifications(object):
|
||||
config = None # shut-up pylint
|
||||
|
||||
def __init__(self, plugin_name=None):
|
||||
component.Component.__init__(self, "Notifications")
|
||||
self.custom_notifications = {
|
||||
"email": {},
|
||||
"popup": {},
|
||||
|
@ -133,14 +134,6 @@ class CustomNotifications(component.Component):
|
|||
if eventtype not in known_events:
|
||||
log.error("The event \"%s\" is not known" % eventtype)
|
||||
return False
|
||||
log.debug('\n\nKLASSS %s: %s: %s',
|
||||
handler.__class__,
|
||||
isinstance(handler.__class__, self.__class__),
|
||||
handler in dir(self))
|
||||
log.debug(dir(handler))
|
||||
log.debug(handler.im_self)
|
||||
log.debug(self)
|
||||
log.debug("IM SELF: %s", handler.im_self is self)
|
||||
if known_events[eventtype].__module__.startswith('deluge.event'):
|
||||
if handler.im_self is self:
|
||||
return True
|
||||
|
@ -220,6 +213,13 @@ Subject: %(subject)s
|
|||
message = '\r\n'.join((headers + message).splitlines())
|
||||
|
||||
try:
|
||||
try:
|
||||
# Python 2.6
|
||||
server = smtplib.SMTP(self.config["smtp_host"],
|
||||
self.config["smtp_port"],
|
||||
timeout=60)
|
||||
except:
|
||||
# Python 2.6
|
||||
server = smtplib.SMTP(self.config["smtp_host"],
|
||||
self.config["smtp_port"])
|
||||
except Exception, err:
|
||||
|
|
|
@ -202,8 +202,6 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
|
|||
column.set_property('visible', False)
|
||||
self.sounds_treeview.append_column(column)
|
||||
|
||||
self.sounds_treeview.connect("button-press-event",
|
||||
self.on_sounds_treeview_clicked)
|
||||
self.sounds_treeview.set_model(self.sounds_model)
|
||||
|
||||
def build_notifications_model_populate_treeview(self):
|
||||
|
|
|
@ -3922,390 +3922,6 @@ HTTP W/ Auth</property>
|
|||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow10">
|
||||
<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="viewport11">
|
||||
<property name="visible">True</property>
|
||||
<property name="resize_mode">queue</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox23">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label66">
|
||||
<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>Notification</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="hseparator10">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment31">
|
||||
<property name="visible">True</property>
|
||||
<property name="right_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox24">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame24">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment32">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">5</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table6">
|
||||
<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="GtkCheckButton" id="chk_ntf_sound">
|
||||
<property name="label" translatable="yes">Sound:</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip" translatable="yes">Only OGG and WAV files are supported</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</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="GtkCheckButton" id="chk_ntf_popup">
|
||||
<property name="label" translatable="yes">Popup</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip" translatable="yes">Not available on Windows</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<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="GtkCheckButton" id="chk_ntf_tray_blink">
|
||||
<property name="label" translatable="yes">Blinking tray icon</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="combo_ntf_sound_path">
|
||||
<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>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label67">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>General</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="frame25">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment33">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">5</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table7">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">6</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label70">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Security:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox16">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="rad_ntf_none">
|
||||
<property name="label" translatable="yes">None</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="rad_ntf_ssl">
|
||||
<property name="label" translatable="yes">SSL</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">rad_ntf_none</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="rad_ntf_tls">
|
||||
<property name="label" translatable="yes">TLS</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">rad_ntf_none</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label69">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Password:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="txt_ntf_pass">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="visibility">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label68">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Username:</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="GtkEntry" id="txt_ntf_username">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</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>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label74">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Server:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="txt_ntf_server">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">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>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label76">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Address:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="txt_ntf_email">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">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>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_ntf_email">
|
||||
<property name="label" translatable="yes">Enable</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label75">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Email</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="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">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow13">
|
||||
<property name="visible">True</property>
|
||||
|
@ -4842,7 +4458,7 @@ HTTP W/ Auth</property>
|
|||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">9</property>
|
||||
<property name="position">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -4851,6 +4467,15 @@ HTTP W/ Auth</property>
|
|||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow5">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -464,35 +464,6 @@ class Preferences(component.Component):
|
|||
self.glade.get_widget("chk_show_new_releases").set_active(
|
||||
self.gtkui_config["show_new_releases"])
|
||||
|
||||
## Notification tab ##
|
||||
self.glade.get_widget("chk_ntf_tray_blink").set_active(
|
||||
self.gtkui_config["ntf_tray_blink"])
|
||||
if deluge.common.windows_check():
|
||||
self.glade.get_widget("chk_ntf_popup").set_sensitive(False)
|
||||
else:
|
||||
self.glade.get_widget("chk_ntf_popup").set_active(
|
||||
self.gtkui_config["ntf_popup"])
|
||||
self.glade.get_widget("chk_ntf_email").set_active(
|
||||
self.gtkui_config["ntf_email"])
|
||||
self.glade.get_widget("chk_ntf_sound").set_active(
|
||||
self.gtkui_config["ntf_sound"])
|
||||
if self.gtkui_config["ntf_sound_path"]:
|
||||
self.glade.get_widget("combo_ntf_sound_path").set_filename(self.gtkui_config["ntf_sound_path"])
|
||||
self.glade.get_widget("txt_ntf_email").set_text(
|
||||
self.gtkui_config["ntf_email_add"])
|
||||
self.glade.get_widget("txt_ntf_server").set_text(
|
||||
self.gtkui_config["ntf_server"])
|
||||
self.glade.get_widget("txt_ntf_username").set_text(
|
||||
self.gtkui_config["ntf_username"])
|
||||
self.glade.get_widget("txt_ntf_pass").set_text(
|
||||
self.gtkui_config["ntf_pass"])
|
||||
if not self.gtkui_config["ntf_security"]:
|
||||
self.glade.get_widget("rad_ntf_none").set_active(True)
|
||||
elif self.gtkui_config["ntf_security"] == 'SSL':
|
||||
self.glade.get_widget("rad_ntf_none").set_active(True)
|
||||
elif self.gtkui_config["ntf_security"] == 'TLS':
|
||||
self.glade.get_widget("rad_ntf_tls").set_active(True)
|
||||
|
||||
## Cache tab ##
|
||||
if client.connected():
|
||||
self.__update_cache_status()
|
||||
|
@ -658,32 +629,6 @@ class Preferences(component.Component):
|
|||
new_gtkui_config["show_rate_in_title"] = \
|
||||
self.glade.get_widget("chk_show_rate_in_title").get_active()
|
||||
|
||||
## Notification tab ##
|
||||
new_gtkui_config["ntf_tray_blink"] = \
|
||||
self.glade.get_widget("chk_ntf_tray_blink").get_active()
|
||||
new_gtkui_config["ntf_popup"] = \
|
||||
self.glade.get_widget("chk_ntf_popup").get_active()
|
||||
new_gtkui_config["ntf_sound"] = \
|
||||
self.glade.get_widget("chk_ntf_sound").get_active()
|
||||
new_gtkui_config["ntf_email"] = \
|
||||
self.glade.get_widget("chk_ntf_email").get_active()
|
||||
new_gtkui_config["ntf_email_add"] = \
|
||||
self.glade.get_widget("txt_ntf_email").get_text()
|
||||
new_gtkui_config["ntf_username"] = \
|
||||
self.glade.get_widget("txt_ntf_username").get_text()
|
||||
new_gtkui_config["ntf_pass"] = \
|
||||
self.glade.get_widget("txt_ntf_pass").get_text()
|
||||
new_gtkui_config["ntf_server"] = \
|
||||
self.glade.get_widget("txt_ntf_server").get_text()
|
||||
new_gtkui_config["ntf_sound_path"] = \
|
||||
self.glade.get_widget("combo_ntf_sound_path").get_filename()
|
||||
if self.glade.get_widget("rad_ntf_none").get_active():
|
||||
new_gtkui_config["ntf_security"] = None
|
||||
elif self.glade.get_widget("rad_ntf_ssl").get_active():
|
||||
new_gtkui_config["ntf_security"] = 'SSL'
|
||||
elif self.glade.get_widget("rad_ntf_tls").get_active():
|
||||
new_gtkui_config["ntf_security"] = 'TLS'
|
||||
|
||||
## Other tab ##
|
||||
new_gtkui_config["show_new_releases"] = \
|
||||
self.glade.get_widget("chk_show_new_releases").get_active()
|
||||
|
|
Loading…
Reference in New Issue