self.item_height = item_height
self.fonts = fonts
self.disable_callbacks = False
+ self.enableWrapAround = enableWrapAround
def setList(self, list):
self.__list = list
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"""
"back": self.back,
"left": self.left,
"right": self.right,
- #"up": self.up,
- #"down": self.down,
+ "up": self.up,
+ "down": self.down,
"1": self.keyNumberGlobal,
"2": self.keyNumberGlobal,
"3": self.keyNumberGlobal,
if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None):
self["config"].instance.moveSelection(self["config"].instance.moveUp)
elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
- self["list"].instance.moveSelection(self["list"].instance.moveUp)
+ self["list"].selectPrevious()
if self.wizard[self.currStep].has_key("onselect"):
self.selection = self.wizard[self.currStep]["evaluatedlist"][self["list"].l.getCurrentSelectionIndex()][1]
exec("self." + self.wizard[self.currStep]["onselect"] + "()")
self["config"].instance.moveSelection(self["config"].instance.moveDown)
elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
#self["list"].instance.moveSelection(self["list"].instance.moveDown)
- if self["list"].index + 1 >= self["list"].count():
- self["list"].index = 0
- else:
- self["list"].index += 1
+ self["list"].selectNext()
if self.wizard[self.currStep].has_key("onselect"):
print "current:", self["list"].current
#self.selection = self.wizard[self.currStep]["evaluatedlist"][self["list"].l.getCurrentSelectionIndex()][1]
self.wizard[self.currStep]["evaluatedlist"] = self.list
self["list"].list = self.list
self["list"].index = 0
+ else:
+ self["list"].hide()
if self.showConfig:
self["config"].instance.setZPosition(1)
self.configInstance["config"] = self["config"]
else:
self["config"].l.setList([])
+ else:
+ self["config"].hide()
else: # condition false
self.currStep += 1
self.updateValues()