stuff and main file

feat/atomation
ENDERZOMBI102 2 years ago
parent 972a5f43bd
commit f6de883236

@ -0,0 +1,5 @@
To run
-
```bash
$ python src/main.py
```

@ -21,6 +21,7 @@ class Emote:
Emote( Emote(
origin=[ origin ], origin=[ origin ],
**entry | { **entry | {
'base': 'base' if 'base' not in entry and 'src' not in entry else entry.get( 'base', None ),
'overwrites': Overwrite.load( entry.get( 'overwrites', [ ] ) ), 'overwrites': Overwrite.load( entry.get( 'overwrites', [ ] ) ),
'objects': Object.load( entry.get( 'objects', [ ] ) ) 'objects': Object.load( entry.get( 'objects', [ ] ) )
} }

@ -1,9 +1,9 @@
from pathlib import Path from pathlib import Path
import yaml from PIL.Image import Image
from cairosvg.surface import Surface from cairosvg.surface import Surface
from data.emote import Emote
from data.variants import Variants from data.variants import Variants
@ -20,17 +20,21 @@ class Generator:
def load( self, declFile: Path ) -> Variants: def load( self, declFile: Path ) -> Variants:
return Variants( declFile, self ) return Variants( declFile, self )
def generate( self, outputDir: Path = Path('.') ) -> None: def generate( self, emote: Emote ) -> Image:
pass
def export( self, sets: list[str], outputDir: Path = Path( '.' ) ) -> None:
""" """
Generates the images in the given folder Generates the images in the given folder
\t \t
:param sets: the sets to export to PNGs
:param outputDir: output directory :param outputDir: output directory
""" """
if not outputDir.exists(): if not outputDir.exists():
outputDir.mkdir() outputDir.mkdir()
print( self.declarations['neugeme'] ) for set in sets:
# for emote in emotes
pass
if __name__ == '__main__':
Generator( Path('./resources/neugeme.yml') ).generate( Path('./run') )

@ -0,0 +1,55 @@
import os
import sys
from argparse import ArgumentParser
from pathlib import Path
from typing import cast
from generator import Generator
parser = ArgumentParser(
prog=( 'automation' + '.exe' if 'win' in os.name.lower() else '' ) if getattr( sys, 'frozen', False ) else 'main.py',
description='Generates blobfoxes from yaml and svgs'
)
parser.add_argument(
'-d',
'--declfile',
help='Declaration file to export',
action='store',
type=Path,
dest='declFile',
required=True
)
parser.add_argument(
'-e',
'--export',
help='A comma-separated list of emote to export',
action='store',
dest='exports',
default='<all>'
)
parser.add_argument(
'-o',
'--output',
help='Output directory',
action='store',
type=Path,
dest='output',
default=Path('.')
)
class Arguments:
declFile: Path
exports: str
output: Path
if __name__ == '__main__':
args: Arguments = cast( parser.parse_args( sys.argv[1:] ), Arguments )
gen = Generator( args.declFile )
gen.export( args.exports.split(','), args.output )
Loading…
Cancel
Save