nova-trame 0.8.0__py3-none-any.whl → 0.10.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.
- nova/__init__.py +1 -0
- nova/trame/view/components/input_field.py +19 -10
- nova/trame/view/components/remote_file_input.py +4 -9
- nova/trame/view/theme/theme.py +2 -2
- nova/trame/view_model/remote_file_input.py +1 -2
- {nova_trame-0.8.0.dist-info → nova_trame-0.10.0.dist-info}/METADATA +2 -2
- {nova_trame-0.8.0.dist-info → nova_trame-0.10.0.dist-info}/RECORD +10 -10
- {nova_trame-0.8.0.dist-info → nova_trame-0.10.0.dist-info}/LICENSE +0 -0
- {nova_trame-0.8.0.dist-info → nova_trame-0.10.0.dist-info}/WHEEL +0 -0
- {nova_trame-0.8.0.dist-info → nova_trame-0.10.0.dist-info}/entry_points.txt +0 -0
nova/__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
|
@@ -2,9 +2,8 @@
|
|
2
2
|
|
3
3
|
import logging
|
4
4
|
import re
|
5
|
-
from typing import Any, Dict
|
5
|
+
from typing import Any, Dict, Optional, Union
|
6
6
|
|
7
|
-
from mvvm_lib.pydantic_utils import get_field_info
|
8
7
|
from trame.app import get_server
|
9
8
|
from trame.widgets import client
|
10
9
|
from trame.widgets import vuetify3 as vuetify
|
@@ -12,6 +11,8 @@ from trame_client.widgets.core import AbstractElement
|
|
12
11
|
from trame_server.controller import Controller
|
13
12
|
from trame_server.state import State
|
14
13
|
|
14
|
+
from nova.mvvm.pydantic_utils import get_field_info
|
15
|
+
|
15
16
|
logger = logging.getLogger(__name__)
|
16
17
|
|
17
18
|
|
@@ -19,24 +20,28 @@ class InputField:
|
|
19
20
|
"""Factory class for generating Vuetify input components."""
|
20
21
|
|
21
22
|
@staticmethod
|
22
|
-
def create_boilerplate_properties(v_model: str
|
23
|
+
def create_boilerplate_properties(v_model: Optional[Union[tuple[str, Any], str]]) -> dict:
|
23
24
|
if not v_model:
|
24
25
|
return {}
|
25
|
-
|
26
|
+
if isinstance(v_model, tuple):
|
27
|
+
field = v_model[0]
|
28
|
+
else:
|
29
|
+
field = v_model
|
30
|
+
object_name_in_state = field.split(".")[0]
|
26
31
|
field_info = None
|
27
32
|
try:
|
28
|
-
field_name = ".".join(
|
33
|
+
field_name = ".".join(field.split(".")[1:])
|
29
34
|
if "[" in field_name:
|
30
35
|
index_field_name = re.sub(r"\[.*?\]", "[0]", field_name)
|
31
|
-
field_info = get_field_info(index_field_name)
|
36
|
+
field_info = get_field_info(f"{object_name_in_state}.{index_field_name}")
|
32
37
|
if "[" in field_name and "[index]" not in field_name:
|
33
38
|
field_info = None
|
34
39
|
logger.warning(
|
35
|
-
f"{
|
40
|
+
f"{field}: validation ignored. We currently only "
|
36
41
|
f"support single loop with index variable that should be called 'index'"
|
37
42
|
)
|
38
43
|
else:
|
39
|
-
field_info = get_field_info(
|
44
|
+
field_info = get_field_info(field)
|
40
45
|
except Exception as _:
|
41
46
|
pass
|
42
47
|
label = ""
|
@@ -58,12 +63,16 @@ class InputField:
|
|
58
63
|
}
|
59
64
|
if field_info:
|
60
65
|
args |= {
|
61
|
-
"rules": (f"[(v) => trigger('validate_pydantic_field', ['{
|
66
|
+
"rules": (f"[(v) => trigger('validate_pydantic_field', ['{field}', v, index])]",),
|
62
67
|
}
|
63
68
|
return args
|
64
69
|
|
65
70
|
def __new__(
|
66
|
-
cls,
|
71
|
+
cls,
|
72
|
+
v_model: Optional[Union[tuple[str, Any], str]] = None,
|
73
|
+
required: bool = False,
|
74
|
+
type: str = "text",
|
75
|
+
**kwargs: Any,
|
67
76
|
) -> AbstractElement:
|
68
77
|
"""Constructor for InputField.
|
69
78
|
|
@@ -3,12 +3,12 @@
|
|
3
3
|
from functools import partial
|
4
4
|
from typing import Any, Optional, cast
|
5
5
|
|
6
|
-
from mvvm_lib.trame_binding import TrameBinding
|
7
6
|
from trame.app import get_server
|
8
7
|
from trame.widgets import client, html
|
9
8
|
from trame.widgets import vuetify3 as vuetify
|
10
9
|
from trame_client.widgets.core import AbstractElement
|
11
10
|
|
11
|
+
from nova.mvvm.trame_binding import TrameBinding
|
12
12
|
from nova.trame.model.remote_file_input import RemoteFileInputModel
|
13
13
|
from nova.trame.view.components import InputField
|
14
14
|
from nova.trame.view_model.remote_file_input import RemoteFileInputViewModel
|
@@ -30,7 +30,6 @@ class RemoteFileInput:
|
|
30
30
|
dialog_props: Optional[dict[str, Any]] = None,
|
31
31
|
extensions: Optional[list[str]] = None,
|
32
32
|
input_props: Optional[dict[str, Any]] = None,
|
33
|
-
label: str = "",
|
34
33
|
) -> None:
|
35
34
|
"""Constructor for RemoteFileInput.
|
36
35
|
|
@@ -51,9 +50,7 @@ class RemoteFileInput:
|
|
51
50
|
extensions : list[str], optional
|
52
51
|
Only files with these extensions will be shown by default. The user can still choose to view all files.
|
53
52
|
input_props : dict[str, typing.Any], optional
|
54
|
-
Props to be passed to InputField.
|
55
|
-
label : str
|
56
|
-
Label shown in the input field and the dialog title.
|
53
|
+
Props to be passed to InputField.
|
57
54
|
|
58
55
|
Raises
|
59
56
|
------
|
@@ -75,7 +72,6 @@ class RemoteFileInput:
|
|
75
72
|
self.dialog_props = dict(dialog_props) if dialog_props else {}
|
76
73
|
self.extensions = extensions if extensions else []
|
77
74
|
self.input_props = dict(input_props) if input_props else {}
|
78
|
-
self.label = label
|
79
75
|
|
80
76
|
if "__events" not in self.input_props:
|
81
77
|
self.input_props["__events"] = []
|
@@ -93,11 +89,10 @@ class RemoteFileInput:
|
|
93
89
|
AbstractElement,
|
94
90
|
InputField(
|
95
91
|
v_model=self.v_model,
|
96
|
-
label=self.label,
|
97
92
|
change=(self.vm.select_file, "[$event.target.value]"),
|
98
93
|
**self.input_props,
|
99
94
|
),
|
100
|
-
):
|
95
|
+
) as input:
|
101
96
|
self.vm.init_view()
|
102
97
|
|
103
98
|
with vuetify.Template(v_slot_append=True):
|
@@ -111,7 +106,7 @@ class RemoteFileInput:
|
|
111
106
|
**self.dialog_props,
|
112
107
|
):
|
113
108
|
with vuetify.VCard(classes="pa-4"):
|
114
|
-
vuetify.VCardTitle(
|
109
|
+
vuetify.VCardTitle(input.label)
|
115
110
|
vuetify.VTextField(
|
116
111
|
v_model=self.v_model,
|
117
112
|
classes="mb-4 px-4",
|
nova/trame/view/theme/theme.py
CHANGED
@@ -9,7 +9,6 @@ from typing import Optional
|
|
9
9
|
|
10
10
|
import sass
|
11
11
|
from mergedeep import Strategy, merge
|
12
|
-
from mvvm_lib.pydantic_utils import validate_pydantic_parameter
|
13
12
|
from trame.app import get_server
|
14
13
|
from trame.assets.local import LocalFileManager
|
15
14
|
from trame.ui.vuetify3 import VAppLayout
|
@@ -19,6 +18,7 @@ from trame_client.widgets import html
|
|
19
18
|
from trame_server.core import Server
|
20
19
|
from trame_server.state import State
|
21
20
|
|
21
|
+
from nova.mvvm.pydantic_utils import validate_pydantic_parameter
|
22
22
|
from nova.trame.view.utilities.local_storage import LocalStorageManager
|
23
23
|
|
24
24
|
THEME_PATH = Path(__file__).parent
|
@@ -257,6 +257,6 @@ class ThemedApp:
|
|
257
257
|
def validate_pydantic_field(name: str, value: str, index: int) -> bool:
|
258
258
|
if "[index]" in name:
|
259
259
|
name = name.replace("[index]", f"[{str(index)}]")
|
260
|
-
return validate_pydantic_parameter(name, value
|
260
|
+
return validate_pydantic_parameter(name, value)
|
261
261
|
|
262
262
|
return layout
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nova-trame
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.0
|
4
4
|
Summary: A Python Package for injecting curated themes and custom components into Trame applications
|
5
5
|
License: MIT
|
6
6
|
Keywords: NDIP,Python,Trame,Vuetify
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
16
16
|
Requires-Dist: libsass (>=0.23.0,<0.24.0)
|
17
17
|
Requires-Dist: mergedeep (>=1.3.4,<2.0.0)
|
18
|
-
Requires-Dist: mvvm
|
18
|
+
Requires-Dist: nova-mvvm (>=0.6.1,<0.7.0)
|
19
19
|
Requires-Dist: pydantic (>=2.10.1,<3.0.0)
|
20
20
|
Requires-Dist: tomli (>=2.0.2,<3.0.0)
|
21
21
|
Requires-Dist: trame (>=3.6.3,<4.0.0)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
nova/__init__.py,sha256=
|
1
|
+
nova/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
|
2
2
|
nova/trame/__init__.py,sha256=gFrAg1qva5PIqR5TjvPzAxLx103IKipJLqp3XXvrQL8,59
|
3
3
|
nova/trame/model/remote_file_input.py,sha256=GRvWepYcFPjyrMOCI-mgr8GvDSYNag2oGqG-QY1Jfbw,3280
|
4
4
|
nova/trame/view/components/__init__.py,sha256=fopr6mVqcpDcVYK9ue7SLUHyswgvRPcFESTq86mu1R8,128
|
5
|
-
nova/trame/view/components/input_field.py,sha256=
|
6
|
-
nova/trame/view/components/remote_file_input.py,sha256=
|
5
|
+
nova/trame/view/components/input_field.py,sha256=ooTP0TafjY6Pp8d5zNP45ciRkSl_AHqYHx5h8nCUZrs,11355
|
6
|
+
nova/trame/view/components/remote_file_input.py,sha256=FaS1TxFBdNp8xB6CicC5iAX4kSdwePwRCiyTas0d_Tc,8233
|
7
7
|
nova/trame/view/components/visualization/__init__.py,sha256=kDX1fkbtAgXSGlqhlMNhYYoYrq-hfS636smjgLsh6gg,84
|
8
8
|
nova/trame/view/components/visualization/interactive_2d_plot.py,sha256=foZCMoqbuahT5dtqIQvm8C4ZJcY9P211eJEcpQJltmM,3421
|
9
9
|
nova/trame/view/layouts/__init__.py,sha256=cMrlB5YMUoK8EGB83b34UU0kPTVrH8AxsYvKRtpUNEc,141
|
@@ -14,11 +14,11 @@ nova/trame/view/theme/__init__.py,sha256=70_marDlTigIcPEOGiJb2JTs-8b2sGM5SlY7XBP
|
|
14
14
|
nova/trame/view/theme/assets/core_style.scss,sha256=AktysiiCYLeiTzCTtYwkksiUVmqb4S23RlDcW8L1ebI,518
|
15
15
|
nova/trame/view/theme/assets/favicon.png,sha256=Xbp1nUmhcBDeObjsebEbEAraPDZ_M163M_ZLtm5AbQc,1927
|
16
16
|
nova/trame/view/theme/assets/vuetify_config.json,sha256=1EwlDUHZiM45MWgnHSQKgLH_d0IZ1iaXjl3eXxGc2EI,4832
|
17
|
-
nova/trame/view/theme/theme.py,sha256=
|
17
|
+
nova/trame/view/theme/theme.py,sha256=lHeXZPGiS1Ezn3aiKpoEyarLgxOyatWOzYSApX9VI3M,11402
|
18
18
|
nova/trame/view/utilities/local_storage.py,sha256=vD8f2VZIpxhIKjZwEaD7siiPCTZO4cw9AfhwdawwYLY,3218
|
19
|
-
nova/trame/view_model/remote_file_input.py,sha256=
|
20
|
-
nova_trame-0.
|
21
|
-
nova_trame-0.
|
22
|
-
nova_trame-0.
|
23
|
-
nova_trame-0.
|
24
|
-
nova_trame-0.
|
19
|
+
nova/trame/view_model/remote_file_input.py,sha256=EU8jrU_3_BQqvta5-owSotHG0LAxLbTp6INqk3TdIZc,2986
|
20
|
+
nova_trame-0.10.0.dist-info/LICENSE,sha256=MOqZ8tPMKy8ZETJ2-HEvFTZ7dYNlg3gXmBkV-Y9i8bw,1061
|
21
|
+
nova_trame-0.10.0.dist-info/METADATA,sha256=bdwSpdOSWKJeNaaXp_hpAx0MUrDruXIjUimtgaJy7V4,1379
|
22
|
+
nova_trame-0.10.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
23
|
+
nova_trame-0.10.0.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
|
24
|
+
nova_trame-0.10.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|