pythonnative 0.6.0__py3-none-any.whl → 0.7.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 +9 -19
- pythonnative/cli/pn.py +10 -18
- pythonnative/components.py +128 -340
- pythonnative/hooks.py +49 -2
- pythonnative/native_views.py +86 -16
- pythonnative/page.py +138 -172
- 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.7.0.dist-info}/METADATA +17 -20
- {pythonnative-0.6.0.dist-info → pythonnative-0.7.0.dist-info}/RECORD +15 -15
- {pythonnative-0.6.0.dist-info → pythonnative-0.7.0.dist-info}/WHEEL +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.7.0.dist-info}/entry_points.txt +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.7.0.dist-info}/licenses/LICENSE +0 -0
- {pythonnative-0.6.0.dist-info → pythonnative-0.7.0.dist-info}/top_level.txt +0 -0
pythonnative/__init__.py
CHANGED
|
@@ -5,28 +5,16 @@ 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.7.0"
|
|
30
18
|
|
|
31
19
|
from .components import (
|
|
32
20
|
ActivityIndicator,
|
|
@@ -57,10 +45,11 @@ from .hooks import (
|
|
|
57
45
|
use_context,
|
|
58
46
|
use_effect,
|
|
59
47
|
use_memo,
|
|
48
|
+
use_navigation,
|
|
60
49
|
use_ref,
|
|
61
50
|
use_state,
|
|
62
51
|
)
|
|
63
|
-
from .page import
|
|
52
|
+
from .page import create_page
|
|
64
53
|
from .style import StyleSheet, ThemeContext
|
|
65
54
|
|
|
66
55
|
__all__ = [
|
|
@@ -85,7 +74,7 @@ __all__ = [
|
|
|
85
74
|
"WebView",
|
|
86
75
|
# Core
|
|
87
76
|
"Element",
|
|
88
|
-
"
|
|
77
|
+
"create_page",
|
|
89
78
|
# Hooks
|
|
90
79
|
"component",
|
|
91
80
|
"create_context",
|
|
@@ -93,6 +82,7 @@ __all__ = [
|
|
|
93
82
|
"use_context",
|
|
94
83
|
"use_effect",
|
|
95
84
|
"use_memo",
|
|
85
|
+
"use_navigation",
|
|
96
86
|
"use_ref",
|
|
97
87
|
"use_state",
|
|
98
88
|
"Provider",
|
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
|