async def handle_paging(self) -> None: if self.page == 0: directions = SWIPE_UP elif self.page == len(self.pages) - 1: directions = SWIPE_DOWN else: directions = SWIPE_VERTICAL if __debug__: swipe = await loop.race(Swipe(directions), swipe_signal()) else: swipe = await Swipe(directions) if swipe is SWIPE_UP: self.page = min(self.page + 1, len(self.pages) - 1) elif swipe is SWIPE_DOWN: self.page = max(self.page - 1, 0) self.pages[self.page].dispatch(ui.REPAINT, 0, 0) self.repaint = True if __debug__: notify_layout_change(self) self.on_change()
async def handle_paging(self) -> None: from trezor.ui.swipe import SWIPE_HORIZONTAL, SWIPE_LEFT, SWIPE_RIGHT, Swipe if self.pageable.is_first(): directions = SWIPE_LEFT elif self.pageable.is_last(): directions = SWIPE_RIGHT else: directions = SWIPE_HORIZONTAL if __debug__: swipe = await loop.race(Swipe(directions), swipe_signal()) else: swipe = await Swipe(directions) if swipe == SWIPE_LEFT: self.pageable.next() else: self.pageable.prev() self.content.repaint = True if self.confirm is not None: self.confirm.repaint = True if self.cancel is not None: self.cancel.repaint = True
async def handle_paging(self) -> None: if self.page == 0: directions = SWIPE_UP elif self.page == len(self.pages) - 1: directions = SWIPE_DOWN else: directions = SWIPE_VERTICAL if __debug__: from apps.debug import swipe_signal swipe = await loop.race(Swipe(directions), swipe_signal()) else: swipe = await Swipe(directions) if swipe is SWIPE_UP: self.page = min(self.page + 1, len(self.pages) - 1) elif swipe is SWIPE_DOWN: self.page = max(self.page - 1, 0) self.on_change() raise ui.Result(WAS_PAGED)