mirror of
https://github.com/allankoechke/slint.git
synced 2026-12-03 09:33:25 +00:00
Return a namespace that contains a "class type" for constructing the component instance - similar to the Node.js API.
25 lines
618 B
Python
25 lines
618 B
Python
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
from . import slint as native
|
|
import types
|
|
|
|
|
|
def load_file(path):
|
|
compiler = native.ComponentCompiler()
|
|
compdef = compiler.build_from_path(path)
|
|
|
|
module = types.SimpleNamespace()
|
|
setattr(module, compdef.name, type("SlintMetaClass", (), {
|
|
"__compdef": compdef,
|
|
"__new__": lambda cls: cls.__compdef.create()
|
|
}))
|
|
|
|
return module
|
|
|
|
|
|
Image = native.PyImage
|
|
Color = native.PyColor
|
|
Brush = native.PyBrush
|
|
Model = native.PyModelBase
|