pythonnative 0.6.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pythonnative/__init__.py +30 -19
- pythonnative/cli/pn.py +10 -18
- pythonnative/components.py +192 -347
- pythonnative/hooks.py +174 -21
- pythonnative/hot_reload.py +2 -2
- pythonnative/native_views/__init__.py +87 -0
- pythonnative/native_views/android.py +832 -0
- pythonnative/native_views/base.py +150 -0
- pythonnative/native_views/ios.py +777 -0
- pythonnative/navigation.py +571 -0
- pythonnative/page.py +178 -167
- pythonnative/reconciler.py +89 -1
- pythonnative/style.py +27 -7
- pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PageFragment.kt +2 -9
- pythonnative/templates/ios_template/ios_template/ViewController.swift +7 -20
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/METADATA +17 -20
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/RECORD +21 -17
- pythonnative/native_views.py +0 -1334
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/WHEEL +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/entry_points.txt +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/licenses/LICENSE +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.8.0.dist-info}/top_level.txt +0 -0
pythonnative/__init__.py
CHANGED
|
@@ -5,33 +5,22 @@ Public API::
|
|
|
5
5
|
import pythonnative as pn
|
|
6
6
|
|
|
7
7
|
@pn.component
|
|
8
|
-
def
|
|
9
|
-
count, set_count = pn.use_state(
|
|
8
|
+
def App():
|
|
9
|
+
count, set_count = pn.use_state(0)
|
|
10
10
|
return pn.Column(
|
|
11
|
-
pn.Text(f"Count: {count}", font_size
|
|
11
|
+
pn.Text(f"Count: {count}", style={"font_size": 24}),
|
|
12
12
|
pn.Button("+", on_click=lambda: set_count(count + 1)),
|
|
13
|
-
spacing
|
|
13
|
+
style={"spacing": 12},
|
|
14
14
|
)
|
|
15
|
-
|
|
16
|
-
class MainPage(pn.Page):
|
|
17
|
-
def __init__(self, native_instance):
|
|
18
|
-
super().__init__(native_instance)
|
|
19
|
-
|
|
20
|
-
def render(self):
|
|
21
|
-
return pn.Column(
|
|
22
|
-
counter(initial=0),
|
|
23
|
-
counter(initial=10),
|
|
24
|
-
spacing=16,
|
|
25
|
-
padding=16,
|
|
26
|
-
)
|
|
27
15
|
"""
|
|
28
16
|
|
|
29
|
-
__version__ = "0.
|
|
17
|
+
__version__ = "0.8.0"
|
|
30
18
|
|
|
31
19
|
from .components import (
|
|
32
20
|
ActivityIndicator,
|
|
33
21
|
Button,
|
|
34
22
|
Column,
|
|
23
|
+
ErrorBoundary,
|
|
35
24
|
FlatList,
|
|
36
25
|
Image,
|
|
37
26
|
Modal,
|
|
@@ -51,16 +40,27 @@ from .components import (
|
|
|
51
40
|
from .element import Element
|
|
52
41
|
from .hooks import (
|
|
53
42
|
Provider,
|
|
43
|
+
batch_updates,
|
|
54
44
|
component,
|
|
55
45
|
create_context,
|
|
56
46
|
use_callback,
|
|
57
47
|
use_context,
|
|
58
48
|
use_effect,
|
|
59
49
|
use_memo,
|
|
50
|
+
use_navigation,
|
|
51
|
+
use_reducer,
|
|
60
52
|
use_ref,
|
|
61
53
|
use_state,
|
|
62
54
|
)
|
|
63
|
-
from .
|
|
55
|
+
from .navigation import (
|
|
56
|
+
NavigationContainer,
|
|
57
|
+
create_drawer_navigator,
|
|
58
|
+
create_stack_navigator,
|
|
59
|
+
create_tab_navigator,
|
|
60
|
+
use_focus_effect,
|
|
61
|
+
use_route,
|
|
62
|
+
)
|
|
63
|
+
from .page import create_page
|
|
64
64
|
from .style import StyleSheet, ThemeContext
|
|
65
65
|
|
|
66
66
|
__all__ = [
|
|
@@ -68,6 +68,7 @@ __all__ = [
|
|
|
68
68
|
"ActivityIndicator",
|
|
69
69
|
"Button",
|
|
70
70
|
"Column",
|
|
71
|
+
"ErrorBoundary",
|
|
71
72
|
"FlatList",
|
|
72
73
|
"Image",
|
|
73
74
|
"Modal",
|
|
@@ -85,17 +86,27 @@ __all__ = [
|
|
|
85
86
|
"WebView",
|
|
86
87
|
# Core
|
|
87
88
|
"Element",
|
|
88
|
-
"
|
|
89
|
+
"create_page",
|
|
89
90
|
# Hooks
|
|
91
|
+
"batch_updates",
|
|
90
92
|
"component",
|
|
91
93
|
"create_context",
|
|
92
94
|
"use_callback",
|
|
93
95
|
"use_context",
|
|
94
96
|
"use_effect",
|
|
97
|
+
"use_focus_effect",
|
|
95
98
|
"use_memo",
|
|
99
|
+
"use_navigation",
|
|
100
|
+
"use_reducer",
|
|
96
101
|
"use_ref",
|
|
102
|
+
"use_route",
|
|
97
103
|
"use_state",
|
|
98
104
|
"Provider",
|
|
105
|
+
# Navigation
|
|
106
|
+
"NavigationContainer",
|
|
107
|
+
"create_drawer_navigator",
|
|
108
|
+
"create_stack_navigator",
|
|
109
|
+
"create_tab_navigator",
|
|
99
110
|
# Styling
|
|
100
111
|
"StyleSheet",
|
|
101
112
|
"ThemeContext",
|
pythonnative/cli/pn.py
CHANGED
|
@@ -48,25 +48,17 @@ def init_project(args: argparse.Namespace) -> None:
|
|
|
48
48
|
f.write("""import pythonnative as pn
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return pn.ScrollView(
|
|
61
|
-
pn.Column(
|
|
62
|
-
pn.Text("Hello from PythonNative!", font_size=24, bold=True),
|
|
63
|
-
pn.Text(f"Tapped {self.state['count']} times"),
|
|
64
|
-
pn.Button("Tap me", on_click=self.increment),
|
|
65
|
-
spacing=12,
|
|
66
|
-
padding=16,
|
|
67
|
-
alignment="fill",
|
|
68
|
-
)
|
|
51
|
+
@pn.component
|
|
52
|
+
def MainPage():
|
|
53
|
+
count, set_count = pn.use_state(0)
|
|
54
|
+
return pn.ScrollView(
|
|
55
|
+
pn.Column(
|
|
56
|
+
pn.Text("Hello from PythonNative!", style={"font_size": 24, "bold": True}),
|
|
57
|
+
pn.Text(f"Tapped {count} times"),
|
|
58
|
+
pn.Button("Tap me", on_click=lambda: set_count(count + 1)),
|
|
59
|
+
style={"spacing": 12, "padding": 16, "align_items": "stretch"},
|
|
69
60
|
)
|
|
61
|
+
)
|
|
70
62
|
""")
|
|
71
63
|
|
|
72
64
|
# Create config
|