-class CutList(GUIComponent):
- def __init__(self, list):
- GUIComponent.__init__(self)
- self.l = eListboxPythonMultiContent()
- self.setList(list)
- self.l.setFont(0, gFont("Regular", 20))
- self.onSelectionChanged = [ ]
-
- def getCurrent(self):
- return self.l.getCurrentSelection()
-
- def getCurrentIndex(self):
- return self.l.getCurrentSelectionIndex()
-
- GUI_WIDGET = eListbox
-
- def postWidgetCreate(self, instance):
- instance.setContent(self.l)
- instance.setItemHeight(30)
- instance.selectionChanged.get().append(self.selectionChanged)
-
- def preWidgetRemove(self, instance):
- instance.setContent(None)
- instance.selectionChanged.get().remove(self.selectionChanged)
-
- def selectionChanged(self):
- for x in self.onSelectionChanged:
- x()
-
- def invalidateEntry(self, index):
- self.l.invalidateEntry(index)
-
- def setIndex(self, index, data):
- self.list[index] = data
- self.invalidateEntry(index)
-
- def setList(self, list):
- self.list = list
- self.l.setList(self.list)
-
- def setSelection(self, index):
- if self.instance is not None:
- self.instance.moveSelectionTo(index)
-