From 3d97621524e3ecbdbd0b6b85c54b6d0a44b3f665 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 13 Mar 2016 12:07:39 +0100 Subject: [PATCH] Client, plugins: Make window scroll hints optional. --- client/config/windows.py | 25 ++++++++++++++++++++----- client/window_management.py | 9 ++++++--- plugins/client/PleaseTheIslandGod.py | 25 ++++++++++++++++++++----- plugins/client/TheCrawlingEater.py | 6 ++++++ 4 files changed, 52 insertions(+), 13 deletions(-) diff --git a/client/config/windows.py b/client/config/windows.py index 676d94c..2e0c7b8 100644 --- a/client/config/windows.py +++ b/client/config/windows.py @@ -7,9 +7,24 @@ from client.windows import win_info, win_log, win_inventory, win_look, win_map windows_config = [ - {"config": [1, 33], "func": win_info, "title": "Info"}, - {"config": [-7, 33], "func": win_log, "title": "Log"}, - {"config": [4, 16], "func": win_inventory, "title": "Inventory"}, - {"config": [4, 16], "func": win_look, "title": "Things here"}, - {"config": [0, -34], "func": win_map, "title": "Map"} + {"config": [1, 33], + "func": win_info, + "scroll_hints": True, + "title": "Info"}, + {"config": [-7, 33], + "func": win_log, + "scroll_hints": True, + "title": "Log"}, + {"config": [4, 16], + "func": win_inventory, + "scroll_hints": True, + "title": "Inventory"}, + {"config": [4, 16], + "func": win_look, + "scroll_hints": True, + "title": "Things here"}, + {"config": [0, -34], + "func": win_map, + "scroll_hints": True, + "title": "Map"} ] diff --git a/client/window_management.py b/client/window_management.py index 610764b..4d6a403 100644 --- a/client/window_management.py +++ b/client/window_management.py @@ -18,10 +18,11 @@ screen_size = [0,0] class Window: - def __init__(self, title, draw_function, size): + def __init__(self, title, draw_function, size, draw_scroll_hints): self.title = title self.draw = types.MethodType(draw_function, self) self.size = size + self.draw_scroll_hints = draw_scroll_hints def set_windows(): @@ -99,7 +100,8 @@ def set_windows(): windows = [] for config in windows_config: size = size_window(config["config"]) - window = Window(config["title"], config["func"], size) + window = Window(config["title"], config["func"], size, + config["scroll_hints"]) windows.append(window) place_window(window) redraw_windows = True @@ -211,7 +213,8 @@ def draw_screen(): for win in windows: offset, winmap_size, winmap = win.draw() draw_winmap() - draw_scroll_hints() + if win.draw_scroll_hints: + draw_scroll_hints() stdscr.erase() draw_window_border_lines() diff --git a/plugins/client/PleaseTheIslandGod.py b/plugins/client/PleaseTheIslandGod.py index 18a0f64..7348e76 100644 --- a/plugins/client/PleaseTheIslandGod.py +++ b/plugins/client/PleaseTheIslandGod.py @@ -142,11 +142,26 @@ def win_map(self): from client.config.windows import windows_config from client.windows import win_log, win_inventory, win_look windows_config[:] = [ - {"config": [1, 33], "func": win_info, "title": "Stats"}, - {"config": [-7, 33], "func": win_log, "title": "Log"}, - {"config": [4, 16], "func": win_inventory, "title": "Inventory"}, - {"config": [4, 16], "func": win_look, "title": "Things here"}, - {"config": [0, -34], "func": win_map, "title": "PLEASE THE ISLAND GOD"} + {"config": [1, 33], + "func": win_info, + "scroll_hints": True, + "title": "Stats"}, + {"config": [-7, 33], + "func": win_log, + "scroll_hints": True, + "title": "Log"}, + {"config": [4, 16], + "func": win_inventory, + "scroll_hints": True, + "title": "Inventory"}, + {"config": [4, 16], + "func": win_look, + "scroll_hints": True, + "title": "Things here"}, + {"config": [0, -34], + "func": win_map, + "scroll_hints": True, + "title": "PLEASE THE ISLAND GOD"} ] from client.window_management import set_windows set_windows() diff --git a/plugins/client/TheCrawlingEater.py b/plugins/client/TheCrawlingEater.py index 86115e3..63c4136 100644 --- a/plugins/client/TheCrawlingEater.py +++ b/plugins/client/TheCrawlingEater.py @@ -140,21 +140,27 @@ from client.windows import win_log windows_config[:] = [ {"config": [0, -34], "func": win_map, + "scroll_hints": False, "title": "The Crawling Eater"}, {"config": [1, 33], "func": win_bar_maker(77, "%", "stomach"), + "scroll_hints": False, "title": "stomach"}, {"config": [1, 33], "func": win_bar_maker(79, "~", "kidney"), + "scroll_hints": False, "title": "kidney"}, {"config": [1, 33], "func": win_bar_maker(78, "%", "bowel"), + "scroll_hints": False, "title": "bowel"}, {"config": [1, 33], "func": win_bar_maker(80, "~", "bladder"), + "scroll_hints": False, "title": "bladder"}, {"config": [-8, 33], "func": win_log, + "scroll_hints": False, "title": "log"} ] from client.window_management import set_windows -- 2.30.2