Log events to legacy mode even when in AllTorrents view

This commit is contained in:
Asmageddon 2012-05-27 19:17:46 +02:00
parent 09c830c6ae
commit 48dd049cbd
3 changed files with 6 additions and 3 deletions

View File

@ -352,6 +352,7 @@ Please use commands from the command line, eg:\n
if isinstance(self.screen,deluge.ui.console.modes.legacy.Legacy): if isinstance(self.screen,deluge.ui.console.modes.legacy.Legacy):
self.screen.write(s) self.screen.write(s)
else: else:
component.get("LegacyUI").add_line(s, False)
self.events.append(s) self.events.append(s)
else: else:
print colors.strip_colors(s.encode(self.encoding)) print colors.strip_colors(s.encode(self.encoding))

View File

@ -304,6 +304,8 @@ class AllTorrents(BaseMode, component.Component):
"seeding_time","time_added","distributed_copies", "num_pieces", "seeding_time","time_added","distributed_copies", "num_pieces",
"piece_length","save_path"] "piece_length","save_path"]
self.legacy_mode = Legacy(self.stdscr,self.config,self.encoding)
# component start/update # component start/update
def start(self): def start(self):
component.get("SessionProxy").get_torrents_status(self.__status_dict, self.__status_fields).addCallback(self.set_state,False) component.get("SessionProxy").get_torrents_status(self.__status_dict, self.__status_fields).addCallback(self.set_state,False)
@ -552,8 +554,6 @@ class AllTorrents(BaseMode, component.Component):
def dolegacy(arg): def dolegacy(arg):
if arg and True in arg[0]: if arg and True in arg[0]:
self.stdscr.clear() self.stdscr.clear()
if not self.legacy_mode:
self.legacy_mode = Legacy(self.stdscr,self.config,self.encoding)
component.get("ConsoleUI").set_mode(self.legacy_mode) component.get("ConsoleUI").set_mode(self.legacy_mode)
self.legacy_mode.refresh() self.legacy_mode.refresh()
curses.curs_set(2) curses.curs_set(2)

View File

@ -107,9 +107,11 @@ def commonprefix(m):
return s return s
class Legacy(BaseMode): class Legacy(BaseMode, component.Component):
def __init__(self, stdscr, console_config, encoding=None): def __init__(self, stdscr, console_config, encoding=None):
component.Component.__init__(self, "LegacyUI")
self.batch_write = False self.batch_write = False
self.lines = [] self.lines = []