fix don't remove all call back

This commit is contained in:
w-e-w
2024-05-15 19:43:23 +09:00
parent 447b915e93
commit 9d0be13cfe

View File

@@ -8,7 +8,7 @@ matplotlib.use('Agg')
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import modules.scripts as scripts import modules.scripts as scripts
from modules.script_callbacks import on_cfg_denoiser, remove_current_script_callbacks, on_infotext_pasted from modules.script_callbacks import on_cfg_denoiser, remove_callbacks_for_function, on_infotext_pasted
from modules.ui_components import InputAccordion from modules.ui_components import InputAccordion
@@ -107,13 +107,13 @@ class Script(scripts.Script):
else: else:
if hasattr(self, 'callback_added'): if hasattr(self, 'callback_added'):
remove_current_script_callbacks() remove_callbacks_for_function(self.denoiser_callback)
delattr(self, 'callback_added') delattr(self, 'callback_added')
# tqdm.write('\033[90mINFO: Detail Daemon callback removed\033[0m') # tqdm.write('\033[90mINFO: Detail Daemon callback removed\033[0m')
def postprocess(self, p, processed, *args): def postprocess(self, p, processed, *args):
if hasattr(self, 'callback_added'): if hasattr(self, 'callback_added'):
remove_current_script_callbacks() remove_callbacks_for_function(self.denoiser_callback)
delattr(self, 'callback_added') delattr(self, 'callback_added')
# tqdm.write('\033[90mINFO: Detail Daemon callback removed\033[0m') # tqdm.write('\033[90mINFO: Detail Daemon callback removed\033[0m')