new: the auto-update plugin now triggers an on_updating event that other plugins can intercept (see led plugin)

This commit is contained in:
Simone Margaritelli
2019-11-08 15:47:12 +01:00
parent 186042aa20
commit bd61196c3c
4 changed files with 8 additions and 2 deletions

View File

@ -87,6 +87,7 @@ main:
# o=on space=off, comment the ones you don't want # o=on space=off, comment the ones you don't want
patterns: patterns:
loaded: 'oo oo oo oo oo oo oo' loaded: 'oo oo oo oo oo oo oo'
updating: 'oo oo oo oo oo oo oo'
# internet_available: 'oo oo oo oo oo oo oo' # internet_available: 'oo oo oo oo oo oo oo'
ready: 'oo oo oo oo oo oo oo' ready: 'oo oo oo oo oo oo oo'
ai_ready: 'oo oo oo oo oo oo oo' ai_ready: 'oo oo oo oo oo oo oo'

View File

@ -198,6 +198,7 @@ class AutoUpdate(plugins.Plugin):
if num_updates > 0: if num_updates > 0:
if self.options['install']: if self.options['install']:
for update in to_install: for update in to_install:
plugins.on('updating')
if install(display, update): if install(display, update):
num_installed += 1 num_installed += 1
else: else:

View File

@ -25,7 +25,7 @@ class Example(plugins.Plugin):
def on_loaded(self): def on_loaded(self):
logging.warning("WARNING: this plugin should be disabled! options = " % self.options) logging.warning("WARNING: this plugin should be disabled! options = " % self.options)
# called in manual mode when there's internet connectivity # called hen there's internet connectivity
def on_internet_available(self, agent): def on_internet_available(self, agent):
pass pass

View File

@ -69,7 +69,11 @@ class Led(plugins.Plugin):
finally: finally:
self._is_busy = False self._is_busy = False
# called in manual mode when there's internet connectivity # called when the unit is updating its software
def on_updating(self):
self._on_event('updating')
# called when there's internet connectivity
def on_internet_available(self, agent): def on_internet_available(self, agent):
self._on_event('internet_available') self._on_event('internet_available')