diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
commit | 76979c3530ed5303946cbb94657b3ba50c757e01 (patch) | |
tree | eba1aad7a48d9b7a100de9c99b2ea6e8718e721b /bin | |
parent | cdf8ae4931db1ecdbc5cab632ae8afb430a3a24b (diff) |
Fast scroll on Process page.
[#24] Capital W and S keys now apply fast vertical scroll on Process
page.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/handler.py | 4 | ||||
-rw-r--r-- | 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): |