|
3 | 3 | from pathlib import Path
|
4 | 4 | from typing import Awaitable, Callable, Literal
|
5 | 5 |
|
6 |
| -# TODO: Barret: Q: Can we merge how bookmark dirs are saved / loaded?... it's the same directory! However, the save will return a possibly new path. Restoring will return an existing path. |
| 6 | +# Q: Can we merge how bookmark dirs are saved / loaded?... it's the same directory! However, the save will return a possibly new path. Restoring will return an existing path. |
7 | 7 | # A: No. Keep them separate. The save function may need to create a new directory, while the load function will always return an existing directory.
|
8 |
| - |
9 |
| -# TODO: Barret Rename load -> restore. Keep the names consistent! |
10 | 8 | GetBookmarkSaveDir = Callable[[str], Awaitable[Path]]
|
11 | 9 | GetBookmarkRestoreDir = Callable[[str], Awaitable[Path]]
|
12 | 10 |
|
13 | 11 |
|
14 | 12 | BookmarkStore = Literal["url", "server", "disable"]
|
15 |
| - |
16 |
| - |
17 |
| -# TODO: Barret; Q: I feel like there could be a `@shiny.globals.on_session_start` decorator that would allow us to set these values. |
18 |
| - |
19 |
| - |
20 |
| -# @shiny.session.on_session_start |
21 |
| -# def _(session): ... |
22 |
| - |
23 |
| - |
24 |
| -# @shiny.session.on_session_started |
25 |
| -# def _(session): ... |
26 |
| - |
27 |
| - |
28 |
| -# shiny.bookmark.globals.bookmark_save_dir = connect_custom_method |
29 |
| -# shiny.bookmark.globals.bookmark_load_dir = connect_custom_method |
30 |
| - |
31 |
| - |
32 |
| -# shiny.bookmark.set_bookmark_save_dir(connect_custom_method) |
33 |
| -# shiny.bookmark.set_bookmark_load_dir(connect_custom_method) |
34 |
| - |
35 |
| -# ------------ |
36 |
| - |
37 |
| -# import shiny |
38 |
| - |
39 |
| -# # Garrick like's this one... fix the name! |
40 |
| -# @shiny.bookmark.bookmark_save_dir |
41 |
| -# def connect_custom_method(id: str) -> Path: |
42 |
| -# return Path("connect") / id |
43 |
| - |
44 |
| - |
45 |
| -# shiny.run_app("some file") |
46 |
| - |
47 |
| -# Using a decorator |
48 |
| - |
49 |
| - |
50 |
| -# from shiny.bookmark import _globals as bookmark_globals |
51 |
| -# bookmark_globals.bookmark_store = "url" |
52 |
| - |
53 |
| -# bookmark.globals.bookmark_store = "url" |
54 |
| - |
55 |
| -# import shiny |
56 |
| - |
57 |
| -# TODO: Barret - Implement |
58 |
| - |
59 |
| -# # Make placeholders start with underscore |
60 |
| -# shiny.bookmark.globals.bookmark_save_dir = connect_save_shiny_bookmark |
61 |
| -# shiny.bookmark.globals.bookmark_load_dir = connect_restore_shiny_bookmark |
62 |
| - |
63 |
| -# # Implement this for now |
64 |
| -# # Hold off on |
65 |
| - |
66 |
| -# # Global level |
67 |
| -# @shiny.bookmark.set_save_dir |
68 |
| -# def connect_save_shiny_bookmark(): ... |
69 |
| - |
70 |
| -# Don't implement this |
71 |
| -# # App level |
72 |
| -# @app.bookmark.set_save_dir |
73 |
| -# def save_shiny_bookmark(): ... |
74 |
| - |
75 |
| - |
76 |
| -# @app.bookmark.set_save_dir |
77 |
| -# def save_shiny_bookmark(): ... |
78 |
| - |
79 |
| - |
80 |
| -# @shiny.bookmark.set_restore_dir |
81 |
| -# def connect_save_shiny_bookmark(): ... |
82 |
| - |
83 |
| - |
84 |
| -# VV Don't use the next line style. It must be in the App() object! |
85 |
| -# shiny.bookmark.globals.bookmark_store = "url" |
86 |
| - |
87 |
| -# shiny.run_app("foo") |
0 commit comments