Sj-Si 1 vuosi sitten
vanhempi
commit
1fdc18e6a0
1 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. 4 5
      modules/ui_extra_networks.py

+ 4 - 5
modules/ui_extra_networks.py

@@ -13,7 +13,6 @@ import html
 from fastapi.exceptions import HTTPException
 from fastapi.exceptions import HTTPException
 
 
 from modules.infotext_utils import image_from_url_text
 from modules.infotext_utils import image_from_url_text
-from modules.ui_components import ToolButton
 
 
 extra_pages = []
 extra_pages = []
 allowed_dirs = set()
 allowed_dirs = set()
@@ -225,7 +224,6 @@ class ExtraNetworksPage:
         width = f"width: {shared.opts.extra_networks_card_width}px;" if shared.opts.extra_networks_card_width else ''
         width = f"width: {shared.opts.extra_networks_card_width}px;" if shared.opts.extra_networks_card_width else ''
         background_image = f'<img src="{html.escape(preview)}" class="preview" loading="lazy">' if preview else ''
         background_image = f'<img src="{html.escape(preview)}" class="preview" loading="lazy">' if preview else ''
 
 
-        
         onclick = item.get("onclick", None)
         onclick = item.get("onclick", None)
         if onclick is None:
         if onclick is None:
             # Don't quote prompt/neg_prompt since they are stored as js strings already.
             # Don't quote prompt/neg_prompt since they are stored as js strings already.
@@ -239,7 +237,7 @@ class ExtraNetworksPage:
                 }
                 }
             )
             )
             onclick = html.escape(onclick)
             onclick = html.escape(onclick)
-        
+
         btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": item["filename"]})
         btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": item["filename"]})
         btn_metadata = ""
         btn_metadata = ""
         metadata = item.get("metadata")
         metadata = item.get("metadata")
@@ -551,8 +549,6 @@ def pages_in_preferred_order(pages):
     return sorted(pages, key=lambda x: tab_scores[x.name])
     return sorted(pages, key=lambda x: tab_scores[x.name])
 
 
 def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):
 def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):
-    from modules.ui import switch_values_symbol
-
     ui = ExtraNetworksUi()
     ui = ExtraNetworksUi()
     ui.pages = []
     ui.pages = []
     ui.pages_contents = []
     ui.pages_contents = []
@@ -588,6 +584,9 @@ def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):
     ui.button_save_preview = gr.Button('Save preview', elem_id=tabname+"_save_preview", visible=False)
     ui.button_save_preview = gr.Button('Save preview', elem_id=tabname+"_save_preview", visible=False)
     ui.preview_target_filename = gr.Textbox('Preview save filename', elem_id=tabname+"_preview_filename", visible=False)
     ui.preview_target_filename = gr.Textbox('Preview save filename', elem_id=tabname+"_preview_filename", visible=False)
 
 
+    for tab in unrelated_tabs:
+        tab.select(fn=None, _js='function(){ extraNetworksUrelatedTabSelected("' + tabname + '"); }', inputs=[], outputs=[], show_progress=False)
+
     def create_html():
     def create_html():
         ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
         ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]