[kupfer] show_text: Large Type will display anything with TextRepresentation
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer] show_text: Large Type will display anything with TextRepresentation
- Date: Thu, 3 Mar 2011 00:43:18 +0000 (UTC)
commit ff229c7c2d675f87e5287803331e6eefbcd45906
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Thu Mar 3 01:38:06 2011 +0100
show_text: Large Type will display anything with TextRepresentation
Anything defining the interface TextRepresentation can be displayed
with the action Large Text (same text as is used for Ctrl+C).
Experimental change to decide on later.
kupfer/plugin/show_text.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/plugin/show_text.py b/kupfer/plugin/show_text.py
index 1cc1576..8bfcecc 100644
--- a/kupfer/plugin/show_text.py
+++ b/kupfer/plugin/show_text.py
@@ -8,8 +8,7 @@ __description__ = _("Display text in a window")
__version__ = ""
__author__ = "US"
-from kupfer.objects import Action
-from kupfer.objects import TextLeaf
+from kupfer.objects import Action, Leaf, TextLeaf
from kupfer import icons, uiutils
from kupfer import textutils
@@ -19,7 +18,7 @@ class ShowText (Action):
Action.__init__(self, _("Show Text"))
def activate(self, leaf):
- uiutils.show_text_result(leaf.object, title=_("Show Text"))
+ uiutils.show_text_result(leaf.get_text_representation(), title=_("Show Text"))
def item_types(self):
yield TextLeaf
@@ -34,10 +33,13 @@ class LargeType (Action):
Action.__init__(self, _("Large Type"))
def activate(self, leaf):
- uiutils.show_large_type(leaf.object)
+ uiutils.show_large_type(leaf.get_text_representation())
def item_types(self):
- yield TextLeaf
+ yield Leaf
+
+ def valid_for_item(self, obj):
+ return hasattr(obj, "get_text_representation")
def get_description(self):
return _("Display text in a window")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]