sort upscalers by name

This commit is contained in:
Brad Smith 2023-02-24 14:22:58 -05:00
parent 0cc0ee1bcb
commit b15bc73c99
No known key found for this signature in database
GPG Key ID: CDABCFFBBD8DA710
1 changed files with 6 additions and 2 deletions

View File

@ -6,7 +6,7 @@ from urllib.parse import urlparse
from basicsr.utils.download_util import load_file_from_url
from modules import shared
from modules.upscaler import Upscaler
from modules.upscaler import Upscaler, UpscalerNone
from modules.paths import script_path, models_path
@ -169,4 +169,8 @@ def load_upscalers():
scaler = cls(commandline_options.get(cmd_name, None))
datas += scaler.scalers
shared.sd_upscalers = datas
shared.sd_upscalers = sorted(
datas,
# Special case for UpscalerNone keeps it at the beginning of the list.
key=lambda x: x.name if not isinstance(x.scaler, UpscalerNone) else ""
)