From bd2b1b9b4456aebc15e4c64508cae165ccd27965 Mon Sep 17 00:00:00 2001 From: Axy Date: Sun, 29 Mar 2026 05:18:43 +0200 Subject: [PATCH] Failing open on tile too big --- mazegen/config/config_parser.py | 5 +---- mazegen/config/parser_combinator.py | 1 + mazegen/display/tty.py | 11 +++-------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/mazegen/config/config_parser.py b/mazegen/config/config_parser.py index dc505e5..ac3730d 100644 --- a/mazegen/config/config_parser.py +++ b/mazegen/config/config_parser.py @@ -273,7 +273,7 @@ def DefaultedStrField[T, U]( for s in default_strs: res = parser_complete(self.parse)(s) if isinstance(res, ParseError): - raise ConfigException( + raise Exception( "Failed to construct defaulted field " + self.name() ) acc.append(res[0]) @@ -442,9 +442,6 @@ class Config: prompt: list[ColoredLine] maze_pattern: list[str] - def __init__(self) -> None: - pass - @staticmethod def parse(s: str) -> "Config": from mazegen.maze import Pattern diff --git a/mazegen/config/parser_combinator.py b/mazegen/config/parser_combinator.py index a47843f..8bc2f3f 100644 --- a/mazegen/config/parser_combinator.py +++ b/mazegen/config/parser_combinator.py @@ -1,6 +1,7 @@ from collections.abc import Callable from typing import Any import textwrap +from dataclasses import dataclass from mazegen.utils.ivec2 import IVec2 diff --git a/mazegen/display/tty.py b/mazegen/display/tty.py index bb0f6d4..add1147 100644 --- a/mazegen/display/tty.py +++ b/mazegen/display/tty.py @@ -131,14 +131,9 @@ class Tile(ITile): except curses.error: pass # dumb exception when writing bottom right corner - if ( - len(pixels) > dims.y - or max( - map(lambda line: sum(map(lambda s: len(s[0]), line)), pixels) - ) - > dims.x - ): - raise BackendException("Tile too big to fit in set dimensions") + pixels = [ + [pixel for pixel in line[: dims.y]] for line in pixels[: dims.y] + ] super().__init__(curses.newpad(*dims.yx())) -- 2.53.0