77
88import os
99import sys
10- from . import slint as native
10+ from . import core
1111import types
1212import logging
1313import copy
1414import typing
1515from typing import Any , Callable , TypeVar , overload
1616import pathlib
1717from .models import ListModel , Model
18- from .slint import Image , Color , Brush , Timer , TimerMode
18+ from .core import Image , Color , Brush , Timer , TimerMode
1919from .loop import SlintEventLoop
2020from pathlib import Path
2121from collections .abc import Coroutine
2222import asyncio
2323import gettext
2424
25- Struct = native .PyStruct
25+ Struct = core .PyStruct
2626
2727
2828class CompileError (Exception ):
2929 message : str
3030 """The error message that produced this compile error."""
3131
32- diagnostics : list [native .PyDiagnostic ]
32+ diagnostics : list [core .PyDiagnostic ]
3333 """A list of detailed diagnostics that were produced as part of the compilation."""
3434
35- def __init__ (self , message : str , diagnostics : list [native .PyDiagnostic ]):
35+ def __init__ (self , message : str , diagnostics : list [core .PyDiagnostic ]):
3636 """@private"""
3737 super ().__init__ (message )
3838 self .message = message
@@ -45,7 +45,7 @@ class Component:
4545 """Component is the base class for all instances of Slint components. Use the member functions to show or hide the
4646 window, or spin the event loop."""
4747
48- __instance__ : native .ComponentInstance
48+ __instance__ : core .ComponentInstance
4949
5050 def show (self ) -> None :
5151 """Shows the window on the screen."""
@@ -68,7 +68,7 @@ def _normalize_prop(name: str) -> str:
6868 return name .replace ("-" , "_" )
6969
7070
71- def _build_global_class (compdef : native .ComponentDefinition , global_name : str ) -> Any :
71+ def _build_global_class (compdef : core .ComponentDefinition , global_name : str ) -> Any :
7272 properties_and_callbacks = {}
7373
7474 for prop_name in compdef .global_properties (global_name ).keys ():
@@ -139,7 +139,7 @@ def call(*args: Any) -> Any:
139139
140140
141141def _build_class (
142- compdef : native .ComponentDefinition ,
142+ compdef : core .ComponentDefinition ,
143143) -> typing .Callable [..., Component ]:
144144 def cls_init (self : Component , ** kwargs : Any ) -> Any :
145145 self .__instance__ = compdef .create ()
@@ -252,8 +252,8 @@ def global_getter(self: Component) -> Any:
252252 return type ("SlintClassWrapper" , (Component ,), properties_and_callbacks )
253253
254254
255- def _build_struct (name : str , struct_prototype : native .PyStruct ) -> type :
256- def new_struct (cls : Any , * args : Any , ** kwargs : Any ) -> native .PyStruct :
255+ def _build_struct (name : str , struct_prototype : core .PyStruct ) -> type :
256+ def new_struct (cls : Any , * args : Any , ** kwargs : Any ) -> core .PyStruct :
257257 inst = copy .copy (struct_prototype )
258258
259259 for prop , val in kwargs .items ():
@@ -291,7 +291,7 @@ def load_file(
291291
292292 """
293293
294- compiler = native .Compiler ()
294+ compiler = core .Compiler ()
295295
296296 if style is not None :
297297 compiler .style = style
@@ -308,11 +308,11 @@ def load_file(
308308 if diagnostics :
309309 if not quiet :
310310 for diag in diagnostics :
311- if diag .level == native .DiagnosticLevel .Warning :
311+ if diag .level == core .DiagnosticLevel .Warning :
312312 logging .warning (diag )
313313
314314 errors = [
315- diag for diag in diagnostics if diag .level == native .DiagnosticLevel .Error
315+ diag for diag in diagnostics if diag .level == core .DiagnosticLevel .Error
316316 ]
317317 if errors :
318318 raise CompileError (f"Could not compile { path } " , diagnostics )
@@ -492,7 +492,7 @@ def set_xdg_app_id(app_id: str) -> None:
492492 """Sets the application id for use on Wayland or X11 with [xdg](https://specifications.freedesktop.org/desktop-entry-spec/latest/)
493493 compliant window managers. This id must be set before the window is shown; it only applies to Wayland or X11."""
494494
495- native .set_xdg_app_id (app_id )
495+ core .set_xdg_app_id (app_id )
496496
497497
498498quit_event = asyncio .Event ()
@@ -573,7 +573,7 @@ def init_translations(translations: typing.Optional[gettext.GNUTranslations]) ->
573573 pass
574574 ```
575575 """
576- native .init_translations (translations )
576+ core .init_translations (translations )
577577
578578
579579__all__ = [
0 commit comments