UI update

- Remove headers for "enable" and "status"
- Set status icon width to 1rem
- Remove `if_modern()`
This commit is contained in:
awsr
2025-12-30 16:24:47 -08:00
parent 67c5384d97
commit d14c64caa2
2 changed files with 14 additions and 29 deletions
+1 -14
View File
@@ -5,7 +5,7 @@ import sys
import time
import contextlib
from enum import Enum
from typing import TYPE_CHECKING, TypeVar
from typing import TYPE_CHECKING
import gradio as gr
from modules.json_helpers import readfile, writefile # pylint: disable=W0611
from modules.shared_helpers import listdir, walk_files, html_path, html, req, total_tqdm # pylint: disable=W0611
@@ -30,9 +30,6 @@ if TYPE_CHECKING:
from modules.shared_legacy import LegacyOption
from modules.ui_extra_networks import ExtraNetworksPage
M = TypeVar("M")
S = TypeVar("S")
class Backend(Enum):
ORIGINAL = 1
@@ -120,16 +117,6 @@ list_checkpoint_tiles = list_checkpoint_titles # alias for legacy typo
default_checkpoint = list_checkpoint_titles()[0] if len(list_checkpoint_titles()) > 0 else "model.safetensors"
def if_modern(modern: M, standard: S = None) -> M | S:
"""Return input depending on whether Modern UI is being used or not.
Args:
modern (Any): Value to return if Modern UI is being used.
standard (Any, optional): Value to return if Modern UI is NOT being used. Defaults to None.
"""
return modern if opts.theme_type == "Modern" else standard
def is_url(string):
from urllib.parse import urlparse
parsed_url = urlparse(string)
+13 -15
View File
@@ -32,8 +32,6 @@ sort_ordering = {
re_snake_case = re.compile(r'_(?=[a-zA-z0-9])')
re_camelCase = re.compile(r'(?<=[a-z])([A-Z])')
th_status = shared.if_modern(f'<span style="user-select:none;cursor:help" title="Status">{ui_symbols.info_btn}</span>', "Status")
th_enabled = shared.if_modern(f'<span style="user-select:none;cursor:help" title="Enabled">{ui_symbols.check_btn}</span>', "Enabled")
def get_installed(ext):
@@ -283,7 +281,7 @@ def make_wrappable_html(text: str) -> str:
def create_html(search_text, sort_column):
# shared.log.debug(f'Extensions manager: refresh list search="{search_text}" sort="{sort_column}"')
code = f"""
code = """
<div id="extensions-div">
<table id="extensions">
<colgroup>
@@ -297,8 +295,8 @@ def create_html(search_text, sort_column):
</colgroup>
<thead style="font-size: 110%; border-style: solid; border-bottom: 1px var(--button-primary-border-color) solid">
<tr>
<th>{th_enabled}</th>
<th>{th_status}</th>
<th></th>
<th></th>
<th>Extension</th>
<th>Description</th>
<th>Type</th>
@@ -393,27 +391,27 @@ def create_html(search_text, sort_column):
if ext.get('status', None) is None or type(ext['status']) == str: # old format
ext['status'] = 0
if ext['url'] is None or ext['url'] == '':
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Local'>{ui_symbols.svg_bullet.style('#00C0FD')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Local'>{ui_symbols.svg_bullet.style('#00C0FD')}</div>"
elif ext['status'] > 0:
if ext['status'] == 1:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Verified'>{ui_symbols.svg_bullet.style('#00FD9C')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Verified'>{ui_symbols.svg_bullet.style('#00FD9C')}</div>"
elif ext['status'] == 2:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Supported only with backend: Original'>{ui_symbols.svg_bullet.style('#FFC300')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Supported only with backend: Original'>{ui_symbols.svg_bullet.style('#FFC300')}</div>"
elif ext['status'] == 3:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Supported only with backend: Diffusers'>{ui_symbols.svg_bullet.style('#FFC300')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Supported only with backend: Diffusers'>{ui_symbols.svg_bullet.style('#FFC300')}</div>"
elif ext['status'] == 4:
status = f"<div style='cursor:help;width:1em;margin:auto;' title=\"{html.escape(ext.get('note', 'custom value'))}\">{ui_symbols.svg_bullet.style('#4E22FF')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title=\"{html.escape(ext.get('note', 'custom value'))}\">{ui_symbols.svg_bullet.style('#4E22FF')}</div>"
elif ext['status'] == 5:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Not supported'>{ui_symbols.svg_bullet.style('#CE0000')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Not supported'>{ui_symbols.svg_bullet.style('#CE0000')}</div>"
elif ext['status'] == 6:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Just discovered'>{ui_symbols.svg_bullet.style('#AEAEAE')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Just discovered'>{ui_symbols.svg_bullet.style('#AEAEAE')}</div>"
else:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Unknown status'>{ui_symbols.svg_bullet.style('#008EBC')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Unknown status'>{ui_symbols.svg_bullet.style('#008EBC')}</div>"
else:
if updated < datetime.now(timezone.utc) - timedelta(6*30): # TZ-aware
status = f"<div style='cursor:help;width:1em;margin:auto;' title='Unmaintained'>{ui_symbols.svg_bullet.style('#C000CF')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='Unmaintained'>{ui_symbols.svg_bullet.style('#C000CF')}</div>"
else:
status = f"<div style='cursor:help;width:1em;margin:auto;' title='No info'>{ui_symbols.svg_bullet.style('#7C7C7C')}</div>"
status = f"<div style='cursor:help;width:1rem;margin:auto;' title='No info'>{ui_symbols.svg_bullet.style('#7C7C7C')}</div>"
code += f"""
<tr style="display: {visible}">