Fix #2409 : Console Non-interactive curses ImportError

This commit is contained in:
Calum Lind 2014-01-27 13:02:26 +00:00
commit 188315735b

View file

@ -36,15 +36,15 @@
import logging import logging
import deluge.component as component import deluge.component as component
import deluge.common from deluge.common import windows_check
import colors import colors
from deluge.ui.client import client from deluge.ui.client import client
import curses
import time import time
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class EventLog(component.Component): class EventLog(component.Component):
""" """
Prints out certain events as they are received from the core. Prints out certain events as they are received from the core.
@ -69,7 +69,9 @@ class EventLog(component.Component):
self.previous_time = time.localtime(0) self.previous_time = time.localtime(0)
def on_torrent_added_event(self, torrent_id, from_state): def on_torrent_added_event(self, torrent_id, from_state):
if from_state: return if from_state:
return
def on_torrent_status(status): def on_torrent_status(status):
self.write("{!green!}Torrent Added: {!info!}%s ({!cyan!}%s{!info!})" % ( self.write("{!green!}Torrent Added: {!info!}%s ({!cyan!}%s{!info!})" % (
status["name"], torrent_id) status["name"], torrent_id)
@ -101,7 +103,8 @@ class EventLog(component.Component):
(state, t_name, torrent_id)) (state, t_name, torrent_id))
def on_torrent_finished_event(self, torrent_id): def on_torrent_finished_event(self, torrent_id):
if component.get("AllTorrents").config["ring_bell"]: if not windows_check() and component.get("AllTorrents").config["ring_bell"]:
import curses.beep
curses.beep() curses.beep()
self.write("{!info!}Torrent Finished: %s ({!cyan!}%s{!info!})" % self.write("{!info!}Torrent Finished: %s ({!cyan!}%s{!info!})" %
(self.console.get_torrent_name(torrent_id), torrent_id)) (self.console.get_torrent_name(torrent_id), torrent_id))