chore: add build build script for assets

This commit is contained in:
2025-11-16 21:30:56 +08:00
parent 1d8cb1a783
commit d9d0bb2ed5
40 changed files with 37 additions and 74 deletions

5
Assets/AppIcons/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Ignore generated files
*.bat
*.sh
*.ico
*.png

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,32 @@
import pathlib
def fetch_svg_files() -> tuple[pathlib.Path, ...]:
return tuple(file for file in pathlib.Path("./").glob("*.svg"))
def generate_windows_script(svg_files: tuple[pathlib.Path, ...]) -> None:
with open("./BuildIcons.bat", "w", encoding="utf-8") as f:
for svg_file in svg_files:
png_file = f'{svg_file.stem}.png'
ico_file = f'{svg_file.stem}.ico'
f.write(f"inkscape --without-gui {svg_file} -o {png_file} -w 250 -h 256\n")
f.write(f"magick {png_file} -define icon:auto-resize=256,128,64,48,32,16 {ico_file}\n")
def generate_linux_script(svg_files: tuple[pathlib.Path, ...]) -> None:
with open("./BuildIcons.sh", "w", encoding="utf-8") as f:
for svg_file in svg_files:
png_file = f'{svg_file.stem}.png'
ico_file = f'{svg_file.stem}.ico'
f.write(f"inkscape --without-gui {svg_file} -o {png_file} -w 250 -h 256\n")
f.write(f"magick {png_file} -define icon:auto-resize=256,128,64,48,32,16 {ico_file}\n")
def main():
print("Fetching SVG files...")
svg_files = fetch_svg_files()
print("Building Windows script...")
generate_windows_script(svg_files)
print("Building Linux script...")
generate_linux_script(svg_files)
print("Done!")
if __name__ == "__main__":
main()

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,74 +0,0 @@
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Count.svg" -o "F:\Repo\BallanceTasEditor\Assets\Count.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Cancel.svg" -o "F:\Repo\BallanceTasEditor\Assets\Cancel.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Ok.svg" -o "F:\Repo\BallanceTasEditor\Assets\Ok.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\EntrySpan.svg" -o "F:\Repo\BallanceTasEditor\Assets\EntrySpan.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\HorizontalLayout.svg" -o "F:\Repo\BallanceTasEditor\Assets\HorizontalLayout.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\VerticalLayout.svg" -o "F:\Repo\BallanceTasEditor\Assets\VerticalLayout.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Fps.svg" -o "F:\Repo\BallanceTasEditor\Assets\Fps.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SetFps.svg" -o "F:\Repo\BallanceTasEditor\Assets\SetFps.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PanelPreviousItem.svg" -o "F:\Repo\BallanceTasEditor\Assets\PanelPreviousItem.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PanelGoto.svg" -o "F:\Repo\BallanceTasEditor\Assets\PanelGoto.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PanelNextItem.svg" -o "F:\Repo\BallanceTasEditor\Assets\PanelNextItem.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PanelPreviousPage.svg" -o "F:\Repo\BallanceTasEditor\Assets\PanelPreviousPage.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PanelNextPage.svg" -o "F:\Repo\BallanceTasEditor\Assets\PanelNextPage.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\FlipCell.svg" -o "F:\Repo\BallanceTasEditor\Assets\FlipCell.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\AddFrame.svg" -o "F:\Repo\BallanceTasEditor\Assets\AddFrame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\DeleteFrame.svg" -o "F:\Repo\BallanceTasEditor\Assets\DeleteFrame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\UnsetCell.svg" -o "F:\Repo\BallanceTasEditor\Assets\UnsetCell.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SetCell.svg" -o "F:\Repo\BallanceTasEditor\Assets\SetCell.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\CutFrame.svg" -o "F:\Repo\BallanceTasEditor\Assets\CutFrame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\PasteFrame.svg" -o "F:\Repo\BallanceTasEditor\Assets\PasteFrame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\CopyFrame.svg" -o "F:\Repo\BallanceTasEditor\Assets\CopyFrame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\FillMode.svg" -o "F:\Repo\BallanceTasEditor\Assets\FillMode.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SelectMode.svg" -o "F:\Repo\BallanceTasEditor\Assets\SelectMode.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\DrawMode.svg" -o "F:\Repo\BallanceTasEditor\Assets\DrawMode.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Preference.svg" -o "F:\Repo\BallanceTasEditor\Assets\Preference.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SaveFileAs.svg" -o "F:\Repo\BallanceTasEditor\Assets\SaveFileAs.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\OpenFile.svg" -o "F:\Repo\BallanceTasEditor\Assets\OpenFile.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\NewFile.svg" -o "F:\Repo\BallanceTasEditor\Assets\NewFile.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SaveFile.svg" -o "F:\Repo\BallanceTasEditor\Assets\SaveFile.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\CloseFile.svg" -o "F:\Repo\BallanceTasEditor\Assets\CloseFile.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Exit.svg" -o "F:\Repo\BallanceTasEditor\Assets\Exit.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Undo.svg" -o "F:\Repo\BallanceTasEditor\Assets\Undo.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\Redo.svg" -o "F:\Repo\BallanceTasEditor\Assets\Redo.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\SaveFileThenRunGame.svg" -o "F:\Repo\BallanceTasEditor\Assets\SaveFileThenRunGame.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\ReportBug.svg" -o "F:\Repo\BallanceTasEditor\Assets\ReportBug.png" -w 256 -h 256 --export-type="png"
inkscape --without-gui "F:\Repo\BallanceTasEditor\Assets\About.svg" -o "F:\Repo\BallanceTasEditor\Assets\About.png" -w 256 -h 256 --export-type="png"
magick "F:\Repo\BallanceTasEditor\Assets\Count.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Count.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Cancel.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Cancel.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Ok.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Ok.ico"
magick "F:\Repo\BallanceTasEditor\Assets\EntrySpan.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\EntrySpan.ico"
magick "F:\Repo\BallanceTasEditor\Assets\HorizontalLayout.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\HorizontalLayout.ico"
magick "F:\Repo\BallanceTasEditor\Assets\VerticalLayout.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\VerticalLayout.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Fps.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Fps.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SetFps.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SetFps.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PanelPreviousItem.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PanelPreviousItem.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PanelGoto.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PanelGoto.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PanelNextItem.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PanelNextItem.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PanelPreviousPage.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PanelPreviousPage.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PanelNextPage.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PanelNextPage.ico"
magick "F:\Repo\BallanceTasEditor\Assets\FlipCell.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\FlipCell.ico"
magick "F:\Repo\BallanceTasEditor\Assets\AddFrame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\AddFrame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\DeleteFrame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\DeleteFrame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\UnsetCell.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\UnsetCell.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SetCell.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SetCell.ico"
magick "F:\Repo\BallanceTasEditor\Assets\CutFrame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\CutFrame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\PasteFrame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\PasteFrame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\CopyFrame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\CopyFrame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\FillMode.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\FillMode.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SelectMode.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SelectMode.ico"
magick "F:\Repo\BallanceTasEditor\Assets\DrawMode.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\DrawMode.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Preference.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Preference.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SaveFileAs.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SaveFileAs.ico"
magick "F:\Repo\BallanceTasEditor\Assets\OpenFile.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\OpenFile.ico"
magick "F:\Repo\BallanceTasEditor\Assets\NewFile.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\NewFile.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SaveFile.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SaveFile.ico"
magick "F:\Repo\BallanceTasEditor\Assets\CloseFile.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\CloseFile.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Exit.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Exit.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Undo.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Undo.ico"
magick "F:\Repo\BallanceTasEditor\Assets\Redo.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\Redo.ico"
magick "F:\Repo\BallanceTasEditor\Assets\SaveFileThenRunGame.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\SaveFileThenRunGame.ico"
magick "F:\Repo\BallanceTasEditor\Assets\ReportBug.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\ReportBug.ico"
magick "F:\Repo\BallanceTasEditor\Assets\About.png" -define icon:auto-resize=256,128,64,48,32,16 "F:\Repo\BallanceTasEditor\Assets\About.ico"