From d3f23bc82dcf800c265938a6bc7d07f5c61e924a Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Thu, 24 Jan 2008 21:47:38 +0000 Subject: - add selectNext/selectPrevious to sources.List - fix wizard up/down for configList --- lib/python/Components/Sources/List.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/python/Components/Sources') diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index 71be0807..0480dd65 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -16,6 +16,7 @@ to generate HTML.""" self.item_height = item_height self.fonts = fonts self.disable_callbacks = False + self.enableWrapAround = enableWrapAround def setList(self, list): self.__list = list @@ -57,6 +58,20 @@ to generate HTML.""" setCurrentIndex = setIndex index = property(getIndex, setIndex) + + def selectNext(self): + if self.getIndex() + 1 >= self.count(): + if self.enableWrapAround: + self.index = 0 + else: + self.index += 1 + + def selectPrevious(self): + if self.getIndex() - 1 < 0: + if self.enableWrapAround: + self.index = self.count() - 1 + else: + self.index -= 1 def updateList(self, list): """Changes the list without changing the selection or emitting changed Events""" -- cgit v1.2.3