summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/Notifications/deluge_notifications
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins/Notifications/deluge_notifications')
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/__init__.py9
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/common.py5
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/core.py8
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/config.ui10
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/config.ui~643
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/data/notifications.js46
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/gtkui.py17
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/test.py11
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/webui.py3
9 files changed, 41 insertions, 711 deletions
diff --git a/deluge/plugins/Notifications/deluge_notifications/__init__.py b/deluge/plugins/Notifications/deluge_notifications/__init__.py
index 810e284..d52b48d 100644
--- a/deluge/plugins/Notifications/deluge_notifications/__init__.py
+++ b/deluge/plugins/Notifications/deluge_notifications/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
@@ -22,7 +19,7 @@ class CorePlugin(PluginInitBase):
from .core import Core as _pluginCls
self._plugin_cls = _pluginCls
- super(CorePlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class GtkUIPlugin(PluginInitBase):
@@ -30,7 +27,7 @@ class GtkUIPlugin(PluginInitBase):
from .gtkui import GtkUI as _pluginCls
self._plugin_cls = _pluginCls
- super(GtkUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
class WebUIPlugin(PluginInitBase):
@@ -38,4 +35,4 @@ class WebUIPlugin(PluginInitBase):
from .webui import WebUI as _pluginCls
self._plugin_cls = _pluginCls
- super(WebUIPlugin, self).__init__(plugin_name)
+ super().__init__(plugin_name)
diff --git a/deluge/plugins/Notifications/deluge_notifications/common.py b/deluge/plugins/Notifications/deluge_notifications/common.py
index 6966122..9993f5c 100644
--- a/deluge/plugins/Notifications/deluge_notifications/common.py
+++ b/deluge/plugins/Notifications/deluge_notifications/common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
@@ -30,7 +27,7 @@ def get_resource(filename):
return resource_filename(__package__, os.path.join('data', filename))
-class CustomNotifications(object):
+class CustomNotifications:
def __init__(self, plugin_name=None):
self.custom_notifications = {'email': {}, 'popup': {}, 'blink': {}, 'sound': {}}
diff --git a/deluge/plugins/Notifications/deluge_notifications/core.py b/deluge/plugins/Notifications/deluge_notifications/core.py
index 123f9cf..aa200f9 100644
--- a/deluge/plugins/Notifications/deluge_notifications/core.py
+++ b/deluge/plugins/Notifications/deluge_notifications/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import smtplib
from email.utils import formatdate
@@ -119,7 +116,6 @@ Date: %(date)s
message = '\r\n'.join((headers + message).splitlines())
try:
- # Python 2.6
server = smtplib.SMTP(
self.config['smtp_host'], self.config['smtp_port'], timeout=60
)
@@ -152,7 +148,7 @@ Date: %(date)s
try:
try:
- server.sendmail(self.config['smtp_from'], to_addrs, message)
+ server.sendmail(self.config['smtp_from'], to_addrs, message.encode())
except smtplib.SMTPException as ex:
err_msg = (
_('There was an error sending the notification email: %s') % ex
@@ -176,7 +172,7 @@ Date: %(date)s
def _on_torrent_finished_event(self, torrent_id):
log.debug('Handler for TorrentFinishedEvent called for CORE')
torrent = component.get('TorrentManager')[torrent_id]
- torrent_status = torrent.get_status({})
+ torrent_status = torrent.get_status(['name', 'num_files'])
# Email
subject = _('Finished Torrent "%(name)s"') % torrent_status
message = (
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/config.ui b/deluge/plugins/Notifications/deluge_notifications/data/config.ui
index c16b37a..399cc9e 100644
--- a/deluge/plugins/Notifications/deluge_notifications/data/config.ui
+++ b/deluge/plugins/Notifications/deluge_notifications/data/config.ui
@@ -187,8 +187,6 @@
<object class="GtkEntry" id="smtp_host">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -217,8 +215,6 @@
<property name="can_focus">True</property>
<property name="max_length">5</property>
<property name="width_chars">5</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
<property name="adjustment">adjustment1</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -246,8 +242,6 @@
<object class="GtkEntry" id="smtp_user">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -273,8 +267,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -427,8 +419,6 @@
<object class="GtkEntry" id="smtp_from">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/config.ui~ b/deluge/plugins/Notifications/deluge_notifications/data/config.ui~
deleted file mode 100644
index f26275b..0000000
--- a/deluge/plugins/Notifications/deluge_notifications/data/config.ui~
+++ /dev/null
@@ -1,643 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">1</property>
- <property name="upper">65535</property>
- <property name="value">25</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkWindow" id="window">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkVBox" id="prefs_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkViewport" id="viewport1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="resize_mode">queue</property>
- <child>
- <object class="GtkNotebook" id="notebook1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="show_border">False</property>
- <child>
- <object class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <child>
- <object class="GtkFrame" id="frame2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="margin_left">9</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="blink_enabled">
- <property name="label" translatable="yes">Tray icon blinks enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="popup_enabled">
- <property name="label" translatable="yes">Popups enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="sound_enabled">
- <property name="label" translatable="yes">Sound enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_sound_enabled_toggled" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFileChooserButton" id="sound_path">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="create_folders">False</property>
- <signal name="update-preview" handler="on_sound_path_update_preview" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="padding">2</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin_top">5</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;UI Notifications&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="margin_left">10</property>
- <property name="margin_top">7</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <property name="right_padding">10</property>
- <child>
- <object class="GtkTable" id="prefs_table">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">7</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">2</property>
- <property name="row_spacing">2</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Hostname:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_host">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <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>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Port:</property>
- <property name="justify">right</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="smtp_port">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">5</property>
- <property name="width_chars">5</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="adjustment">adjustment1</property>
- <property name="climb_rate">1</property>
- <property name="numeric">True</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Username:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_user">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Password:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_pass">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="bottom_padding">10</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="smtp_recipients">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="enable_grid_lines">horizontal</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkVButtonBox" id="vbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <property name="layout_style">start</property>
- <child>
- <object class="GtkButton" id="add_button">
- <property name="label">gtk-add</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_add_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="delete_button">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_delete_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">3</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;b&gt;Recipients&lt;/b&gt;</property>
- <property name="margin_bottom">3</property>
- <property name="use_markup">True</property>
- <property name="ypad">0</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="right_attach">4</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="smtp_tls">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="draw_indicator">True</property>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Server requires TLS/SSL</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">From:</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="smtp_from">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="smtp_enabled">
- <property name="label" translatable="yes">Enabled</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_enabled_toggled" swapped="no"/>
- </object>
- <packing>
- <property name="right_attach">4</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes">&lt;b&gt;Email Notifications&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="settings_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Settings</property>
- </object>
- <packing>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">15</property>
- <property name="margin_right">10</property>
- <property name="margin_bottom">10</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="GtkTreeView" id="subscriptions_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="enable_grid_lines">horizontal</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">This configuration does not mean that you'll actually receive notifications for all these events.</property>
- <property name="justify">fill</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">2</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="subscriptions_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Subscriptions</property>
- </object>
- <packing>
- <property name="position">1</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="sounds_page">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">15</property>
- <property name="margin_right">10</property>
- <property name="margin_bottom">10</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <object class="GtkTreeView" id="sounds_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">10</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="sounds_revert_button">
- <property name="label">gtk-revert-to-saved</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_sounds_revert_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="sounds_edit_button">
- <property name="label">gtk-edit</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_sounds_edit_button_clicked" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel" id="sounds_page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sound Customization</property>
- </object>
- <packing>
- <property name="position">2</property>
- <property name="tab_fill">False</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="titlebar">
- <placeholder/>
- </child>
- </object>
-</interface>
diff --git a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
index c9fb71f..4b87e55 100644
--- a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
+++ b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js
@@ -21,7 +21,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.NotificationsPage.superclass.initComponent.call(
this
);
@@ -44,7 +44,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'checkbox',
boxLabel: _('Enabled'),
listeners: {
- check: function(object, checked) {
+ check: function (object, checked) {
this.setSmtpDisabled(!checked);
},
scope: this,
@@ -227,11 +227,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
fields: [{ name: 'recipient' }],
}),
listeners: {
- afteredit: function(e) {
+ afteredit: function (e) {
e.record.commit();
},
},
- setEmptyText: function(text) {
+ setEmptyText: function (text) {
if (this.viewReady) {
this.getView().emptyText = text;
this.getView().refresh();
@@ -239,7 +239,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Ext.apply(this.viewConfig, { emptyText: text });
}
},
- loadData: function(data) {
+ loadData: function (data) {
this.getStore().loadData(data);
if (this.viewReady) {
this.getView().updateHeaders();
@@ -259,7 +259,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
},
colModel: new Ext.grid.ColumnModel({
defaults: {
- renderer: function(
+ renderer: function (
value,
meta,
record,
@@ -310,7 +310,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
],
}),
listeners: {
- cellclick: function(grid, rowIndex, colIndex, e) {
+ cellclick: function (grid, rowIndex, colIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var field = grid.getColumnModel().getDataIndex(colIndex);
var value = record.get(field);
@@ -322,18 +322,18 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
}
}
},
- beforeedit: function(e) {
+ beforeedit: function (e) {
if (Ext.isBoolean(e.value)) {
return false;
}
return e.record.get('enabled');
},
- afteredit: function(e) {
+ afteredit: function (e) {
e.record.commit();
},
},
- setEmptyText: function(text) {
+ setEmptyText: function (text) {
if (this.viewReady) {
this.getView().emptyText = text;
this.getView().refresh();
@@ -341,13 +341,13 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Ext.apply(this.viewConfig, { emptyText: text });
}
},
- setSub: function(eventName) {
+ setSub: function (eventName) {
var store = this.getStore();
var index = store.find('event', eventName);
store.getAt(index).set('email', true);
store.getAt(index).commit();
},
- loadData: function(data) {
+ loadData: function (data) {
this.getStore().loadData(data);
if (this.viewReady) {
this.getView().updateHeaders();
@@ -374,9 +374,9 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.on('show', this.updateConfig, this);
},
- updateConfig: function() {
+ updateConfig: function () {
deluge.client.notifications.get_handled_events({
- success: function(events) {
+ success: function (events) {
var data = [];
var keys = Ext.keys(events);
for (var i = 0; i < keys.length; i++) {
@@ -388,7 +388,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
scope: this,
});
deluge.client.notifications.get_config({
- success: function(config) {
+ success: function (config) {
this.chkEnableEmail.setValue(config['smtp_enabled']);
this.setSmtpDisabled(!config['smtp_enabled']);
@@ -420,7 +420,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
});
},
- onApply: function() {
+ onApply: function () {
var config = {};
config['smtp_enabled'] = this.chkEnableEmail.getValue();
@@ -461,11 +461,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
deluge.client.notifications.set_config(config);
},
- onOk: function() {
+ onOk: function () {
this.onApply();
},
- onAddClick: function() {
+ onAddClick: function () {
var store = this.recipientsFset.getComponent(0).getStore();
var Recipient = store.recordType;
var i = new Recipient({
@@ -476,7 +476,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.recipientsFset.getComponent(0).startEditing(0, 0);
},
- onRemoveClick: function() {
+ onRemoveClick: function () {
var selections = this.recipientsFset
.getComponent(0)
.getSelectionModel()
@@ -488,7 +488,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
store.commitChanges();
},
- setSmtpDisabled: function(disable) {
+ setSmtpDisabled: function (disable) {
this.hBoxHost.setDisabled(disable);
this.hBoxPort.setDisabled(disable);
this.hBoxUser.setDisabled(disable);
@@ -498,7 +498,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
this.recipientsFset.getComponent(0).setDisabled(disable);
},
- onDestroy: function() {
+ onDestroy: function () {
deluge.preferences.un('show', this.updateConfig, this);
Deluge.ux.preferences.NotificationsPage.superclass.onDestroy.call(this);
@@ -508,11 +508,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, {
name: 'Notifications',
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.NotificationsPage()
);
diff --git a/deluge/plugins/Notifications/deluge_notifications/gtkui.py b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
index 816cb36..4dc5ff8 100644
--- a/deluge/plugins/Notifications/deluge_notifications/gtkui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from os.path import basename
@@ -42,7 +39,7 @@ except ImportError:
try:
require_version('Notify', '0.7')
- from gi.repository import Notify
+ from gi.repository import GLib, Notify
except (ValueError, ImportError):
POPUP_AVAILABLE = False
else:
@@ -174,15 +171,17 @@ class GtkUiNotifications(CustomNotifications):
if not self.config['popup_enabled']:
return defer.succeed(_('Popup notification is not enabled.'))
if not POPUP_AVAILABLE:
- return defer.fail(_('libnotify is not installed'))
+ err_msg = _('libnotify is not installed')
+ log.warning(err_msg)
+ return defer.fail(ImportError(err_msg))
if Notify.init('Deluge'):
self.note = Notify.Notification.new(title, message, 'deluge-panel')
- self.note.set_hint('desktop-entry', 'deluge')
+ self.note.set_hint('desktop-entry', GLib.Variant.new_string('deluge'))
if not self.note.show():
err_msg = _('Failed to popup notification')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(Exception(err_msg))
return defer.succeed(_('Notification popup shown'))
def __play_sound(self, sound_path=''):
@@ -191,7 +190,7 @@ class GtkUiNotifications(CustomNotifications):
if not SOUND_AVAILABLE:
err_msg = _('pygame is not installed')
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ImportError(err_msg))
pygame.init()
try:
@@ -203,7 +202,7 @@ class GtkUiNotifications(CustomNotifications):
except pygame.error as ex:
err_msg = _('Sound notification failed %s') % ex
log.warning(err_msg)
- return defer.fail(err_msg)
+ return defer.fail(ex)
else:
msg = _('Sound notification Success')
log.info(msg)
diff --git a/deluge/plugins/Notifications/deluge_notifications/test.py b/deluge/plugins/Notifications/deluge_notifications/test.py
index 2e6f975..013cdbf 100644
--- a/deluge/plugins/Notifications/deluge_notifications/test.py
+++ b/deluge/plugins/Notifications/deluge_notifications/test.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8 et
# ==============================================================================
# Copyright © 2009-2010 UfSoft.org - Pedro Algarvio <pedro@algarvio.me>
@@ -6,8 +5,6 @@
# License: BSD - Please view the LICENSE file for additional information.
# ==============================================================================
-from __future__ import unicode_literals
-
import logging
from twisted.internet import task
@@ -70,14 +67,14 @@ class TestEmailNotifications(component.Component):
def custom_email_message_provider(self, *evt_args, **evt_kwargs):
log.debug('Running custom email message provider: %s %s', evt_args, evt_kwargs)
- subject = '%s Email Subject: %s' % (self.events[0].__class__.__name__, self.n)
- message = '%s Email Message: %s' % (self.events[0].__class__.__name__, self.n)
+ subject = f'{self.events[0].__class__.__name__} Email Subject: {self.n}'
+ message = f'{self.events[0].__class__.__name__} Email Message: {self.n}'
return subject, message
def custom_popup_message_provider(self, *evt_args, **evt_kwargs):
log.debug('Running custom popup message provider: %s %s', evt_args, evt_kwargs)
- title = '%s Popup Title: %s' % (self.events[0].__class__.__name__, self.n)
- message = '%s Popup Message: %s' % (self.events[0].__class__.__name__, self.n)
+ title = f'{self.events[0].__class__.__name__} Popup Title: {self.n}'
+ message = f'{self.events[0].__class__.__name__} Popup Message: {self.n}'
return title, message
def custom_blink_message_provider(self, *evt_args, **evt_kwargs):
diff --git a/deluge/plugins/Notifications/deluge_notifications/webui.py b/deluge/plugins/Notifications/deluge_notifications/webui.py
index d3529c4..ad090f5 100644
--- a/deluge/plugins/Notifications/deluge_notifications/webui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/webui.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Pedro Algarvio <pedro@algarvio.me>
#
@@ -12,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase