smartpause: tell the debug log which idle checker we choose

This commit is contained in:
Kevin Turner 2020-02-23 14:25:12 -08:00
parent f15939d831
commit 11b2875095
1 changed files with 11 additions and 4 deletions

View File

@ -121,10 +121,17 @@ _idle_checkers = [
]
def idle_checker_for_platform():
def idle_checker_for_platform(ctx) -> Optional[IdleTimeInterface]:
"""
Create the appropriate idle checker for this context.
"""
for cls in _idle_checkers:
if cls.is_applicable(context):
return cls()
if cls.is_applicable(ctx):
checker = cls()
logging.debug("Using idle checker %s", checker)
return checker
logging.warning("Could not find any appropriate idle checker.")
return None
@ -217,7 +224,7 @@ def on_start():
return
logging.debug('Start Smart Pause plugin')
idle_checker = idle_checker_for_platform()
idle_checker = idle_checker_for_platform(context)
__set_active(True)