Воркед

This commit is contained in:
kromskii2 committed 2025-03-15 09:36:28 +07:00
1 parent ac32c55ab9
commit ee94d8e529
1138 files changed
+55771 -77901

No files matched your search

+27 -27
View File
@@ -1,50 +1,50 @@
import os
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():
# Создаем директории если они не существуют
resources_dir = Path("resources")
fonts_dir = resources_dir / "fonts"
"""Загрузка шрифта Inter"""
fonts_dir = Path("resources/fonts")
fonts_dir.mkdir(parents=True, exist_ok=True)
# URL для загрузки шрифта
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():
print("Загрузка шрифта Inter...")
response = requests.get(font_url)
if response.status_code == 200:
with open(font_path, "wb") as f:
f.write(response.content)
print(f"Шрифт успешно загружен в {font_path}")
else:
print(f"Ошибка при загрузке шрифта: {response.status_code}")
download_file(font_url, font_path)
def download_icons():
# Создаем директорию для иконок
"""Загрузка иконок"""
icons_dir = Path("resources/icons")
icons_dir.mkdir(parents=True, exist_ok=True)
# Словарь с иконками и их SVG содержимым
icons = {
"home.svg": """<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>""",
"image.svg": """<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>""",
"settings.svg": """<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>"""
"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, svg_content in icons.items():
for filename, url in icons.items():
icon_path = icons_dir / filename
if not icon_path.exists():
print(f"Создаем иконку {filename}...")
with open(icon_path, "w", encoding="utf-8") as f:
f.write(svg_content)
print(f"Иконка {filename} создана")
download_file(url, icon_path)
if __name__ == "__main__":
download_font()