How to use the qface.generator.FileSystem function in qface

To help you get started, we’ve selected a few qface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pelagicore / qface / tests / test_values.py View on Github external
def loadValues():
    path = inputPath / 'values.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / tests / test_comments.py View on Github external
def loadEcho():
    path = inputPath / 'org.example.echo.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / tests / test_tags.py View on Github external
def loadTuner():
    path = inputPath / 'com.pelagicore.ivi.tuner.qface'
    return FileSystem.parse_document(path)
github Pelagicore / qface / tests / test_generator.py View on Github external
def test_destination_prefix():
    system = FileSystem.parse(inputPath)
    out = Path('tests/out')
    out.rmtree_p()
    out.makedirs_p()
    generator = Generator(search_path='tests/templates')
    for module in system.modules:
        dst_template = '{{out}}/{{module|lower}}.txt'
        ctx = {'out': out.abspath(), 'module': module}
        generator.write(dst_template, 'module.txt', ctx)
        path = generator.apply(dst_template, ctx)
        assert Path(path).exists()
    out.rmtree_p()
github qt / qtivi / src / tools / ivigenerator / generate.py View on Github external
def generate(tplconfig, moduleConfig, annotations, src, dst):
    log.debug('run {0} {1}'.format(src, dst))
    FileSystem.strict = True
    Generator.strict = True
    system = FileSystem.parse(src)
    for annotations_file in annotations:
        log.debug('{0}'.format(annotations_file))
        if not os.path.isabs(annotations_file):
            annotations_file = Path.getcwd() / str(annotations_file)
        if not Path(annotations_file).exists():
            print('no such annotation file: {0}'.format(annotations_file))
            exit(1)
        FileSystem.merge_annotations(system, Path(annotations_file))
    generator = Generator(search_path=[tplconfig, here])

    generator.env.keep_trailing_newline = True
    generator.register_filter('return_type', return_type)
    generator.register_filter('parameter_type_default', parameter_type_default)
    generator.register_filter('parameter_type', parameter_type)
github Pelagicore / qface / qface / generator.py View on Github external
def parse_document(document: Path, system: System = None, profile=EProfile.FULL):
        error = False
        try:
            return FileSystem._parse_document(document, system, profile)
        except FileNotFoundError as e:
            click.secho('{0}: error: file not found'.format(document), fg='red', err=True)
            error = True
        except ValueError as e:
            click.secho('Error parsing document {0}'.format(document), fg='red', err=True)
            error = True
        if error and FileSystem.strict:
            sys.exit(-1)
github Pelagicore / qface / qface / generator.py View on Github external
cache = None
        if use_cache:
            cache = shelve.open('qface.cache')
            if identifier in cache and clear_cache:
                del cache[identifier]
            if identifier in cache:
                # use the cached domain model
                system = cache[identifier]
        # if domain model not cached generate it
        for input in inputs:
            path = Path.getcwd() / str(input)
            if path.isfile():
                FileSystem.parse_document(path, system)
            else:
                for document in path.walkfiles(pattern):
                    FileSystem.parse_document(document, system)

        if use_cache:
            cache[identifier] = system
        return system