nova-trame 0.19.0.dev3__py3-none-any.whl → 0.19.0.dev5__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/model/data_selector.py +12 -1
- nova/trame/view/components/data_selector.py +9 -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 +19 -0
- {nova_trame-0.19.0.dev3.dist-info → nova_trame-0.19.0.dev5.dist-info}/METADATA +1 -1
- {nova_trame-0.19.0.dev3.dist-info → nova_trame-0.19.0.dev5.dist-info}/RECORD +10 -10
- {nova_trame-0.19.0.dev3.dist-info → nova_trame-0.19.0.dev5.dist-info}/LICENSE +0 -0
- {nova_trame-0.19.0.dev3.dist-info → nova_trame-0.19.0.dev5.dist-info}/WHEEL +0 -0
- {nova_trame-0.19.0.dev3.dist-info → nova_trame-0.19.0.dev5.dist-info}/entry_points.txt +0 -0
@@ -129,6 +129,17 @@ class DataSelectorModel:
|
|
129
129
|
|
130
130
|
return sorted(experiments)
|
131
131
|
|
132
|
+
def sort_directories(self, directories: List[Any]) -> List[Any]:
|
133
|
+
# Sort the current level of dictionaries
|
134
|
+
sorted_dirs = sorted(directories, key=lambda x: x["title"])
|
135
|
+
|
136
|
+
# Process each sorted item to sort their children
|
137
|
+
for item in sorted_dirs:
|
138
|
+
if "children" in item and isinstance(item["children"], list):
|
139
|
+
item["children"] = self.sort_directories(item["children"])
|
140
|
+
|
141
|
+
return sorted_dirs
|
142
|
+
|
132
143
|
def get_directories(self) -> List[Any]:
|
133
144
|
if not self.state.experiment:
|
134
145
|
return []
|
@@ -162,7 +173,7 @@ class DataSelectorModel:
|
|
162
173
|
except OSError:
|
163
174
|
pass
|
164
175
|
|
165
|
-
return directories
|
176
|
+
return self.sort_directories(directories)
|
166
177
|
|
167
178
|
def get_datafiles(self) -> List[str]:
|
168
179
|
datafiles = []
|
@@ -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,7 +98,7 @@ 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
103
|
with html.Div():
|
104
104
|
vuetify.VListSubheader("Available Directories", classes="justify-center px-0")
|
@@ -106,16 +106,17 @@ class DataSelector(vuetify.VDataTable):
|
|
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: 500px",
|
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,
|
@@ -129,17 +130,18 @@ class DataSelector(vuetify.VDataTable):
|
|
129
130
|
with cast(
|
130
131
|
vuetify.VSelect,
|
131
132
|
InputField(
|
132
|
-
|
133
|
+
v_show=f"{self._v_model}.length > 0",
|
133
134
|
v_model=self._v_model,
|
134
135
|
classes="nova-readonly",
|
135
136
|
clearable=True,
|
136
137
|
label=self._label,
|
137
138
|
readonly=True,
|
138
139
|
type="select",
|
140
|
+
click_clear=f"{self._v_model} = []; flushState('{self._v_model.split('.')[0]}');",
|
139
141
|
),
|
140
142
|
):
|
141
143
|
with vuetify.Template(raw_attrs=['v-slot:selection="{ item, index }"']):
|
142
|
-
vuetify.VChip("{{ item.title }}", v_if="index < 2")
|
144
|
+
vuetify.VChip("{{ item.title.split('/').reverse()[0] }}", v_if="index < 2")
|
143
145
|
html.Span(
|
144
146
|
f"(+{{{{ {self._v_model}.length - 2 }}}} others)", v_if="index === 2", classes="text-caption"
|
145
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,25 @@ html {
|
|
48
48
|
border-radius: 4px;
|
49
49
|
}
|
50
50
|
|
51
|
+
.nova-data-selector {
|
52
|
+
.v-data-table__td {
|
53
|
+
max-width: 100px;
|
54
|
+
overflow: hidden;
|
55
|
+
padding: 0 !important;
|
56
|
+
text-overflow: ellipsis;
|
57
|
+
white-space: nowrap;
|
58
|
+
}
|
59
|
+
|
60
|
+
.v-data-table-footer {
|
61
|
+
justify-content: center;
|
62
|
+
|
63
|
+
.v-data-table-footer__items-per-page,
|
64
|
+
.v-data-table-footer__info {
|
65
|
+
display: none;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
51
70
|
.v-data-table {
|
52
71
|
td {
|
53
72
|
vertical-align: middle;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
nova/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
|
2
2
|
nova/trame/__init__.py,sha256=gFrAg1qva5PIqR5TjvPzAxLx103IKipJLqp3XXvrQL8,59
|
3
|
-
nova/trame/model/data_selector.py,sha256=
|
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=VbZtgSgb6jRXJmj31uYqVdMjpcHyioDW_1RD3yLGMDw,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=dez2vI7dPfjYQGHJSKiKCCsLTidAQsAcynidNYN4VBk,2547
|
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.dev5.dist-info/LICENSE,sha256=Iu5QiDbwNbREg75iYaxIJ_V-zppuv4QFuBhAW-qiAlM,1061
|
29
|
+
nova_trame-0.19.0.dev5.dist-info/METADATA,sha256=jq6kH6P8wTV1xtLC_6p-WGhunujfdYwijEK_lqutRl0,1451
|
30
|
+
nova_trame-0.19.0.dev5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
31
|
+
nova_trame-0.19.0.dev5.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
|
32
|
+
nova_trame-0.19.0.dev5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|