From 890d9c27d14114ab9bde614f5886e445d8c8902d Mon Sep 17 00:00:00 2001 From: Sniffleupagus Date: Thu, 6 Jul 2023 01:55:37 -0700 Subject: [PATCH] call plugin on_wait and on_sleep during updated partial wait/sleep delays --- pwnagotchi/ui/view.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index f452a940..00028c26 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -247,9 +247,9 @@ class View(object): def wait(self, secs, sleeping=True): was_normal = self.is_normal() - part = secs / 10.0 + part = secs/3.0 - for step in range(0, 10): + for step in range(0, 3): # if we weren't in a normal state before going # to sleep, keep that face and status on for # a while, otherwise the sleep animation will @@ -259,11 +259,13 @@ class View(object): if secs > 1: self.set('face', faces.SLEEP) self.set('status', self._voice.on_napping(int(secs))) + plugins.on('sleep', self, secs) else: self.set('face', faces.SLEEP2) self.set('status', self._voice.on_awakening()) else: self.set('status', self._voice.on_waiting(int(secs))) + plugins.on('wait', self, secs) good_mood = self._agent.in_good_mood() if step % 2 == 0: self.set('face', faces.LOOK_R_HAPPY if good_mood else faces.LOOK_R)