[kupfer: 6/11] compose: Strip punctuation and whitespace in ComposedLeaf name



commit 6db0bed167b9317765d0826828db56fa7bebfb88
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Dec 14 01:12:35 2009 +0100

    compose: Strip punctuation and whitespace in ComposedLeaf name
    
    To make the display nicer, we remove the ellipsis in three-part
    actions this way.

 kupfer/objects.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/objects.py b/kupfer/objects.py
index 938ff7c..ebade57 100644
--- a/kupfer/objects.py
+++ b/kupfer/objects.py
@@ -1162,7 +1162,9 @@ class TimedDo (Do):
 class ComposedLeaf (RunnableLeaf):
 	def __init__(self, obj, action, iobj=None):
 		object_ = (obj, action, iobj)
-		name = u" â?? ".join([unicode(o) for o in object_ if o is not None])
+		# A slight hack: We remove trailing ellipsis and whitespace
+		format = lambda o: unicode(o).strip(".â?¦ ")
+		name = u" â?? ".join([format(o) for o in object_ if o is not None])
 		RunnableLeaf.__init__(self, object_, name)
 
 	def get_actions(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]