51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import requests
|
|
from pathlib import Path
|
|
import os
|
|
|
|
def download_file(url: str, path: Path):
|
|
"""Загрузка файла по URL"""
|
|
try:
|
|
response = requests.get(url)
|
|
response.raise_for_status()
|
|
path.write_bytes(response.content)
|
|
print(f"Загружен файл: {path}")
|
|
except Exception as e:
|
|
print(f"Ошибка при загрузке {path}: {e}")
|
|
|
|
def download_font():
|
|
"""Загрузка шрифта Inter"""
|
|
fonts_dir = Path("resources/fonts")
|
|
fonts_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
font_url = "https://github.com/rsms/inter/raw/master/docs/font-files/InterVariable.ttf"
|
|
font_path = fonts_dir / "InterVariable.ttf"
|
|
|
|
if not font_path.exists():
|
|
download_file(font_url, font_path)
|
|
|
|
def download_icons():
|
|
"""Загрузка иконок"""
|
|
icons_dir = Path("resources/icons")
|
|
icons_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
icons = {
|
|
"home.svg": "https://api.iconify.design/mdi/home.svg",
|
|
"models.svg": "https://api.iconify.design/mdi/cube.svg",
|
|
"settings.svg": "https://api.iconify.design/mdi/cog.svg",
|
|
"generate.svg": "https://api.iconify.design/mdi/image-plus.svg",
|
|
"add.svg": "https://api.iconify.design/mdi/plus.svg",
|
|
"delete.svg": "https://api.iconify.design/mdi/delete.svg",
|
|
"refresh.svg": "https://api.iconify.design/mdi/refresh.svg",
|
|
"save.svg": "https://api.iconify.design/mdi/content-save.svg",
|
|
"close.svg": "https://api.iconify.design/mdi/close.svg",
|
|
"success.svg": "https://api.iconify.design/mdi/check-circle.svg",
|
|
}
|
|
|
|
for filename, url in icons.items():
|
|
icon_path = icons_dir / filename
|
|
if not icon_path.exists():
|
|
download_file(url, icon_path)
|
|
|
|
if __name__ == "__main__":
|
|
download_font()
|
|
download_icons() |