Skip to content

Commit

Permalink
[Session]
Browse files Browse the repository at this point in the history
* add onShutdown to call optional onShutdown for each screen if needed

[ChannelSelection]
* close on shutdown to prevent paint crash
  • Loading branch information
jbleyel committed Sep 17, 2024
1 parent 136e0b5 commit 7e39a9f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/python/Screens/ChannelSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,9 @@ def __init__(self, session):
self.lastChannelRootTimer.start(100, True)
self.pipzaptimer = eTimer()

def onShutdown(self):
self.close()

def asciiOn(self):
rcinput = eRCInput.getInstance()
rcinput.setKeyboardMode(rcinput.kmAscii)
Expand Down
12 changes: 12 additions & 0 deletions lib/python/StartEnigma.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, desktop=None, summaryDesktop=None, navigation=None):
self.shutdown = False
from Components.FrontPanelLed import frontPanelLed
frontPanelLed.init(self)
self.allDialogs = []

for plugin in plugins.getPlugins(PluginDescriptor.WHERE_SESSIONSTART):
try:
Expand Down Expand Up @@ -111,8 +112,12 @@ def instantiateDialog(self, screen, *arguments, **kwargs):
def deleteDialog(self, screen):
screen.hide()
screen.doClose()
if screen in self.allDialogs:
self.allDialogs.remove(screen)

def deleteDialogWithCallback(self, callback, screen, *retVal):
if screen in self.allDialogs:
self.allDialogs.remove(screen)
screen.hide()
screen.doClose()
if callback is not None:
Expand All @@ -134,6 +139,7 @@ def doInstantiateDialog(self, screen, arguments, kwargs, desktop):
readSkin(dialog, None, dialog.skinName, desktop) # Read skin data.
dialog.setDesktop(desktop) # Create GUI view of this dialog.
dialog.applySkin()
self.allDialogs.append(dialog)
return dialog

def pushCurrent(self):
Expand Down Expand Up @@ -212,6 +218,11 @@ def popSummary(self):
if self.summary is not None:
self.summary.show()

def onShutdown(self):
for dialog in self.allDialogs:
if hasattr(dialog, "onShutdown"):
dialog.onShutdown()


class PowerKey:
"""PowerKey code - Handles the powerkey press and powerkey release actions."""
Expand Down Expand Up @@ -559,6 +570,7 @@ def runNextScreen(session, screensToRun, *result):
print("=" * 100)
session.nav.stopService()
session.nav.shutdown()
session.onShutdown()
VolumeControl.instance.saveVolumeState()
configfile.save()
from Screens.InfoBarGenerics import saveResumePoints
Expand Down

0 comments on commit 7e39a9f

Please sign in to comment.