From adc6a173a52142750b40928c5e7cb266ea01ce93 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Nov 2014 12:27:26 +0530 Subject: [PATCH] oops --- src/calibre/gui2/tweak_book/editor/text.py | 2 +- src/calibre/gui2/tweak_book/function_replace.py | 2 +- src/calibre/gui2/tweak_book/search.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tweak_book/editor/text.py b/src/calibre/gui2/tweak_book/editor/text.py index 57c41ad1f3..ee5dcd85af 100644 --- a/src/calibre/gui2/tweak_book/editor/text.py +++ b/src/calibre/gui2/tweak_book/editor/text.py @@ -359,8 +359,8 @@ class TextEdit(PlainTextEdit): raw, count = pat.subn(template, raw) if repl_is_func: from calibre.gui2.tweak_book.search import show_function_debug_output - show_function_debug_output(template) template.end() + show_function_debug_output(template) if count > 0: start_pos = min(c.anchor(), c.position()) c.insertText(raw) diff --git a/src/calibre/gui2/tweak_book/function_replace.py b/src/calibre/gui2/tweak_book/function_replace.py index 4d936a187b..32fefc051d 100644 --- a/src/calibre/gui2/tweak_book/function_replace.py +++ b/src/calibre/gui2/tweak_book/function_replace.py @@ -97,7 +97,7 @@ class Function(object): return self.func(None, self.match_index, self.context_name, self.boss.current_metadata, dictionaries, self.data, self.functions) finally: sys.stdout, sys.stderr = oo, oe - self.data, self.debug_buf, self.boss, self.functions = {}, None, None, {} + self.data, self.boss, self.functions = {}, None, {} class DebugOutput(Dialog): diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index 0e71cef268..e97c3765ae 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -1188,6 +1188,7 @@ def get_search_function(search): def show_function_debug_output(func): if isinstance(func, Function): val = func.debug_buf.getvalue().strip() + func.debug_buf.truncate(0) if val: from calibre.gui2.tweak_book.boss import get_boss get_boss().gui.sr_debug_output.show_log(func.name, val)