aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_extra_networks.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-05-17 18:45:26 +0000
committerAUTOMATIC <16777216c@gmail.com>2023-05-17 18:45:26 +0000
commit8fe9ea7f4d8fd76038db61e1fd2b1cc5927ce108 (patch)
treef2c35eb47c3f53334240af38f0c6f223b89f3713 /modules/ui_extra_networks.py
parenta6b618d07248267de36f0e8f4a847d997285e272 (diff)
downloadstable-diffusion-webui-gfx803-8fe9ea7f4d8fd76038db61e1fd2b1cc5927ce108.tar.gz
stable-diffusion-webui-gfx803-8fe9ea7f4d8fd76038db61e1fd2b1cc5927ce108.tar.bz2
stable-diffusion-webui-gfx803-8fe9ea7f4d8fd76038db61e1fd2b1cc5927ce108.zip
add options to show/hide hidden files and dirs, and to not list models/files in hidden directories
Diffstat (limited to 'modules/ui_extra_networks.py')
-rw-r--r--modules/ui_extra_networks.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py
index c6e45fb1..8669cc1a 100644
--- a/modules/ui_extra_networks.py
+++ b/modules/ui_extra_networks.py
@@ -105,6 +105,9 @@ class ExtraNetworksPage:
if not is_empty and not subdir.endswith("/"):
subdir = subdir + "/"
+ if ("/." in subdir or subdir.startswith(".")) and not shared.opts.extra_networks_show_hidden_directories:
+ continue
+
subdirs[subdir] = 1
if subdirs:
@@ -147,6 +150,10 @@ class ExtraNetworksPage:
return []
def create_html_for_item(self, item, tabname):
+ """
+ Create HTML for card item in tab tabname; can return empty string if the item is not meant to be shown.
+ """
+
preview = item.get("preview", None)
onclick = item.get("onclick", None)
@@ -169,9 +176,15 @@ class ExtraNetworksPage:
if filename.startswith(absdir):
local_path = filename[len(absdir):]
- # if this is true, the item must not be show in the default view, and must instead only be
+ # if this is true, the item must not be shown in the default view, and must instead only be
# shown when searching for it
- search_only = "/." in local_path or "\\." in local_path
+ if shared.opts.extra_networks_hidden_models == "Always":
+ search_only = False
+ else:
+ search_only = "/." in local_path or "\\." in local_path
+
+ if search_only and shared.opts.extra_networks_hidden_models == "Never":
+ return ""
args = {
"style": f"'display: none; {height}{width}{background_image}'",