diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-01-10 18:06:18 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2021-01-10 18:14:36 (GMT) |
| commit | 62288cc81e0762066d5753a0ab95ee8266f19d0f (patch) | |
| tree | ef5550bb95939380a7e77c75496fe7bdc1ceec97 /wasp/apps/software.py | |
| parent | 79db167ed90da31698ad87534e46e06094099c2c (diff) | |
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 <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps/software.py')
| -rw-r--r-- | wasp/apps/software.py | 6 |
1 files 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 |
