Skip to content
Snippets Groups Projects
Select Git revision
  • c211055bf9f7f3b392d59f5509cbbee4ab38050b
  • master default
  • windows_ci_static
  • c_link
  • cpack
  • windows_ci
  • cert_pk_id
  • proxy_push_result
  • cnode_put_id
  • update-windows-build
  • proxy
  • resubscribe_on_token_change
  • actions
  • client_mode
  • llhttp
  • search_node_add
  • crypto_aes_gcm_argon2
  • ios_notifications
  • log_fmt
  • v2asio
  • fix-msvc
  • v3.4.0
  • v3.3.1
  • v3.3.1rc1
  • v3.3.1rc2
  • v3.3.0
  • v3.2.0
  • v3.1.11
  • v3.1.10
  • v3.1.9
  • v3.1.8.2
  • v3.1.8.1
  • v3.1.8
  • v3.1.7
  • v3.1.6
  • v3.1.5
  • v3.1.4
  • v3.1.3
  • v3.1.2
  • v3.1
  • v3.0.1
41 results

proxy_node.html

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    gen-resources.py 1.32 KiB
    import os
    import sys
    import re
    
    resdir = 'resources'
    qmlfile = os.path.join('src', 'constant', 'JamiResources.qml')
    sep = '_'
    
    print("Generating resource files ...")
    
    # replace characters that aren't valid within QML property names
    formatProp = lambda str: (
        "".join([{".": sep, "-": sep, " ": sep}
            .get(c, c) for c in str]
        ).lower())
    
    with open('resources.qrc', 'w') as qrc, open(qmlfile, 'w') as qml:
        qrc.write('<RCC>\n')
        qml.write('pragma Singleton\nimport QtQuick 2.14\nQtObject {\n')
        for root, _, files in os.walk(resdir):
            if len(files):
                prefix = root.rsplit(os.sep, 1)[-1]
                qrc.write('\t<qresource prefix="/%s">\n' % prefix)
                for filename in files:
                    # use posix separators in the resource path
                    filepath = os.path.join(root, filename).replace(os.sep, '/')
                    qrc.write('\t\t<file alias="%s">%s</file>\n'
                        % (filename, filepath))
                    # only record images/icons as properties
                    if (re.match("icons|images", prefix)):
                        qml.write('    readonly property string %s: "qrc:/%s"\n'
                            % (formatProp(filename), filepath.split('/', 1)[1]))
                qrc.write('\t</qresource>\n')
        qml.write('}')
        qrc.write('</RCC>')