(self,
width=None, height=None,
width_reserved=2, height_reserved=4)
| 893 | |
| 894 | |
| 895 | def get_width_and_height(self, |
| 896 | width=None, height=None, |
| 897 | width_reserved=2, height_reserved=4) -> tuple: |
| 898 | if width == height is None: |
| 899 | width, height = get_terminal_size() |
| 900 | width = width // 2 - 2 * width_reserved |
| 901 | height = height - height_reserved |
| 902 | elif width is None: |
| 903 | width, _ = get_terminal_size() |
| 904 | width = width // 2 - 2 * width_reserved |
| 905 | elif height is None: |
| 906 | _, height = get_terminal_size() |
| 907 | height = height - height_reserved |
| 908 | if height <= 0 or width <= 0: |
| 909 | raise Exception("The width and/or height are/is less than 1, " + |
| 910 | "with reserved spaced applied.\n" + |
| 911 | f"width:{width} height:{height}") |
| 912 | return width, height |
| 913 | |
| 914 | def update_width_and_height(self, width=None, height=None, width_reserved=2, height_reserved=4): |
| 915 | self.width, self.height = self.get_width_and_height(width, height, width_reserved, height_reserved) |
no outgoing calls
no test coverage detected