File tree Expand file tree Collapse file tree 6 files changed +138
-1
lines changed
api/python/slint/tests/codegen/examples/counter Expand file tree Collapse file tree 6 files changed +138
-1
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # Generated by slint.codegen from counter.slint
2+ from __future__ import annotations
3+
4+ import importlib .resources as _resources
5+ import os
6+ import types
7+ from contextlib import nullcontext as _nullcontext
8+ from pathlib import Path
9+ from typing import Any
10+
11+ import slint
12+
13+ __all__ = ['CounterWindow' ]
14+
15+ _MODULE_DIR = Path (__file__ ).parent
16+
17+ _SLINT_RESOURCE = 'counter.slint'
18+
19+ def _load () -> types .SimpleNamespace :
20+ """Load the compiled Slint module for this package."""
21+ package = __package__ or (__spec__ .parent if __spec__ else None )
22+ if package :
23+ ctx = _resources .as_file (_resources .files (package ).joinpath (_SLINT_RESOURCE ))
24+ else :
25+ ctx = _nullcontext (Path (__file__ ).with_name (_SLINT_RESOURCE ))
26+ with ctx as slint_path :
27+ include_paths : list [os .PathLike [Any ] | Path ] = None
28+ library_paths : dict [str , os .PathLike [Any ] | Path ] | None = None
29+ return slint .load_file (
30+ path = slint_path ,
31+ quiet = True ,
32+ style = None ,
33+ include_paths = include_paths ,
34+ library_paths = library_paths ,
35+ translation_domain = None ,
36+ )
37+
38+ _module = _load ()
39+
40+ CounterWindow = _module .CounterWindow
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ import enum
4+
5+ from typing import Any , Callable
6+
7+ import slint
8+
9+ __all__ = ['CounterWindow' ]
10+
11+ class CounterWindow (slint .Component ):
12+ def __init__ (self , ** kwargs : Any ) -> None :
13+ ...
14+ counter : int
15+ request_increase : Callable [[], None ]
16+
Original file line number Diff line number Diff line change 1+ # Generated by slint.codegen from counter.slint
2+ from __future__ import annotations
3+
4+ import importlib .resources as _resources
5+ import os
6+ import types
7+ from contextlib import nullcontext as _nullcontext
8+ from pathlib import Path
9+ from typing import Any
10+
11+ import slint
12+
13+ __all__ = ['CounterWindow' ]
14+
15+ _MODULE_DIR = Path (__file__ ).parent
16+
17+ _SLINT_RESOURCE = 'counter.slint'
18+
19+ def _load () -> types .SimpleNamespace :
20+ """Load the compiled Slint module for this package."""
21+ package = __package__ or (__spec__ .parent if __spec__ else None )
22+ if package :
23+ ctx = _resources .as_file (_resources .files (package ).joinpath (_SLINT_RESOURCE ))
24+ else :
25+ ctx = _nullcontext (Path (__file__ ).with_name (_SLINT_RESOURCE ))
26+ with ctx as slint_path :
27+ include_paths : list [os .PathLike [Any ] | Path ] = None
28+ library_paths : dict [str , os .PathLike [Any ] | Path ] | None = None
29+ return slint .load_file (
30+ path = slint_path ,
31+ quiet = True ,
32+ style = None ,
33+ include_paths = include_paths ,
34+ library_paths = library_paths ,
35+ translation_domain = None ,
36+ )
37+
38+ _module = _load ()
39+
40+ CounterWindow = _module .CounterWindow
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ import enum
4+
5+ from typing import Any , Callable
6+
7+ import slint
8+
9+ __all__ = ['CounterWindow' ]
10+
11+ class CounterWindow (slint .Component ):
12+ def __init__ (self , ** kwargs : Any ) -> None :
13+ ...
14+ counter : int
15+ request_increase : Callable [[], None ]
16+
Original file line number Diff line number Diff line change 1+ export component CounterWindow inherits Window {
2+ width : 240px ;
3+ height : 120px ;
4+
5+ in-out property <int > counter : 0 ;
6+ callback request_increase ();
7+
8+ Rectangle {
9+ width : parent .width;
10+ height : parent .height;
11+ background : #2b2b2b ;
12+ border-radius : 12px ;
13+
14+ Text {
15+ text : "Count: " + root .counter;
16+ color : white;
17+ font-size : 24px ;
18+ horizontal-alignment : center;
19+ vertical-alignment : center;
20+ }
21+
22+ TouchArea {
23+ clicked => root .request_increase ();
24+ }
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments