From 62288cc81e0762066d5753a0ab95ee8266f19d0f Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Sun, 10 Jan 2021 18:06:18 +0000 Subject: [PATCH] apps: software: Fix some scrolling bugs Currently the number of pages is (acidentally) hardcoded where it need not be and the scroll directions aren't right as soon as we go beyond two pages (where scroll up and down are equivalent actions). Fix both. Signed-off-by: Daniel Thompson --- wasp/apps/software.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wasp/apps/software.py b/wasp/apps/software.py index 92a2531..a7c07eb 100644 --- a/wasp/apps/software.py +++ b/wasp/apps/software.py @@ -47,10 +47,10 @@ class SoftwareApp(): def swipe(self, event): """Notify the application of a touchscreen swipe event.""" page = self.page - pages = 1 - if event[0] == wasp.EventType.UP: - page = page - 1 if page > 0 else pages + pages = (len(self.db)-1) // 5 if event[0] == wasp.EventType.DOWN: + page = page - 1 if page > 0 else pages + if event[0] == wasp.EventType.UP: page = page + 1 if page < pages else 0 self.page = page