nova-trame 0.19.0.dev4__py3-none-any.whl → 0.19.0.dev6__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/trame/view/components/data_selector.py +8 -7
- nova/trame/view/components/file_upload.py +8 -6
- nova/trame/view/components/remote_file_input.py +6 -2
- nova/trame/view/theme/assets/core_style.scss +23 -0
- {nova_trame-0.19.0.dev4.dist-info → nova_trame-0.19.0.dev6.dist-info}/METADATA +1 -1
- {nova_trame-0.19.0.dev4.dist-info → nova_trame-0.19.0.dev6.dist-info}/RECORD +9 -9
- {nova_trame-0.19.0.dev4.dist-info → nova_trame-0.19.0.dev6.dist-info}/LICENSE +0 -0
- {nova_trame-0.19.0.dev4.dist-info → nova_trame-0.19.0.dev6.dist-info}/WHEEL +0 -0
- {nova_trame-0.19.0.dev4.dist-info → nova_trame-0.19.0.dev6.dist-info}/entry_points.txt +0 -0
@@ -78,7 +78,7 @@ class DataSelector(vuetify.VDataTable):
|
|
78
78
|
self.create_ui(facility, instrument, **kwargs)
|
79
79
|
|
80
80
|
def create_ui(self, facility: str, instrument: str, **kwargs: Any) -> None:
|
81
|
-
with html.Div():
|
81
|
+
with html.Div(classes="nova-data-selector"):
|
82
82
|
with GridLayout(columns=3):
|
83
83
|
columns = 3
|
84
84
|
if facility == "":
|
@@ -98,24 +98,25 @@ class DataSelector(vuetify.VDataTable):
|
|
98
98
|
type="autocomplete",
|
99
99
|
)
|
100
100
|
|
101
|
-
with GridLayout(columns=
|
101
|
+
with GridLayout(columns=2, valign="start"):
|
102
102
|
if not self._prefix:
|
103
|
-
with html.Div(
|
103
|
+
with html.Div():
|
104
104
|
vuetify.VListSubheader("Available Directories", classes="justify-center px-0")
|
105
105
|
vuetify.VTreeview(
|
106
106
|
v_if=(f"{self._directories_name}.length > 0",),
|
107
107
|
activatable=True,
|
108
108
|
active_strategy="single-independent",
|
109
|
+
classes="overflow-y-auto",
|
109
110
|
item_value="path",
|
110
111
|
items=(self._directories_name,),
|
112
|
+
style="max-height: 460px",
|
111
113
|
update_activated=(self._vm.set_directory, "$event"),
|
112
114
|
)
|
113
|
-
vuetify.VListItem("No directories found", v_else=True)
|
115
|
+
vuetify.VListItem("No directories found", classes="text-center", v_else=True)
|
114
116
|
|
115
117
|
super().__init__(
|
116
118
|
v_model=self._v_model,
|
117
|
-
|
118
|
-
headers=("[{ align: 'center', key: 'title', title: 'Available Datafiles' }]",),
|
119
|
+
headers=("[{ align: 'left', key: 'title', title: 'Available Datafiles' }]",),
|
119
120
|
item_title="title",
|
120
121
|
item_value="path",
|
121
122
|
select_strategy=self._select_strategy,
|
@@ -140,7 +141,7 @@ class DataSelector(vuetify.VDataTable):
|
|
140
141
|
),
|
141
142
|
):
|
142
143
|
with vuetify.Template(raw_attrs=['v-slot:selection="{ item, index }"']):
|
143
|
-
vuetify.VChip("{{ item.title }}", v_if="index < 2")
|
144
|
+
vuetify.VChip("{{ item.title.split('/').reverse()[0] }}", v_if="index < 2")
|
144
145
|
html.Span(
|
145
146
|
f"(+{{{{ {self._v_model}.length - 2 }}}} others)", v_if="index === 2", classes="text-caption"
|
146
147
|
)
|
@@ -16,8 +16,9 @@ class FileUpload(vuetify.VBtn):
|
|
16
16
|
Parameters
|
17
17
|
----------
|
18
18
|
v_model : str
|
19
|
-
The state variable to set when the user uploads their file.
|
20
|
-
|
19
|
+
The state variable to set when the user uploads their file. The state variable will contain a latin1-decoded
|
20
|
+
version of the file contents. If your file is binary or requires a different string encoding, then you can
|
21
|
+
call `encode('latin1')` on the file contents to get the underlying bytes.
|
21
22
|
base_paths: list[str], optional
|
22
23
|
Passed to :ref:`RemoteFileInput <api_remotefileinput>`.
|
23
24
|
label : str, optional
|
@@ -47,10 +48,7 @@ class FileUpload(vuetify.VBtn):
|
|
47
48
|
ref=self._ref_name,
|
48
49
|
# Serialize the content in a way that will work with nova-mvvm and then push it to the server.
|
49
50
|
update_modelValue=(
|
50
|
-
f"{self._v_model}.
|
51
|
-
f" {self._v_model} = contents;"
|
52
|
-
f" flushState('{self._v_model.split('.')[0]}');"
|
53
|
-
"});"
|
51
|
+
f"{self._v_model}.arrayBuffer().then((contents) => {{ trigger('decode_blob', [contents]); }});"
|
54
52
|
),
|
55
53
|
)
|
56
54
|
self.remote_file_input = RemoteFileInput(
|
@@ -63,6 +61,10 @@ class FileUpload(vuetify.VBtn):
|
|
63
61
|
vuetify.VListItem("From Local Machine", click=f"trame.refs.{self._ref_name}.click()")
|
64
62
|
vuetify.VListItem("From Analysis Cluster", click=self.remote_file_input.open_dialog)
|
65
63
|
|
64
|
+
@self.server.controller.trigger("decode_blob")
|
65
|
+
def _decode_blob(contents: bytes) -> None:
|
66
|
+
self.remote_file_input.decode_file(contents)
|
67
|
+
|
66
68
|
def select_file(self, value: str) -> None:
|
67
69
|
"""Programmatically set the RemoteFileInput path.
|
68
70
|
|
@@ -202,8 +202,12 @@ class RemoteFileInput:
|
|
202
202
|
self.vm.valid_selection_bind.connect(self.vm.get_valid_selection_state_name())
|
203
203
|
|
204
204
|
def read_file(self, file_path: str) -> None:
|
205
|
-
with open(file_path, mode="
|
206
|
-
self.
|
205
|
+
with open(file_path, mode="rb") as file:
|
206
|
+
self.decode_file(file.read())
|
207
|
+
|
208
|
+
def decode_file(self, bytestream: bytes) -> None:
|
209
|
+
decoded_content = bytestream.decode("latin1")
|
210
|
+
self.set_v_model(decoded_content)
|
207
211
|
|
208
212
|
def select_file(self, value: str) -> None:
|
209
213
|
"""Programmatically set the v_model value."""
|
@@ -48,6 +48,29 @@ html {
|
|
48
48
|
border-radius: 4px;
|
49
49
|
}
|
50
50
|
|
51
|
+
.nova-data-selector {
|
52
|
+
.v-list-item {
|
53
|
+
padding-left: 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
.v-data-table__td {
|
57
|
+
max-width: 100px;
|
58
|
+
overflow: hidden;
|
59
|
+
padding: 0 !important;
|
60
|
+
text-overflow: ellipsis;
|
61
|
+
white-space: nowrap;
|
62
|
+
}
|
63
|
+
|
64
|
+
.v-data-table-footer {
|
65
|
+
justify-content: center;
|
66
|
+
|
67
|
+
.v-data-table-footer__items-per-page,
|
68
|
+
.v-data-table-footer__info {
|
69
|
+
display: none;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
51
74
|
.v-data-table {
|
52
75
|
td {
|
53
76
|
vertical-align: middle;
|
@@ -3,10 +3,10 @@ nova/trame/__init__.py,sha256=gFrAg1qva5PIqR5TjvPzAxLx103IKipJLqp3XXvrQL8,59
|
|
3
3
|
nova/trame/model/data_selector.py,sha256=6tH5E7PmPMc6Cc7utFqe7MUpKsUP15_2jU0plygeqn0,7168
|
4
4
|
nova/trame/model/remote_file_input.py,sha256=9KAf31ZHzpsh_aXUrNcF81Q5jvUZDWCzW1QATKls-Jk,3675
|
5
5
|
nova/trame/view/components/__init__.py,sha256=u8yzshFp_TmuC1g9TRxKjy_BdGWMIzPQouI52hzcr2U,234
|
6
|
-
nova/trame/view/components/data_selector.py,sha256=
|
7
|
-
nova/trame/view/components/file_upload.py,sha256=
|
6
|
+
nova/trame/view/components/data_selector.py,sha256=ikA_wSepGxrN2Egqmy7yGm00_OBhO-Pqun0DVYrehsM,8159
|
7
|
+
nova/trame/view/components/file_upload.py,sha256=_P-FJM2hHm7x0IcrPJhUQa1L43g7_P78Z3oJO2LqLck,3051
|
8
8
|
nova/trame/view/components/input_field.py,sha256=ncVVSzdJwH_-KP24I2rCqcb6v3J2hPhNTXr8Lb1EZ_U,15931
|
9
|
-
nova/trame/view/components/remote_file_input.py,sha256=
|
9
|
+
nova/trame/view/components/remote_file_input.py,sha256=MnsUttZaCy8vEpOmRqXMsWa6PiC-RTRb-hJnnH0rBZc,9644
|
10
10
|
nova/trame/view/components/visualization/__init__.py,sha256=reqkkbhD5uSksHHlhVMy1qNUCwSekS5HlXk6wCREYxU,152
|
11
11
|
nova/trame/view/components/visualization/interactive_2d_plot.py,sha256=foZCMoqbuahT5dtqIQvm8C4ZJcY9P211eJEcpQJltmM,3421
|
12
12
|
nova/trame/view/components/visualization/matplotlib_figure.py,sha256=yop7Kd_MylUiCwEial2jOYESbvchrYhrpSmRowUhePY,12003
|
@@ -15,7 +15,7 @@ nova/trame/view/layouts/grid.py,sha256=k-QHuH31XeAVDuMKUMoAMVnAM-Yavq7kdLYOC1ZrG
|
|
15
15
|
nova/trame/view/layouts/hbox.py,sha256=r5irhFX6YWTWN4V4NwNQx6mheyM8p6PVcJbrbhvOAwo,2625
|
16
16
|
nova/trame/view/layouts/vbox.py,sha256=Q4EvrtGJORyNF6AnCLGXToy8XU6yofiO5_kt7hK-AYs,2626
|
17
17
|
nova/trame/view/theme/__init__.py,sha256=70_marDlTigIcPEOGiJb2JTs-8b2sGM5SlY7XBPtBDM,54
|
18
|
-
nova/trame/view/theme/assets/core_style.scss,sha256=
|
18
|
+
nova/trame/view/theme/assets/core_style.scss,sha256=hfXhS6l2nBhU-Sm62YlUYDF_ufiYl56J8d0Cv1AMqKQ,2610
|
19
19
|
nova/trame/view/theme/assets/favicon.png,sha256=Xbp1nUmhcBDeObjsebEbEAraPDZ_M163M_ZLtm5AbQc,1927
|
20
20
|
nova/trame/view/theme/assets/js/delay_manager.js,sha256=vmb34DZ5YCQIlRW9Tf2M_uvJW6HFCmtlKZ5e_TPR8yg,536
|
21
21
|
nova/trame/view/theme/assets/js/lodash.debounce.min.js,sha256=GLzlQH04WDUNYN7i39ttHHejSdu-CpAvfWgDgKDn-OY,4448
|
@@ -25,8 +25,8 @@ nova/trame/view/theme/theme.py,sha256=OFUtq1IWriFcDu-346J67ZrSES8IOI9PTY_4Vwg7bZ
|
|
25
25
|
nova/trame/view/utilities/local_storage.py,sha256=vD8f2VZIpxhIKjZwEaD7siiPCTZO4cw9AfhwdawwYLY,3218
|
26
26
|
nova/trame/view_model/data_selector.py,sha256=Bpkfjd78ZIkexHNF_aA9PfizRBzkeOuoSE7ZsBFcSOs,1749
|
27
27
|
nova/trame/view_model/remote_file_input.py,sha256=ojEOJ8ZPkajpbAaZi9VLj7g-uBjhb8BMrTdMmwf_J6A,3367
|
28
|
-
nova_trame-0.19.0.
|
29
|
-
nova_trame-0.19.0.
|
30
|
-
nova_trame-0.19.0.
|
31
|
-
nova_trame-0.19.0.
|
32
|
-
nova_trame-0.19.0.
|
28
|
+
nova_trame-0.19.0.dev6.dist-info/LICENSE,sha256=Iu5QiDbwNbREg75iYaxIJ_V-zppuv4QFuBhAW-qiAlM,1061
|
29
|
+
nova_trame-0.19.0.dev6.dist-info/METADATA,sha256=nyFmfkbSXWeqJ9VEiPzTsupXrcy6yyNMRAh9p5v1oXE,1451
|
30
|
+
nova_trame-0.19.0.dev6.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
31
|
+
nova_trame-0.19.0.dev6.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
|
32
|
+
nova_trame-0.19.0.dev6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|