Skip to content

Commit

Permalink
Update icon previews
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemiii91 committed May 18, 2024
1 parent 3b08312 commit cf7a6ad
Show file tree
Hide file tree
Showing 60 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from defs import THEME_DIR, from_src
from schema import config_schema
from generate_icons import ensure_has_icon_preview

UNWANTED_FOLDERS = ["__MACOSX", "skin_640_480"]
UNWANTED_FILES = ["Thumbs.db", ".DS_Store"]
Expand Down Expand Up @@ -155,6 +156,9 @@ def clean_configs(theme_dir):
if not os.path.exists(config_path):
continue

icons_path = os.path.join(os.path.dirname(root), "icons")
ensure_has_icon_preview(icons_path)

with open(config_path, "r", encoding="utf-8") as fp:
config = json.load(fp)

Expand Down
3 changes: 3 additions & 0 deletions .github/data/icons_blacklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ Power Onions OS by LeonardoDaPinchy
Pokemon Mystery Dungeon by Sheezie
Milk Black by Segich + Nemi
PocketFighterMini by nGlory
Lifestream by Inheritor
Hello Miyoo by tenlevels
Silky Remix SUPER GAME BOY by MLOPEZMAD
1 change: 1 addition & 0 deletions .github/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def rel_path(path: str, from_path: str) -> str:

THEME_DIR = from_src("../themes")
RELEASE_DIR = from_src("../release")
RELEASE_ICONS_DIR = from_src("../release/icons")
PAGES_DIR = from_src("../generated")
TEMP_DIR = from_src("temp")

Expand Down
17 changes: 13 additions & 4 deletions .github/generate_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,27 @@ def generate_preview_image(output_path: str, icon_paths: list[str], cols: int =
output.save(output_path)


def ensure_has_icon_preview(icons_dir: str):
def ensure_has_icon_preview(icons_dir: str, force_mode: bool = False):
if not os.path.isdir(icons_dir):
return

preview_path = os.path.join(icons_dir, f"preview.png")

if not os.path.isfile(preview_path):
if not os.path.isfile(preview_path) or force_mode:
print(f"Generating icon pack preview: {preview_path}")
icon_paths = [os.path.join(icons_dir, f"{icon}.png") for icon in PREVIEW_ICONS]
icon_paths_exist = [p for p in icon_paths if os.path.isfile(p)]
icon_paths = [find_icon(icons_dir, icon, try_selected=i == 2) for i, icon in enumerate(PREVIEW_ICONS)]
icon_paths_exist = [p for p in icon_paths if p]

if len(icon_paths_exist) == 0:
return

generate_preview_image(preview_path, icon_paths_exist)


def find_icon(icons_dir: str, icon: str, try_selected: bool):
if try_selected:
path = os.path.join(icons_dir, "sel", f"{icon}.png")
if os.path.isfile(path):
return path
path = os.path.join(icons_dir, f"{icon}.png")
return path if os.path.isfile(path) else None
10 changes: 5 additions & 5 deletions .github/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def main():

themes = get_subdirs(THEME_DIR)

if not os.path.exists(RELEASE_DIR):
os.makedirs(RELEASE_DIR)
if not os.path.exists(RELEASE_ICONS_DIR):
os.makedirs(RELEASE_ICONS_DIR)

featured = get_lines(FEATURED_ORDERING)
remixed = get_lines(REMIXED_ORDERING)
Expand Down Expand Up @@ -67,7 +67,7 @@ def build_release(theme: str, custom: list[str], all_existing: list[str]):
if theme not in all_existing:
custom.append(theme)

ensure_has_icon_preview(os.path.join(src_path, "icons"))
ensure_has_icon_preview(os.path.join(src_path, "icons"), force_mode=True)

rel_index = len(src_path if has_subdirs else os.path.dirname(src_path)) + 1

Expand All @@ -88,7 +88,7 @@ def build_release(theme: str, custom: list[str], all_existing: list[str]):

def build_icon_pack(icon_pack, all_icons) -> bool:
src_path = os.path.join("icons", icon_pack)
zip_path = os.path.join("release/icons", f"{icon_pack}.zip")
zip_path = os.path.join(RELEASE_ICONS_DIR, f"{icon_pack}.zip")

if icon_pack not in all_icons:
all_icons.append(icon_pack)
Expand All @@ -97,7 +97,7 @@ def build_icon_pack(icon_pack, all_icons) -> bool:
return False

clean_unwanted_files(src_path)
ensure_has_icon_preview(src_path)
ensure_has_icon_preview(src_path, force_mode=True)

rel_index = len(os.path.dirname(src_path)) + 1

Expand Down
Binary file modified icons/Pixel by Jeltron/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified release/Blank Space Inverted by ElectRefurbish.zip
Binary file not shown.
Binary file modified release/Blank Space by ElectRefurbish.zip
Binary file not shown.
Binary file modified release/Capcom SNK (Handheld Filter) by Sheezie.zip
Binary file not shown.
Binary file modified release/CyberOnion (2-pack) by Aemiii91.zip
Binary file not shown.
Binary file modified release/Fake DMG Classic by Oclain.zip
Binary file not shown.
Binary file modified release/Fake Pocket by Oclain.zip
Binary file not shown.
Binary file modified release/M by tenlevels.zip
Binary file not shown.
Binary file modified release/M-NOIR by tenlevels.zip
Binary file not shown.
Binary file modified release/Material (6-pack) by tenlevels.zip
Binary file not shown.
Binary file modified release/NEON.ion by tenlevels.zip
Binary file not shown.
Binary file modified release/Onionboy HD by Jeltron.zip
Binary file not shown.
Binary file modified release/Sonic Origins by Sheezie.zip
Binary file not shown.
Binary file modified release/Star Wars (Miyoo Be With You) by tenlevels.zip
Binary file not shown.
Binary file modified release/TRON by tenlevels.zip
Binary file not shown.
Binary file modified release/sONIONc by tenlevels.zip
Binary file not shown.
Binary file modified release/vintage_aesthe by uchebo_bro.zip
Binary file not shown.
Binary file added themes/AmalgaM by ZaxxonQ/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Blank Space Inverted by ElectRefurbish/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Blank Space by ElectRefurbish/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Capcom SNK (Handheld Filter) by Sheezie/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/Classic TV by RetroReef/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Fake DMG Classic by Oclain/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Fake Pocket by Oclain/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/HAZARD by Dreambrace/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/M by tenlevels/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/M-NOIR by tenlevels/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/NEON.ion by tenlevels/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Notebook Kawaii by UnBurn/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified themes/Onionboy HD by Jeltron/icons/preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added themes/Shallot by Cyberbellum/icons/preview.png
Binary file modified themes/Sonic Origins by Sheezie/icons/preview.png
Binary file modified themes/Star Wars (Miyoo Be With You) by tenlevels/icons/preview.png
Binary file modified themes/TRON by tenlevels/icons/preview.png
Binary file added themes/Valorant by Skimpertushi/icons/preview.png
Binary file modified themes/sONIONc by tenlevels/icons/preview.png
Binary file modified themes/vintage_aesthe by uchebo_bro/icons/preview.png

0 comments on commit cf7a6ad

Please sign in to comment.