adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
2.02k stars 261 forks source link

Disable callbacks when extension is disabled #661

Open adieyal opened 11 months ago

adieyal commented 11 months ago

Ensure that callbacks (apart from settings and wildcards manager), only run when dynamic prompts is enabled. This builds on https://github.com/adieyal/sd-dynamic-prompts/pull/648

adieyal commented 11 months ago

and keep the module name the same? script_protocol? or change it to sddp_script?

akx commented 11 months ago

Now that I think of it, I'm not sure the protocol is actually required at all – couldn't we just use the actual script object as a type (guarded against circular imports)?

if TYPE_CHECKING:
    from dynamic_prompts.dynamic_prompting import Script as SDDPScript
adieyal commented 11 months ago

Now that I think of it, I'm not sure the protocol is actually required at all – couldn't we just use the actual script object as a type (guarded against circular imports)?

if TYPE_CHECKING:
    from dynamic_prompts.dynamic_prompting import Script as SDDPScript

Happy to do that too. I'll make the change.