add option to reorder tabs

fix Reload UI not working
This commit is contained in:
AUTOMATIC
2023-05-17 23:11:33 +03:00
parent 30410fd355
commit b397f63e00
2 changed files with 6 additions and 2 deletions

View File

@@ -1644,7 +1644,10 @@ def create_ui():
parameters_copypaste.connect_paste_params_buttons()
with gr.Tabs(elem_id="tabs") as tabs:
for interface, label, ifid in interfaces:
tab_order = {k: i for i, k in enumerate(opts.ui_tab_order)}
sorted_interfaces = sorted(interfaces, key=lambda x: tab_order.get(x[1], 9999))
for interface, label, ifid in sorted_interfaces:
if label in shared.opts.hidden_tabs:
continue
with gr.TabItem(label, id=ifid, elem_id=f"tab_{ifid}"):