X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=client%2Fwindow_management.py;h=a896b0207e39bb970db07572145dbf07ae69f6b0;hb=HEAD;hp=9a50b296d22c7165ee9d757008801462e9d64090;hpb=0a56367e8396b2ece4c1bce8a25e93ceabd901c1;p=plomrogue diff --git a/client/window_management.py b/client/window_management.py index 9a50b29..a896b02 100644 --- a/client/window_management.py +++ b/client/window_management.py @@ -95,6 +95,8 @@ def set_windows(): curses.endwin() stdscr = curses.initscr() screen_size = stdscr.getmaxyx() + global windows + windows = [] for config in windows_config: size = size_window(config["config"]) window = Window(config["title"], config["func"], size) @@ -106,14 +108,20 @@ def set_windows(): def draw_screen(): def healthy_addch(y, x, char, attr=0): - """Workaround for .""" + """Wrap Python curses' addch() weirdnesses into sane interface. + + Works around with + and enforces char to be a byte + instead of a single-char string. + """ if y == screen_size[0] - 1 and x == screen_size[1] - 1: char_before = stdscr.inch(y, x - 1) - stdscr.addch(y, x - 1, char, attr) + stdscr.addch(y, x - 1, char.encode(), attr) stdscr.insstr(y, x - 1, " ") - stdscr.addch(y, x - 1, char_before) + stdscr.addch(y, x - 1, + char_before & 0xFF, char_before & curses.A_ATTRIBUTES) else: - stdscr.addch(y, x, char, attr) + stdscr.addch(y, x, char.encode(), attr) def draw_window_border_lines(): for win in windows: