python: hide native module behind python front-end API

Encapsulate the rust code behind a public API (in __init__.py for now)
This commit is contained in:
Simon Hausmann 2023-12-21 11:37:53 +01:00 committed by Simon Hausmann
parent 07c168bbf9
commit d1529af3cc
7 changed files with 35 additions and 23 deletions

View file

@ -0,0 +1,10 @@
# 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
def load_file(path):
compiler = native.ComponentCompiler()
compdef = compiler.build_from_path(path)
instance = compdef.create()
return instance