2025-04-12 14:18:45 +08:00
|
|
|
import shutil
|
2025-04-12 01:33:06 +08:00
|
|
|
import sys
|
2025-04-12 14:18:45 +08:00
|
|
|
import subprocess
|
2025-04-12 01:29:38 +08:00
|
|
|
from pathlib import Path
|
2025-04-12 00:03:28 +08:00
|
|
|
|
2025-04-12 15:39:56 +08:00
|
|
|
import click
|
|
|
|
|
|
2025-04-12 14:18:45 +08:00
|
|
|
import flandre
|
2025-04-12 01:29:38 +08:00
|
|
|
from flandre.launcher import launch_from_file
|
2025-04-12 15:39:56 +08:00
|
|
|
from flandre.config import C
|
2025-04-12 00:03:28 +08:00
|
|
|
|
2025-04-12 14:18:45 +08:00
|
|
|
|
2025-04-12 15:39:56 +08:00
|
|
|
@click.command()
|
|
|
|
|
@click.option('--data_folder', default=None)
|
|
|
|
|
@click.option('--generate_pyqt', default=True)
|
2025-04-12 15:54:56 +08:00
|
|
|
@click.option('--dev/--no-dev', default=True)
|
2025-04-12 15:39:56 +08:00
|
|
|
def main(data_folder, generate_pyqt, dev):
|
2025-04-12 14:18:45 +08:00
|
|
|
if (pyuic6 := shutil.which('pyuic6')) is None:
|
|
|
|
|
print('pyuic6 is not installed')
|
|
|
|
|
return
|
2025-04-12 15:39:56 +08:00
|
|
|
if generate_pyqt:
|
|
|
|
|
subprocess.run([pyuic6, '-o', flandre.PYQT / 'Main.py', flandre.PYQT / 'Main.ui'])
|
|
|
|
|
if data_folder is not None:
|
|
|
|
|
C.data_folder = Path(data_folder)
|
2025-04-12 15:54:56 +08:00
|
|
|
if dev:
|
|
|
|
|
sys.argv.append('--dev')
|
|
|
|
|
launch_from_file(Path(__file__).parent / 'launch.toml')
|
2025-04-12 14:18:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|