[kupfer: 11/11] plugin.core: Show DebugInfo output in a text result window
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer: 11/11] plugin.core: Show DebugInfo output in a text result window
- Date: Sun, 1 Nov 2009 19:50:03 +0000 (UTC)
commit 2a45805f5e4984b963dcf24be16975126104463f
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Nov 1 19:33:34 2009 +0100
plugin.core: Show DebugInfo output in a text result window
kupfer/plugin/core.py | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/kupfer/plugin/core.py b/kupfer/plugin/core.py
index 458f280..15ecdf4 100644
--- a/kupfer/plugin/core.py
+++ b/kupfer/plugin/core.py
@@ -77,18 +77,23 @@ class Rescan (Action):
return False
return not item.content_source().is_dynamic()
-class DebugInfo (Action, pretty.OutputMixin):
- """
- Print debug info to terminal
- """
+class DebugInfo (Action):
+ """ Print debug info to terminal """
rank_adjust = -50
def __init__(self):
Action.__init__(self, u"Debug Info")
def activate(self, leaf):
import itertools
+ import StringIO
from kupfer import qfurl
- print_func = lambda *args : pretty.print_debug("debug", *args)
+ from kupfer import uiutils
+
+ output = StringIO.StringIO()
+ def print_func(*args):
+ print >>output, " ".join(unicode(a) for a in args)
+ pretty.print_debug("debug", *args)
+
print_func("Debug info about", leaf)
print_func(leaf, repr(leaf))
def get_qfurl(leaf):
@@ -136,9 +141,9 @@ class DebugInfo (Action, pretty.OutputMixin):
for field in sorted(fields):
val = fields[field]
rep = repr(val)
- print_func("%-10s:" % field, rep)
+ print_func("%-15s:" % field, rep)
if str(val) not in rep:
- print_func("%-10s:" % field, val)
+ print_func("%-15s:" % field, val)
leafinfo = get_leaf_fields(leaf)
print_fields(leafinfo)
if leafinfo["content"]:
@@ -147,6 +152,7 @@ class DebugInfo (Action, pretty.OutputMixin):
if leafinfo["content"] != leafinfo["content-alt"]:
print_func("Content-Alt ========")
print_fields(get_source_fields(leafinfo["content-alt"]))
+ uiutils.show_text_result(output.getvalue())
def get_description(self):
return u"Print debug output (for interal kupfer use)"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]