              queue_manager.flush_queue("preview_patch_in")
              self._feed_swapped_faces(patch_queue_in, samples)
              with self._lock:
                  self._update_converter_arguments()
                  self._converter.reinitialize(config=self.current_config)
              swapped = self._patch_faces(patch_queue_in, patch_queue_out, samples.sample_size)
              with self._lock:
                  self._display.destination = swapped
              tk_vars["refresh"].set(True)
              tk_vars["busy"].set(False)
 
</s> remove             with self._lock:
 </s> add             with self._app.lock: </s> remove             with self._lock:
                self._display.destination = swapped
            tk_vars["refresh"].set(True)
            tk_vars["busy"].set(False)
 </s> add             with self._app.lock:
                self._app.display.destination = swapped

            logger.debug("Patch complete")
            trigger_event.clear() </s> remove             # Clear trigger so calling process can set it during this run
            trigger_event.clear()
 </s> add             logger.debug("Patch Triggered") </s> remove         logger.trace("Refreshing swapped faces. args: %s", args)  # type: ignore
        self._tk_vars["busy"].set(True)
 </s> add         logger.debug("Patching swapped faces. args: %s", args)
        self._dispatcher.set_busy() </s> remove             self._patch.current_config = self._config_tools.config
        self._patch.trigger.set()
        logger.trace("Refreshed swapped faces")  # type: ignore
 </s> add         self._dispatcher.set_needs_patch()
        logger.debug("Patched swapped faces")
                self._converter.reinitialize(config=self._app.config_tools.config)
              queue_manager.flush_queue("preview_patch_in")
              self._feed_swapped_faces(patch_queue_in, samples)
              with self._lock:
                  self._update_converter_arguments()
                self._converter.reinitialize(config=self._app.config_tools.config)
              swapped = self._patch_faces(patch_queue_in, patch_queue_out, samples.sample_size)
              with self._lock:
                  self._display.destination = swapped
              tk_vars["refresh"].set(True)
              tk_vars["busy"].set(False)
keep keep keep keep replace keep keep keep keep keep
 bugfix:
    - preview tool - Prevent tkinter variables from exiting main thread
refactor:
    - preview tool - Split module to smaller sub-modules + docs, locales
Typing:
    - tools.preview.cli
Unit test:
    - tools.preview.viewer 
tools/preview/preview.py