How to use the qface.helper.doc.parse_doc 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_comments.py View on Github external
def test_comment():
    system = loadEcho()
    doc.translate = None
    module = system.lookup('org.example.echo')
    assert module.comment == '/** module */'
    assert module
    interface = system.lookup('org.example.echo.Echo')
    assert interface
    o = doc.parse_doc(interface.comment)
    assert o.brief == ['the brief']
    assert o.description == ['the description', 'continues {@link http://qt.io}', 'continued description']
    assert o.deprecated is True
    assert o.see == ['org.example.echo.Echo', 'org.example', 'http://qt.io']
github Pelagicore / qface / tests / test_comments.py View on Github external
def test_qdoc_translate():
    system = loadEcho()
    module = system.lookup('org.example.echo')
    assert module.comment == '/** module */'
    assert module
    interface = system.lookup('org.example.echo.Echo')
    assert interface
    doc.translate = qdoc_translate
    o = doc.parse_doc(interface.comment)
    assert o.description == ['the description', 'continues \\link{http://qt.io}', 'continued description']
github Pelagicore / qface / qface / builtin / qtcpp / qtcpp.py View on Github external
def run(src, dst):
    log.debug('run {0} {1}'.format(src, dst))
    system = FileSystem.parse(src)
    generator = Generator(search_path=here / 'templates')
    generator.register_filter('returnType', Filters.returnType)
    generator.register_filter('parameterType', Filters.parameterType)
    generator.register_filter('defaultValue', Filters.defaultValue)
    generator.register_filter('parameters', Filters.parameters)
    generator.register_filter('parse_doc', parse_doc)
    ctx = {'dst': dst}
    for module in system.modules:
        log.debug('generate code for module %s', module)
        ctx.update({'module': module})
        dst = generator.apply('{{dst}}/{{module|lower|replace(".", "-")}}', ctx)
        generator.destination = dst
        generator.write('.qmake.conf', 'qmake.conf', ctx)
        generator.write('{{module|lower|replace(".", "-")}}.pro', 'plugin.pro', ctx, preserve=True)
        generator.write('CMakeLists.txt', 'CMakeLists.txt', ctx)
        generator.write('plugin.cpp', 'plugin.cpp', ctx, preserve=True)
        generator.write('plugin.h', 'plugin.h', ctx, preserve=True)
        generator.write('qmldir', 'qmldir', ctx, preserve=True)
        generator.write('generated/generated.pri', 'generated/generated.pri', ctx)
        generator.write('generated/qml{{module.module_name|lower}}module.h', 'generated/module.h', ctx)
        generator.write('generated/qml{{module.module_name|lower}}module.cpp', 'generated/module.cpp', ctx)
        generator.write('generated/qmlvariantmodel.h', 'generated/variantmodel.h', ctx)
github Pelagicore / qface / qface / utils.py View on Github external
def module_info(text):
    system = FileSystem.parse_text(text)
    module = list(system.modules)[0]
    return {
        'title': module.name,
        'brief': " ".join(doc.parse_doc(module.comment).brief)
    }