FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnative/tests/typing/conformance_navigation.py at main · pythonnative/pythonnative · GitHub
pythonnative
pythonnative
Repository navigation
Code
Issues
11
(11)
Pull requests
4
(4)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnative
/
tests
/
typing
/
conformance_navigation.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (31 loc) · 1.3 KB
Breadcrumbs
pythonnative
/
tests
/
typing
/
conformance_navigation.py
Copy path
File metadata and controls
41 lines (31 loc) · 1.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Typing conformance: typed screens and navigation (checked by mypy, never executed)."""
from
__future__
import
annotations
import
pythonnative
as
pn
@
pn
.
component
def
HomeScreen
()
->
pn
.
Node
:
nav
=
pn
.
use_navigation
()
nav
.
push
(
ItemScreen
(
id
=
42
))
nav
.
navigate
(
ItemScreen
(
id
=
1
,
tab
=
"reviews"
))
nav
.
push
(
ItemScreen
(
id
=
"x"
))
# type: ignore[arg-type]
nav
.
push
(
ItemScreen
(
identifier
=
1
))
# type: ignore[call-arg]
nav
.
push
(
"ItemScreen"
)
# type: ignore[arg-type]
return
pn
.
Text
(
"home"
)
@
pn
.
component
def
ItemScreen
(
id
:
int
,
tab
:
str
=
"details"
)
->
pn
.
Node
:
nav
=
pn
.
use_navigation
()
pn
.
use_screen_options
(
title
=
f"Item
{
id
}
"
)
pn
.
use_screen_options
(
titel
=
"x"
)
# type: ignore[call-arg]
nav
.
pop_to
(
HomeScreen
)
nav
.
replace
(
ItemScreen
(
id
=
id
+
1
))
nav
.
reset
(
HomeScreen
(),
ItemScreen
(
id
=
1
))
can
:
bool
=
nav
.
can_go_back
()
return
pn
.
Text
(
f"
{
id
}
{
tab
}
{
can
}
"
)
Root
=
pn
.
StackNavigator
(
pn
.
Screen
(
HomeScreen
,
title
=
"Home"
),
pn
.
Screen
(
ItemScreen
,
path
=
"items/{id}"
,
header_large_title
=
True
),
initial
=
HomeScreen
,
)
pn
.
Screen
(
HomeScreen
,
titel
=
"Home"
)
# type: ignore[call-arg]
pn
.
StackNavigator
(
HomeScreen
,
initial
=
"HomeScreen"
)
# type: ignore[arg-type]
ref
=
pn
.
NavigationRef
()
app
:
pn
.
Element
=
pn
.
NavigationContainer
(
Root
,
link_prefixes
=
[
"myapp://"
],
ref
=
ref
)
Back
|
FazBrowse Home
|
New Git URL