From 1637a388affef84735805ac105b995cb2f25c005 Mon Sep 17 00:00:00 2001 From: AnonymouX47 Date: Fri, 7 Apr 2023 17:55:02 +0100 Subject: [PATCH] fix: Fix render style support with multiprocessing - Fix: Actually skip style support checks in subprocesses. - Fix: Export forced support status correctly. - Fix: Add `jpeg_quality` and `read_from_file` to exported iterm2 style attributes. --- docs/source/concepts.rst | 2 +- src/termvisage/logging_multi.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/source/concepts.rst b/docs/source/concepts.rst index cacbf5c..d28c535 100644 --- a/docs/source/concepts.rst +++ b/docs/source/concepts.rst @@ -86,7 +86,7 @@ The available render styles are: with a density of two pixels per character cell. Using a render style not supported by the :term:`active terminal` is not allowed by -default. To force the usage of a style that is normally unsupported, add +default. To force the use of such a render style, add :option:`--force-style `. diff --git a/src/termvisage/logging_multi.py b/src/termvisage/logging_multi.py index bf9a403..45e1ffd 100644 --- a/src/termvisage/logging_multi.py +++ b/src/termvisage/logging_multi.py @@ -65,6 +65,8 @@ def __init__(self, *args, redirect_notifs: bool = False, **kwargs): self._main_process_interrupted = cli.interrupted self._ImageClass = tui.main.ImageClass if self._ImageClass: # if the TUI is initialized + self._supported = self._ImageClass._supported + self._forced_support = self._ImageClass.forced_support self._cell_ratio = cli.args.cell_ratio self._query_timeout = cli.args.query_timeout self._swap_win_size = cli.args.swap_win_size @@ -81,8 +83,8 @@ def run(self): try: if self._ImageClass: # if the TUI is initialized # The unpickled class object is in the originally defined state - # Eliminates queries for style support checks - self._ImageClass.forced_support = True + self._ImageClass._supported = self._supported # Avoid support check + self._ImageClass.forced_support = self._forced_support for item in self._style_attrs: setattr(self._ImageClass, *item) @@ -160,7 +162,7 @@ def handle(self, record: _logging.LogRecord): NOTIF = 1 child_processes = [] exported_style_attrs = { - "iterm2": ("_TERM", "_TERM_VERSION"), + "iterm2": ("_TERM", "_TERM_VERSION", "jpeg_quality", "read_from_file"), "kitty": ("_TERM", "_TERM_VERSION", "_KITTY_VERSION"), }