| 18268 | # ======================== EasyPrint =====# |
| 18269 | # ===================================================# |
| 18270 | class _DebugWin(): |
| 18271 | debug_window = None |
| 18272 | |
| 18273 | def __init__(self, size=(None, None), location=(None, None), relative_location=(None, None), font=None, no_titlebar=False, no_button=False, |
| 18274 | grab_anywhere=False, keep_on_top=None, do_not_reroute_stdout=True, echo_stdout=False, resizable=True, blocking=False): |
| 18275 | """ |
| 18276 | |
| 18277 | :param size: (w,h) w=characters-wide, h=rows-high |
| 18278 | :type size: (int, int) |
| 18279 | :param location: Location of upper left corner of the window |
| 18280 | :type location: (int, int) |
| 18281 | :param relative_location: (x,y) location relative to the default location of the window, in pixels. Normally the window centers. This location is relative to the location the window would be created. Note they can be negative. |
| 18282 | :type relative_location: (int, int) |
| 18283 | :param font: specifies the font family, size, etc. Tuple or Single string format 'name size styles'. Styles: italic * roman bold normal underline overstrike |
| 18284 | :type font: (str or (str, int[, str]) or None) |
| 18285 | :param no_titlebar: If True no titlebar will be shown |
| 18286 | :type no_titlebar: (bool) |
| 18287 | :param no_button: show button |
| 18288 | :type no_button: (bool) |
| 18289 | :param grab_anywhere: If True: can grab anywhere to move the window (Default = False) |
| 18290 | :type grab_anywhere: (bool) |
| 18291 | :param location: Location of upper left corner of the window |
| 18292 | :type location: (int, int) |
| 18293 | :param do_not_reroute_stdout: bool value |
| 18294 | :type do_not_reroute_stdout: (bool) |
| 18295 | :param echo_stdout: If True stdout is sent to both the console and the debug window |
| 18296 | :type echo_stdout: (bool) |
| 18297 | :param resizable: if True, makes the window resizble |
| 18298 | :type resizable: (bool) |
| 18299 | :param blocking: if True, makes the window block instead of returning immediately |
| 18300 | :type blocking: (bool) |
| 18301 | """ |
| 18302 | |
| 18303 | # Show a form that's a running counter |
| 18304 | self.size = size |
| 18305 | self.location = location |
| 18306 | self.relative_location = relative_location |
| 18307 | self.font = font |
| 18308 | self.no_titlebar = no_titlebar |
| 18309 | self.no_button = no_button |
| 18310 | self.grab_anywhere = grab_anywhere |
| 18311 | self.keep_on_top = keep_on_top |
| 18312 | self.do_not_reroute_stdout = do_not_reroute_stdout |
| 18313 | self.echo_stdout = echo_stdout |
| 18314 | self.resizable = resizable |
| 18315 | self.blocking = blocking |
| 18316 | |
| 18317 | win_size = size if size != (None, None) else DEFAULT_DEBUG_WINDOW_SIZE |
| 18318 | self.output_element = Multiline(size=win_size, autoscroll=True, auto_refresh=True, reroute_stdout=False if do_not_reroute_stdout else True, |
| 18319 | echo_stdout_stderr=self.echo_stdout, reroute_stderr=False if do_not_reroute_stdout else True, expand_x=True, expand_y=True, autoscroll_only_at_bottom=True, |
| 18320 | key='-MULTILINE-') |
| 18321 | if no_button: |
| 18322 | self.layout = [[self.output_element]] |
| 18323 | else: |
| 18324 | if blocking: |
| 18325 | self.quit_button = Button('Quit', key='Quit') |
| 18326 | else: |
| 18327 | self.quit_button = DummyButton('Quit', key='Quit') |