Skip to content

Commit

Permalink
allow extensions to sort themselves in UI
Browse files Browse the repository at this point in the history
and other installed extensions will be on top now (including some resolution related UI extensions)
  • Loading branch information
lllyasviel committed Feb 17, 2024
1 parent 07659ef commit ae51178
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extensions-builtin/sd_forge_controlnet/scripts/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def __init__(self):


class ControlNetForForgeOfficial(scripts.Script):
sorting_priority = 10

def title(self):
return "ControlNet"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@


class DynamicThresholdingForForge(scripts.Script):
sorting_priority = 11

def title(self):
return "DynamicThresholding (CFG-Fix) Integrated"

Expand Down
2 changes: 2 additions & 0 deletions extensions-builtin/sd_forge_freeu/scripts/forge_freeu.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@


class FreeUForForge(scripts.Script):
sorting_priority = 12

def title(self):
return "FreeU Integrated"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class HyperTileForForge(scripts.Script):
sorting_priority = 13

def title(self):
return "HyperTile Integrated"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class KohyaHRFixForForge(scripts.Script):
sorting_priority = 14

def title(self):
return "Kohya HRFix Integrated"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@


class LatentModifierForForge(scripts.Script):
sorting_priority = 15

def title(self):
return "LatentModifier Integrated"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class MultiDiffusionForForge(scripts.Script):
sorting_priority = 16

def title(self):
return "MultiDiffusion Integrated"

Expand Down
2 changes: 2 additions & 0 deletions extensions-builtin/sd_forge_sag/scripts/forge_sag.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


class SAGForForge(scripts.Script):
sorting_priority = 12.5

def title(self):
return "SelfAttentionGuidance Integrated"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def sdp(q, k, v, transformer_options):


class StyleAlignForForge(scripts.Script):
sorting_priority = 17

def title(self):
return "StyleAlign Integrated"

Expand Down
5 changes: 5 additions & 0 deletions modules/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class Script:
controls = None
"""A list of controls retured by the ui()."""

sorting_priority = 0
"""Larger number will appear downwards in the UI."""

def title(self):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""

Expand Down Expand Up @@ -695,6 +698,8 @@ def setup_ui_for_section(self, section, scriptlist=None):
if scriptlist is None:
scriptlist = self.alwayson_scripts

scriptlist = sorted(scriptlist, key=lambda x: x.sorting_priority)

for script in scriptlist:
if script.alwayson and script.section != section:
continue
Expand Down

0 comments on commit ae51178

Please sign in to comment.