stable-diffusion-webui
stable-diffusion-webui copied to clipboard
sort upscalers by name
Describe what this pull request is trying to achieve.
I have several upscalers installed, but whenever I wanted to use them in the UI, they've been listed in an unsorted mess. This simple PR implements sorting by name so that it's much easier to find which specific upscaler I want to use.
Additional notes and description of your changes
This simply changes the order of the underlying Python list that the upscalers are imported into, and it preserves the "None" UpscalerNone as a special case at the beginning of the list.
update 2023-03-06: I've added UpscalerLanczos and UpscalerNearest to the special sorting treatment per catboxanon's suggestion, effectively moving them to the top of the list.
Environment this was tested in
- OS: Linux (Pop_OS 22.04)
- Browser: Firefox 108
- Graphics card: NVIDIA RTX 3060 Ti 8GB
Screenshots or videos of your changes
See this before/after screenshot of the upscaler menu in the web UI:

Since the underlying list is sorted, this has the happy side-effect of sorting the other upscaler menus as well, but I didn't bother adding screenshots for each of them. I can add more screenshots if needed.
Of course, I also verified with several manual tests that the UI is actually using the correct upscaler when selected.
I've added UpscalerLanczos and UpscalerNearest to the special sorting treatment per catboxanon's code review suggestion, effectively moving them to the top of the list, and added lower to make the sorting case-insensitive.
Screenshots of the menu sorted after this latest commit:
