From 76979c3530ed5303946cbb94657b3ba50c757e01 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 02:29:14 +0100 Subject: Fast scroll on Process page. [#24] Capital W and S keys now apply fast vertical scroll on Process page. --- bin/handler.py | 4 ++++ bin/printer.py | 20 ++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bin/handler.py b/bin/handler.py index c5e6ad0..9c8ffaf 100644 --- a/bin/handler.py +++ b/bin/handler.py @@ -69,6 +69,10 @@ class Handler: elif cmd == ord("w"): self.__printer.world.pan_up() self.__printer.proc_scroll_up() + elif cmd == ord("S"): + self.__printer.proc_scroll_down(fast=True) + elif cmd == ord("W"): + self.__printer.proc_scroll_up(fast=True) elif cmd == ord("Q"): self.__printer.world.pan_reset() self.__printer.proc_scroll_vertical_reset() diff --git a/bin/printer.py b/bin/printer.py index bed93d2..dd3e9ca 100644 --- a/bin/printer.py +++ b/bin/printer.py @@ -142,19 +142,31 @@ class Printer: max_scroll, self.__proc_element_scroll ) - def proc_scroll_down(self): + def proc_scroll_down(self, fast=False): """ Scroll process data table (on PROCESS view) up. """ if self.current_page == "PROCESS": - self.proc_list_scroll = max(0, self.proc_list_scroll - 1) + if fast: + len_page = len(self.__main) + len(self.__pages["PROCESS"]) + 6 + scroll = max(0, self.size[0] - len_page) + else: + scroll = 1 + + self.proc_list_scroll = max(0, self.proc_list_scroll - scroll) - def proc_scroll_up(self): + def proc_scroll_up(self, fast=False): """ Scroll process data table (on PROCESS view) down. """ if self.current_page == "PROCESS": + if fast: + len_page = len(self.__main) + len(self.__pages["PROCESS"]) + 6 + scroll = max(0, self.size[0] - len_page) + else: + scroll = 1 + self.proc_list_scroll = min( self.__sim.lib.sal_proc_get_capacity() - 1, - self.proc_list_scroll + 1 + self.proc_list_scroll + scroll ) def proc_scroll_to(self, proc_id): -- cgit v1.2.1