aboutsummaryrefslogtreecommitdiff
path: root/modules/ui_extra_networks_checkpoints.py
diff options
context:
space:
mode:
authorcatboxanon <122327233+catboxanon@users.noreply.github.com>2023-06-02 04:08:45 +0000
committercatboxanon <122327233+catboxanon@users.noreply.github.com>2023-06-02 04:08:45 +0000
commit7dca8e7698101fd5f610675f21569eba628883f8 (patch)
tree09643108631f2c67b4d5ae4d069a3e3d0f093925 /modules/ui_extra_networks_checkpoints.py
parent3e995778fc525ff15d56c1472c1a1bc701019ec5 (diff)
Support dynamic sort of extra networks
Diffstat (limited to 'modules/ui_extra_networks_checkpoints.py')
-rw-r--r--modules/ui_extra_networks_checkpoints.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py
index a17aa9c9..d366b9ce 100644
--- a/modules/ui_extra_networks_checkpoints.py
+++ b/modules/ui_extra_networks_checkpoints.py
@@ -14,7 +14,7 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
def list_items(self):
checkpoint: sd_models.CheckpointInfo
- for name, checkpoint in sd_models.checkpoints_list.items():
+ for index, (name, checkpoint) in enumerate(sd_models.checkpoints_list.items()):
path, ext = os.path.splitext(checkpoint.filename)
yield {
"name": checkpoint.name_for_extra,
@@ -24,6 +24,7 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
"search_term": self.search_terms_from_path(checkpoint.filename) + " " + (checkpoint.sha256 or ""),
"onclick": '"' + html.escape(f"""return selectCheckpoint({json.dumps(name)})""") + '"',
"local_preview": f"{path}.{shared.opts.samples_format}",
+ "sort_keys": {**self.get_sort_keys(checkpoint.filename), **{'default': index}},
}
def allowed_directories_for_previews(self):