From ee0903f520403c5e03caef287f813e7b062d05ab Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sat, 17 Jun 2006 16:48:40 +0000 Subject: add some new (currently unused) source/renderer based elements --- lib/python/Components/Sources/MenuList.py | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/python/Components/Sources/MenuList.py (limited to 'lib/python/Components/Sources/MenuList.py') diff --git a/lib/python/Components/Sources/MenuList.py b/lib/python/Components/Sources/MenuList.py new file mode 100644 index 00000000..98764418 --- /dev/null +++ b/lib/python/Components/Sources/MenuList.py @@ -0,0 +1,40 @@ +from Source import Source +from Tools.Event import Event + +class MenuList(Source, object): + def __init__(self, list = [ ], enableWrapAround = False): + Source.__init__(self) + self.__list = list + self.onSelectionChanged = [ ] + + def setList(self, list): + self.__list = list + self.changed() + + list = property(lambda self: self.__list, setList) + + def entry_changed(self, index): + self.downstream_elements.entry_changed(self, index) + + def selectionChanged(self, index): + for x in self.onSelectionChanged: + x() + + def getCurrent(self): + return self.master and self.master.current + + current = property(getCurrent) + + def setIndex(self, index): + if self.master is not None: + self.master = index + + def getIndex(self, index): + if self.master is not None: + return self.master.index + else: + return -1 + + setCurrentIndex = setIndex + + index = property(getIndex, setIndex) -- cgit v1.2.3