nova-trame 0.19.0.dev2__py3-none-any.whl → 0.19.0.dev4__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 +63 -57
- {nova_trame-0.19.0.dev2.dist-info → nova_trame-0.19.0.dev4.dist-info}/METADATA +1 -1
- {nova_trame-0.19.0.dev2.dist-info → nova_trame-0.19.0.dev4.dist-info}/RECORD +7 -7
- {nova_trame-0.19.0.dev2.dist-info → nova_trame-0.19.0.dev4.dist-info}/LICENSE +0 -0
- {nova_trame-0.19.0.dev2.dist-info → nova_trame-0.19.0.dev4.dist-info}/WHEEL +0 -0
- {nova_trame-0.19.0.dev2.dist-info → nova_trame-0.19.0.dev4.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,66 +78,72 @@ 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
|
82
|
-
columns
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
81
|
+
with html.Div():
|
82
|
+
with GridLayout(columns=3):
|
83
|
+
columns = 3
|
84
|
+
if facility == "":
|
85
|
+
columns -= 1
|
86
|
+
InputField(
|
87
|
+
v_model=f"{self._state_name}.facility", items=(self._facilities_name,), type="autocomplete"
|
88
|
+
)
|
89
|
+
if instrument == "":
|
90
|
+
columns -= 1
|
91
|
+
InputField(
|
92
|
+
v_model=f"{self._state_name}.instrument", items=(self._instruments_name,), type="autocomplete"
|
93
|
+
)
|
88
94
|
InputField(
|
89
|
-
v_model=f"{self._state_name}.
|
95
|
+
v_model=f"{self._state_name}.experiment",
|
96
|
+
column_span=columns,
|
97
|
+
items=(self._experiments_name,),
|
98
|
+
type="autocomplete",
|
99
|
+
)
|
100
|
+
|
101
|
+
with GridLayout(columns=3, height="500px", valign="start"):
|
102
|
+
if not self._prefix:
|
103
|
+
with html.Div(classes="overflow-y-auto", style="max-height: 500px"):
|
104
|
+
vuetify.VListSubheader("Available Directories", classes="justify-center px-0")
|
105
|
+
vuetify.VTreeview(
|
106
|
+
v_if=(f"{self._directories_name}.length > 0",),
|
107
|
+
activatable=True,
|
108
|
+
active_strategy="single-independent",
|
109
|
+
item_value="path",
|
110
|
+
items=(self._directories_name,),
|
111
|
+
update_activated=(self._vm.set_directory, "$event"),
|
112
|
+
)
|
113
|
+
vuetify.VListItem("No directories found", v_else=True)
|
114
|
+
|
115
|
+
super().__init__(
|
116
|
+
v_model=self._v_model,
|
117
|
+
column_span=3 if self._prefix else 2,
|
118
|
+
headers=("[{ align: 'center', key: 'title', title: 'Available Datafiles' }]",),
|
119
|
+
item_title="title",
|
120
|
+
item_value="path",
|
121
|
+
select_strategy=self._select_strategy,
|
122
|
+
show_select=True,
|
123
|
+
**kwargs,
|
90
124
|
)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
125
|
+
self.items = (self._datafiles_name,)
|
126
|
+
if "update_modelValue" not in kwargs:
|
127
|
+
self.update_modelValue = f"flushState('{self._v_model.split('.')[0]}')"
|
128
|
+
|
129
|
+
with cast(
|
130
|
+
vuetify.VSelect,
|
131
|
+
InputField(
|
132
|
+
v_show=f"{self._v_model}.length > 0",
|
133
|
+
v_model=self._v_model,
|
134
|
+
classes="nova-readonly",
|
135
|
+
clearable=True,
|
136
|
+
label=self._label,
|
137
|
+
readonly=True,
|
138
|
+
type="select",
|
139
|
+
click_clear=f"{self._v_model} = []; flushState('{self._v_model.split('.')[0]}');",
|
140
|
+
),
|
141
|
+
):
|
142
|
+
with vuetify.Template(raw_attrs=['v-slot:selection="{ item, index }"']):
|
143
|
+
vuetify.VChip("{{ item.title }}", v_if="index < 2")
|
144
|
+
html.Span(
|
145
|
+
f"(+{{{{ {self._v_model}.length - 2 }}}} others)", v_if="index === 2", classes="text-caption"
|
109
146
|
)
|
110
|
-
vuetify.VListItem("No directories found", v_else=True)
|
111
|
-
|
112
|
-
super().__init__(
|
113
|
-
v_model=self._v_model,
|
114
|
-
column_span=3 if self._prefix else 2,
|
115
|
-
headers=("[{ align: 'center', key: 'title', title: 'Available Datafiles' }]",),
|
116
|
-
item_title="title",
|
117
|
-
item_value="path",
|
118
|
-
select_strategy=self._select_strategy,
|
119
|
-
show_select=True,
|
120
|
-
**kwargs,
|
121
|
-
)
|
122
|
-
self.items = (self._datafiles_name,)
|
123
|
-
if "update_modelValue" not in kwargs:
|
124
|
-
self.update_modelValue = f"flushState('{self._v_model.split('.')[0]}')"
|
125
|
-
|
126
|
-
with cast(
|
127
|
-
vuetify.VSelect,
|
128
|
-
InputField(
|
129
|
-
v_if=f"{self._v_model}.length > 0",
|
130
|
-
v_model=self._v_model,
|
131
|
-
classes="nova-readonly",
|
132
|
-
clearable=True,
|
133
|
-
label=self._label,
|
134
|
-
readonly=True,
|
135
|
-
type="select",
|
136
|
-
),
|
137
|
-
):
|
138
|
-
with vuetify.Template(raw_attrs=['v-slot:selection="{ item, index }"']):
|
139
|
-
vuetify.VChip("{{ item.title }}", v_if="index < 2")
|
140
|
-
html.Span(f"(+{{{{ {self._v_model}.length - 2 }}}} others)", v_if="index === 2", classes="text-caption")
|
141
147
|
|
142
148
|
def create_model(self, facility: str, instrument: str) -> None:
|
143
149
|
self._model = DataSelectorModel(facility, instrument, self._prefix)
|
@@ -1,9 +1,9 @@
|
|
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=
|
6
|
+
nova/trame/view/components/data_selector.py,sha256=L9AzHrg1IH_SwlOTjQiZNeN_mEVsCj0xgKIeYLVnFH4,8102
|
7
7
|
nova/trame/view/components/file_upload.py,sha256=XbiSx2txpdohwxGyP-ecTbIgMPv6siUARJ7nXhXaiAc,2827
|
8
8
|
nova/trame/view/components/input_field.py,sha256=ncVVSzdJwH_-KP24I2rCqcb6v3J2hPhNTXr8Lb1EZ_U,15931
|
9
9
|
nova/trame/view/components/remote_file_input.py,sha256=lFchhhoMo9EgSr7pSlh2LEm8NZO1XXrBcfh_BLGZBV0,9492
|
@@ -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.dev4.dist-info/LICENSE,sha256=Iu5QiDbwNbREg75iYaxIJ_V-zppuv4QFuBhAW-qiAlM,1061
|
29
|
+
nova_trame-0.19.0.dev4.dist-info/METADATA,sha256=_hm3UBkHt6w5rNkzy_v089JWk_nn94RocwvVNtrsnys,1451
|
30
|
+
nova_trame-0.19.0.dev4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
31
|
+
nova_trame-0.19.0.dev4.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
|
32
|
+
nova_trame-0.19.0.dev4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|