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