/usr/lib/python3/dist-packages/glue/formats/caat.py is in glue-sprite 0.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import os
from .base import BaseJSONFormat
class CAATFormat(BaseJSONFormat):
extension = 'json'
build_per_ratio = True
@classmethod
def populate_argument_parser(cls, parser):
group = parser.add_argument_group("JSON format options")
group.add_argument("--caat",
dest="caat_dir",
nargs='?',
const=True,
default=os.environ.get('GLUE_CAAT', False),
metavar='DIR',
help="Generate CAAT files and optionally where")
def get_context(self, *args, **kwargs):
context = super(CAATFormat, self).get_context(*args, **kwargs)
data = dict(sprites={}, meta={'version': context['version'],
'hash': context['hash'],
'sprite_filename': context['sprite_filename'],
'width': context['width'],
'height': context['height']})
for i in context['images']:
data['sprites'][i['filename']] = {"x" : i['abs_x'],
"y" : i['abs_y'],
"width" : i['width'],
"height" : i['height']}
return data
|