From cf58aa780a9ec925f58ab587028cc5d1de1f1a82 Mon Sep 17 00:00:00 2001 From: Asmageddon Date: Tue, 29 May 2012 23:51:00 +0200 Subject: [PATCH] Added an audible bell on torrent completion (optional, off by default) --- deluge/ui/console/eventlog.py | 5 ++++- deluge/ui/console/modes/alltorrents.py | 3 ++- deluge/ui/console/modes/preference_panes.py | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/eventlog.py b/deluge/ui/console/eventlog.py index 3956030a3..264b055a7 100644 --- a/deluge/ui/console/eventlog.py +++ b/deluge/ui/console/eventlog.py @@ -40,6 +40,7 @@ import deluge.common import colors from deluge.ui.client import client +import curses import time log = logging.getLogger(__name__) @@ -68,6 +69,7 @@ class EventLog(component.Component): self.previous_time = time.localtime(0) def on_torrent_added_event(self, torrent_id, from_state): + if from_state: return def on_torrent_status(status): self.write("{!green!}Torrent Added{!input!}(from_state=%s): {!info!}%s (%s)" % ( from_state, status["name"], torrent_id) @@ -89,11 +91,12 @@ class EventLog(component.Component): if state in colors.state_color: state = colors.state_color[state] + state - #self.write("State change: %s {!info!}%s (%s)" % self.write("%s: {!info!}%s ({!cyan!}%s{!info!})" % (state, self.console.get_torrent_name(torrent_id), torrent_id)) def on_torrent_finished_event(self, torrent_id): + if component.get("AllTorrents").config["ring_bell"]: + curses.beep() self.write("{!info!}Torrent Finished: %s (%s)" % (self.console.get_torrent_name(torrent_id), torrent_id)) diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index b4a705f7a..5474458a5 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -175,7 +175,8 @@ DEFAULT_PREFS = { "torrents_per_tab_press": 15, "sort_primary": "queue", "sort_secondary": "name", - "separate_complete": True + "separate_complete": True, + "ring_bell": False } column_pref_names = ["queue","name","size","state", diff --git a/deluge/ui/console/modes/preference_panes.py b/deluge/ui/console/modes/preference_panes.py index a661b9e7c..e85d0476d 100644 --- a/deluge/ui/console/modes/preference_panes.py +++ b/deluge/ui/console/modes/preference_panes.py @@ -317,6 +317,7 @@ class InterfacePane(BasePane): self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"]) self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"]) self.add_int_spin_input("torrents_per_tab_press","Torrents per tab press",parent.console_config["torrents_per_tab_press"], 5, 100) + self.add_checked_input("ring_bell","Ring system bell when a download finishes",parent.console_config["ring_bell"]) self.add_header("Columns To Display", True)