- Создан автономный модуль mapping_renderer.py, рисующий маппинг напрямую из MappingDocument. - Изображение больше не зависит от Qt-сцены и не содержит метки интерфейса или лишних id. - Разрешение выходного изображения 2400x2400+800 пикселей с боковой легендой. - Плашки start/end блоков рисуются напрямую на изображении. - Добавлено предупреждение при несохранённых изменениях (с возможностью сохранить и экспортировать сразу). - canvas.py очищен от предыдущей неработающей реализации export_to_image.
100 lines
2.3 KiB
Python
100 lines
2.3 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
|
|
import subprocess
|
|
from pathlib import Path
|
|
from datetime import datetime
|
|
|
|
|
|
spec_dir = Path(SPECPATH)
|
|
|
|
|
|
def git_build_ref():
|
|
try:
|
|
dirty = subprocess.run(
|
|
['git', 'diff-index', '--quiet', 'HEAD', '--'],
|
|
cwd=spec_dir,
|
|
stderr=subprocess.DEVNULL,
|
|
stdout=subprocess.DEVNULL,
|
|
).returncode != 0
|
|
if dirty:
|
|
return datetime.now().strftime('%H%M%S-%d%m%Y')
|
|
except OSError:
|
|
return datetime.now().strftime('%H%M%S-%d%m%Y')
|
|
try:
|
|
tag = subprocess.check_output(
|
|
['git', 'describe', '--tags', '--exact-match', 'HEAD'],
|
|
cwd=spec_dir,
|
|
stderr=subprocess.DEVNULL,
|
|
text=True,
|
|
).strip()
|
|
if tag:
|
|
return tag
|
|
except (OSError, subprocess.CalledProcessError):
|
|
pass
|
|
try:
|
|
commit = subprocess.check_output(
|
|
['git', 'rev-parse', '--short', 'HEAD'],
|
|
cwd=spec_dir,
|
|
stderr=subprocess.DEVNULL,
|
|
text=True,
|
|
).strip()
|
|
if commit:
|
|
return commit
|
|
except (OSError, subprocess.CalledProcessError):
|
|
pass
|
|
return 'untagged'
|
|
|
|
|
|
app_name = f'LEDMapper-{git_build_ref()}'
|
|
|
|
|
|
a = Analysis(
|
|
[str(spec_dir / 'main.py')],
|
|
pathex=[str(spec_dir), str(spec_dir.parent)],
|
|
binaries=[],
|
|
datas=[(str(spec_dir / 'assets'), 'assets')],
|
|
hiddenimports=[
|
|
'canvas',
|
|
'background_dialog',
|
|
'icons',
|
|
'localization',
|
|
'main_window',
|
|
'mapping_renderer',
|
|
'models',
|
|
'panel_mapping_generator',
|
|
'settings',
|
|
'settings_dialog',
|
|
'theme',
|
|
'unfolding',
|
|
],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[],
|
|
noarchive=False,
|
|
optimize=0,
|
|
)
|
|
pyz = PYZ(a.pure)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas,
|
|
[],
|
|
name=app_name,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
runtime_tmpdir=None,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
icon=str(spec_dir / 'assets' / 'ledmapper.ico'),
|
|
)
|