From 2b244f0628a30953a305d8be7ea7c2559a9113b6 Mon Sep 17 00:00:00 2001 From: Asmageddon Date: Thu, 12 Jul 2012 16:03:22 +0200 Subject: [PATCH] Changed format of add torrent reports a bit --- deluge/ui/console/modes/addtorrents.py | 13 ++++++------- deluge/ui/console/modes/alltorrents.py | 7 ++++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py index c6bc4fae7..1ff9db16d 100644 --- a/deluge/ui/console/modes/addtorrents.py +++ b/deluge/ui/console/modes/addtorrents.py @@ -46,6 +46,7 @@ import base64 from deluge.ui.sessionproxy import SessionProxy from input_popup import InputPopup +from popup import Popup import deluge.ui.console.colors as colors import format_utils @@ -380,7 +381,7 @@ class AddTorrents(BaseMode, component.Component): def fail_cb(msg,t_file,ress): log.debug("failed to add torrent: %s: %s"%(t_file,msg)) ress["fail"]+=1 - ress["fmsg"].append("%s: %s"%(t_file,msg)) + ress["fmsg"].append("{!input!} * %s: {!error!}%s"%(t_file,msg)) if (ress["succ"]+ress["fail"]) >= ress["total"]: self.alltorrentmode._report_add_status(ress["succ"],ress["fail"],ress["fmsg"]) @@ -404,8 +405,8 @@ class AddTorrents(BaseMode, component.Component): t_options["add_paused"] = result["add_paused"] d = client.core.add_torrent_file(filename, filedump, t_options) - d.addCallback(success_cb, path, ress) - d.addErrback(fail_cb, path, ress) + d.addCallback(success_cb, filename, ress) + d.addErrback(fail_cb, filename, ress) self.back_to_overview() @@ -483,15 +484,13 @@ class AddTorrents(BaseMode, component.Component): elif c == curses.KEY_END: self.scroll_list_down(len(self.formatted_rows)) elif c == curses.KEY_RIGHT: - self._perform_action() + if self.cursel < len(self.listing_dirs): + self._enter_dir() elif c == curses.KEY_LEFT: self._go_up() # Enter Key elif c == curses.KEY_ENTER or c == 10: self._perform_action() - # space - elif c == 32: - self._perform_action() else: if c > 31 and c < 256: if chr(c) == 'h': diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index 76bd0c560..134fca34a 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -678,7 +678,7 @@ class AllTorrents(BaseMode, component.Component): if fail_cnt == 0: self.report_message("Torrents Added","{!success!}Successfully added %d torrent(s)"%succ_cnt) else: - msg = ("{!error!}Failed to add the following %d torrent(s):\n {!input!}"%fail_cnt)+"\n {!error!}".join(fail_msgs) + msg = ("{!error!}Failed to add the following %d torrent(s):\n {!input!}"%fail_cnt)+"\n ".join(fail_msgs) if succ_cnt != 0: msg += "\n \n{!success!}Successfully added %d torrent(s)"%succ_cnt self.report_message("Torrent Add Report",msg) @@ -694,7 +694,8 @@ class AllTorrents(BaseMode, component.Component): def fail_cb(msg,t_file,ress): log.debug("failed to add torrent: %s: %s"%(t_file,msg)) ress["fail"]+=1 - ress["fmsg"].append("%s: %s"%(t_file,msg)) + filename = t_file.split("/")[-1] + ress["fmsg"].append("{!input!} * %s: {!error!}%s"%(filename,msg)) if (ress["succ"]+ress["fail"]) >= ress["total"]: self._report_add_status(ress["succ"],ress["fail"],ress["fmsg"]) def suc_cb(tid,t_file,ress): @@ -779,7 +780,7 @@ class AllTorrents(BaseMode, component.Component): # show a message popup if there's anything queued if self.popup == None and self.messages: title,msg = self.messages.popleft() - self.popup = MessagePopup(self,title,msg) + self.popup = MessagePopup(self,title,msg, width_req=1.0) if not lines: if component.get("ConsoleUI").screen != self: