diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-06-03 06:05:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-03 06:05:22 +0000 |
commit | b1fd2aaa8b427fcad38a6fd42dc6466d2f5a4cf6 (patch) | |
tree | 13edcce09cea00bc0424def0aee7d059077bc77f /modules/ui_extra_networks_checkpoints.py | |
parent | 08109b9bc08c02a0d72b6019dbbda0e890fd74aa (diff) | |
parent | 9009e25cb1a7864127f6b2dc7329bd4178ad3a5d (diff) | |
download | stable-diffusion-webui-gfx803-b1fd2aaa8b427fcad38a6fd42dc6466d2f5a4cf6.tar.gz stable-diffusion-webui-gfx803-b1fd2aaa8b427fcad38a6fd42dc6466d2f5a4cf6.tar.bz2 stable-diffusion-webui-gfx803-b1fd2aaa8b427fcad38a6fd42dc6466d2f5a4cf6.zip |
Merge pull request #10943 from catboxanon/sort
Allow dynamically sorting extra networks in UI
Diffstat (limited to 'modules/ui_extra_networks_checkpoints.py')
-rw-r--r-- | modules/ui_extra_networks_checkpoints.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py index a17aa9c9..8b9ab71b 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,8 @@ 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": {'default': index, **self.get_sort_keys(checkpoint.filename)},
+
}
def allowed_directories_for_previews(self):
|