(self, is_img2img)
| 586 | """dict of callbacks to be called after an element is created; key=elem_id, value=list of callbacks""" |
| 587 | |
| 588 | def initialize_scripts(self, is_img2img): |
| 589 | from modules import scripts_auto_postprocessing |
| 590 | |
| 591 | self.scripts.clear() |
| 592 | self.alwayson_scripts.clear() |
| 593 | self.selectable_scripts.clear() |
| 594 | |
| 595 | auto_processing_scripts = scripts_auto_postprocessing.create_auto_preprocessing_script_data() |
| 596 | |
| 597 | for script_data in auto_processing_scripts + scripts_data: |
| 598 | try: |
| 599 | script = script_data.script_class() |
| 600 | except Exception: |
| 601 | errors.report(f"Error # failed to initialize Script {script_data.module}: ", exc_info=True) |
| 602 | continue |
| 603 | |
| 604 | script.filename = script_data.path |
| 605 | script.is_txt2img = not is_img2img |
| 606 | script.is_img2img = is_img2img |
| 607 | script.tabname = "img2img" if is_img2img else "txt2img" |
| 608 | |
| 609 | visibility = script.show(script.is_img2img) |
| 610 | |
| 611 | if visibility == AlwaysVisible: |
| 612 | self.scripts.append(script) |
| 613 | self.alwayson_scripts.append(script) |
| 614 | script.alwayson = True |
| 615 | elif visibility: |
| 616 | self.scripts.append(script) |
| 617 | self.selectable_scripts.append(script) |
| 618 | |
| 619 | self.callback_map.clear() |
| 620 | |
| 621 | self.apply_on_before_component_callbacks() |
| 622 | |
| 623 | def apply_on_before_component_callbacks(self): |
| 624 | for script in self.scripts: |
| 625 | on_before = script.on_before_component_elem_id or [] |
no test coverage detected