[kupfer] commatrick: Adjust MultipleLeaf, default name "Multiple Objects"



commit 99222567dc93c5d34ae822652e8092262c7330fd
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Fri Jan 15 23:07:21 2010 +0100

    commatrick: Adjust MultipleLeaf, default name "Multiple Objects"
    
    We make sure we can't store duplicates.

 kupfer/obj/compose.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/kupfer/obj/compose.py b/kupfer/obj/compose.py
index 476ce8d..04580a2 100644
--- a/kupfer/obj/compose.py
+++ b/kupfer/obj/compose.py
@@ -3,6 +3,7 @@
 from kupfer import icons
 from kupfer import pretty
 from kupfer import utils
+from kupfer import datatools
 
 from kupfer.obj.base import Leaf, Action, Source, InvalidDataError
 from kupfer.obj.objects import Perform, RunnableLeaf, TextLeaf
@@ -84,12 +85,18 @@ class _MultipleLeafContentSource (Source):
 
 class MultipleLeaf (Leaf):
 	"""
-	A Leaf representing a collection of leaves.
+	A Leaf for the direct representation of many leaves. It is not
+	a container or "source", it *is* the many leaves itself.
 
-	The represented object is a frozenset of the contained Leaves
+	The represented object is a sequence of the contained Leaves
 	"""
-	def __init__(self, obj, name):
-		Leaf.__init__(self, frozenset(obj), name)
+	def __init__(self, obj, name=_("Multiple Objects")):
+		# modifying the list of objects is strictly forbidden
+		robj = list(datatools.UniqueIterator(obj))
+		Leaf.__init__(self, robj, name)
+
+	def get_multiple_leaf_representation(self):
+		return self.object
 
 	def has_content(self):
 		return True



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