Skip to content

Commit

Permalink
[TimerList] add onSelectionChanged for handling callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Huevos committed Oct 12, 2023
1 parent bb969e9 commit b401943
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/python/Components/TimerList.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def addPicon():

def __init__(self, list):
GUIComponent.__init__(self)
self.onSelectionChanged = []
self.l = eListboxPythonMultiContent()
self.l.setBuildFunc(self.buildTimerEntry)
self.serviceNameFont = gFont("Regular", 20)
Expand Down Expand Up @@ -205,10 +206,19 @@ def getCurrent(self):
GUI_WIDGET = eListbox

def postWidgetCreate(self, instance):
instance.selectionChanged.get().append(self.selectionChanged)
instance.setContent(self.l)
self.instance = instance
instance.setWrapAround(True)

def preWidgetRemove(self, instance):
instance.selectionChanged.get().remove(self.selectionChanged)
instance.setContent(None)

def selectionChanged(self):
for x in self.onSelectionChanged:
x()

def moveToIndex(self, index):
self.instance.moveSelectionTo(index)

Expand Down

0 comments on commit b401943

Please sign in to comment.