nova-trame 0.26.2__py3-none-any.whl → 0.27.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.
@@ -91,7 +91,7 @@ class NeutronDataSelector(DataSelector):
91
91
  if data_source == "oncat" and subdirectory:
92
92
  warn("subdirectory will be ignored since data will be pulled from ONCat.", stacklevel=1)
93
93
 
94
- if isinstance(facility, str) and allow_custom_directories:
94
+ if isinstance(facility, str) and facility and allow_custom_directories:
95
95
  warn("allow_custom_directories will be ignored since the facility parameter is fixed.", stacklevel=1)
96
96
 
97
97
  self._facility = facility
@@ -4,11 +4,15 @@ class RevoGrid {
4
4
  this.modelKey = modelKey
5
5
  this.dataKey = dataKey
6
6
  this.stateKey = stateKey
7
+ this.lastSelection = null
8
+ this.shiftPressed = false
7
9
 
8
10
  this.grid = document.querySelector(`#${this.id}`)
9
11
  this.grid.addEventListener('viewportscroll', () => {
10
12
  this.updateCheckboxes()
11
13
  })
14
+
15
+ this.initShiftKeyListeners()
12
16
  }
13
17
 
14
18
  updateCheckboxes() {
@@ -66,11 +70,32 @@ class RevoGrid {
66
70
  const path = props.data[props.rowIndex].path
67
71
  const index = modelValue.indexOf(path)
68
72
 
69
- // We need to assign instead of modifying in place in order for the Trame watcher to pick up changes.
73
+ // I use _.set instead of modifying the modelValue in place in order for the Trame watcher to properly detect the change.
70
74
  if (e.target.checked && index < 0) {
71
- _.set(trameState, this.modelKey, _.concat(modelValue, path))
75
+ const newIndex = props.data.findIndex((entry) => entry.path === path)
76
+
77
+ if (this.shiftPressed && this.lastSelection !== null) {
78
+ let newPaths = []
79
+ // JavaScript doesn't allow a backwards step during slice, so we need to order the start/stop correctly.
80
+ if (this.lastSelection < newIndex) {
81
+ newPaths = props.data.slice(this.lastSelection, newIndex + 1)
82
+ } else {
83
+ newPaths = props.data.slice(newIndex, this.lastSelection)
84
+ }
85
+ // Exclude paths that are already selected to avoid duplicates.
86
+ newPaths = newPaths.map((entry) => entry.path).filter((path) => !modelValue.includes(path))
87
+
88
+ _.set(trameState, this.modelKey, _.concat(modelValue, newPaths))
89
+ } else {
90
+ _.set(trameState, this.modelKey, _.concat(modelValue, path))
91
+ }
92
+
93
+ this.lastSelection = newIndex
72
94
  } else if (index >= 0) {
73
95
  _.set(trameState, this.modelKey, modelValue.toSpliced(index, 1))
96
+
97
+ // Only allow range selection if the last action was to select a file.
98
+ this.lastSelection = null
74
99
  }
75
100
 
76
101
  // Update the UI
@@ -103,6 +128,18 @@ class RevoGrid {
103
128
 
104
129
  return [inputVNode, 'Available Datafiles']
105
130
  }
131
+
132
+ initShiftKeyListeners() {
133
+ window.document.addEventListener('keydown', (e) => {
134
+ this.shiftPressed = e.shiftKey
135
+ })
136
+
137
+ window.document.addEventListener('keyup', (e) => {
138
+ if (e.key === 'Shift') {
139
+ this.shiftPressed = false
140
+ }
141
+ })
142
+ }
106
143
  }
107
144
 
108
145
  class RevoGridManager {
@@ -3,6 +3,7 @@
3
3
  import asyncio
4
4
  import json
5
5
  import logging
6
+ import os
6
7
  import sys
7
8
  from asyncio import create_task
8
9
  from functools import partial
@@ -210,6 +211,10 @@ class ThemedApp:
210
211
  -------
211
212
  `trame_client.ui.core.AbstractLayout <https://trame.readthedocs.io/en/latest/core.ui.html#trame_client.ui.core.AbstractLayout>`_
212
213
  """
214
+ # This detects if Poetry is running Python so that we can show links to NOVA resources during development.
215
+ # Poetry should not be used in production.
216
+ show_nova_resources = os.environ.get("VIRTUAL_ENV") is not None
217
+
213
218
  with VAppLayout(self.server, vuetify_config=self.vuetify_config) as layout:
214
219
  self.local_storage = LocalStorageManager(self.server.controller)
215
220
 
@@ -225,8 +230,32 @@ class ThemedApp:
225
230
  with vuetify.VAppBar() as toolbar:
226
231
  layout.toolbar = toolbar
227
232
 
228
- with vuetify.VAppBarTitle() as toolbar_title:
233
+ with vuetify.VAppBarTitle(classes="flex-0-1") as toolbar_title:
229
234
  layout.toolbar_title = toolbar_title
235
+
236
+ if show_nova_resources:
237
+ vuetify.VBtn(
238
+ "NOVA Examples",
239
+ classes="ml-4",
240
+ href="https://github.com/nova-model/nova-examples/",
241
+ __properties=["target"],
242
+ target="_blank",
243
+ )
244
+ html.Div("·", classes="mx-1")
245
+ vuetify.VBtn(
246
+ "NOVA Tutorial",
247
+ href="https://nova.ornl.gov/tutorial/",
248
+ __properties=["target"],
249
+ target="_blank",
250
+ )
251
+ html.Div("·", classes="mx-1")
252
+ vuetify.VBtn(
253
+ "NOVA Documentation",
254
+ href="https://nova-application-development.readthedocs.io/en/latest/",
255
+ __properties=["target"],
256
+ target="_blank",
257
+ )
258
+
230
259
  vuetify.VSpacer()
231
260
  with html.Div(classes="mr-2") as actions:
232
261
  layout.actions = actions
@@ -1,18 +1,19 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: nova-trame
3
- Version: 0.26.2
3
+ Version: 0.27.0
4
4
  Summary: A Python Package for injecting curated themes and custom components into Trame applications
5
- License: MIT
5
+ License-Expression: MIT
6
+ License-File: LICENSE
6
7
  Keywords: NDIP,Python,Trame,Vuetify
7
8
  Author: John Duggan
8
9
  Author-email: dugganjw@ornl.gov
9
10
  Requires-Python: >=3.10,<4.0
10
- Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
16
17
  Requires-Dist: altair
17
18
  Requires-Dist: blinker (>=1.9.0,<2.0.0)
18
19
  Requires-Dist: libsass
@@ -12,7 +12,7 @@ nova/trame/view/components/execution_buttons.py,sha256=Br6uAmE5bY67TTYc5ZTHECNJ_
12
12
  nova/trame/view/components/file_upload.py,sha256=WOaFXeNNwN0DYZJr-W6vWdBiTpr7m-lq3WKJaHmeMe8,4560
13
13
  nova/trame/view/components/input_field.py,sha256=xzCmNEoB4ljGx99-gGgTV0UwriwtS8ce22zPA4QneZw,17372
14
14
  nova/trame/view/components/ornl/__init__.py,sha256=HnxzzSsxw0vQSDCVFfWsAxx1n3HnU37LMuQkfiewmSU,90
15
- nova/trame/view/components/ornl/neutron_data_selector.py,sha256=wVSLmRXiGOv2l-nZ0DgDwjrgTMZDu9e9ECm3k824k3o,16749
15
+ nova/trame/view/components/ornl/neutron_data_selector.py,sha256=6X4sz54DaVYfW8LYOazpA-paGy1mc4gLoka--34GMdE,16762
16
16
  nova/trame/view/components/progress_bar.py,sha256=zhbJwPy_HPQ8YL-ISN8sCRUQ7qY6qqo9wiV59BmvL8I,3038
17
17
  nova/trame/view/components/remote_file_input.py,sha256=mcz_bmI2rD8gdmIOKLhlzfj-XoWBwC99T9ZgQORaKqE,14674
18
18
  nova/trame/view/components/tool_outputs.py,sha256=IbYV4VjrkWAE354Bh5KH76SPsxGLIkOXChijS4-ce_Y,2408
@@ -29,10 +29,10 @@ nova/trame/view/theme/assets/core_style.scss,sha256=3-3qMc5gpaDhfuVWAF_psBH5alxw
29
29
  nova/trame/view/theme/assets/favicon.png,sha256=Xbp1nUmhcBDeObjsebEbEAraPDZ_M163M_ZLtm5AbQc,1927
30
30
  nova/trame/view/theme/assets/js/delay_manager.js,sha256=BN4OL88QsyZG4XQ1sTorHpN1rwD4GnWoVKHvl5F5ydo,776
31
31
  nova/trame/view/theme/assets/js/lodash.min.js,sha256=KCyAYJ-fsqtp_HMwbjhy6IKjlA5lrVrtWt1JdMsC57k,73016
32
- nova/trame/view/theme/assets/js/revo_grid.js,sha256=fbuEWO8etw-xgo9tjJGjJXdd5wL8qpgabPmrnU6Jp8k,4081
32
+ nova/trame/view/theme/assets/js/revo_grid.js,sha256=73v-GP4IUIg8OgMnRCoHB6ERFU18nx0VYaEecV_7u-o,5695
33
33
  nova/trame/view/theme/assets/vuetify_config.json,sha256=a0FSgpLYWGFlRGSMhMq61MyDFBEBwvz55G4qjkM08cs,5627
34
34
  nova/trame/view/theme/exit_button.py,sha256=Kqv1GVJZGrSsj6_JFjGU3vm3iNuMolLC2T1x2IsdmV0,3094
35
- nova/trame/view/theme/theme.py,sha256=8JqSrEbhxK1SccXE1_jUdel9Wtc2QNObVEwtbVWG_QY,13146
35
+ nova/trame/view/theme/theme.py,sha256=bwKzMkGcqoIx_H70FOYIwG3QYQ6tya0dXJaUoxGWQn0,14575
36
36
  nova/trame/view/utilities/local_storage.py,sha256=vD8f2VZIpxhIKjZwEaD7siiPCTZO4cw9AfhwdawwYLY,3218
37
37
  nova/trame/view_model/data_selector.py,sha256=jAtq5hpohQ6YiLBbgLJfNUzWZBpN2bjCG_c_FCJu2ns,3186
38
38
  nova/trame/view_model/execution_buttons.py,sha256=MfKSp95D92EqpD48C15cBo6dLO0Yld4FeRZMJNxJf7Y,3551
@@ -40,8 +40,8 @@ nova/trame/view_model/ornl/neutron_data_selector.py,sha256=PIKQyzcHpwu81DNk3d8Af
40
40
  nova/trame/view_model/progress_bar.py,sha256=6AUKHF3hfzbdsHqNEnmHRgDcBKY5TT8ywDx9S6ovnsc,2854
41
41
  nova/trame/view_model/remote_file_input.py,sha256=zWOflmCDJYYR_pacHphwzricV667GSRokh-mlxpBAOo,3646
42
42
  nova/trame/view_model/tool_outputs.py,sha256=ev6LY7fJ0H2xAJn9f5ww28c8Kpom2SYc2FbvFcoN4zg,829
43
- nova_trame-0.26.2.dist-info/LICENSE,sha256=Iu5QiDbwNbREg75iYaxIJ_V-zppuv4QFuBhAW-qiAlM,1061
44
- nova_trame-0.26.2.dist-info/METADATA,sha256=mDqDXOmyd5tFAnh7-VtPdiYu1ij7ajZcanzkgC6Ojps,1763
45
- nova_trame-0.26.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
46
- nova_trame-0.26.2.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
47
- nova_trame-0.26.2.dist-info/RECORD,,
43
+ nova_trame-0.27.0.dist-info/METADATA,sha256=pj-cjaC_mkFmqwPXwbOyDi0R8UdhikVQKD4jf_H0Kjc,1796
44
+ nova_trame-0.27.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
45
+ nova_trame-0.27.0.dist-info/entry_points.txt,sha256=J2AmeSwiTYZ4ZqHHp9HO6v4MaYQTTBPbNh6WtoqOT58,42
46
+ nova_trame-0.27.0.dist-info/licenses/LICENSE,sha256=Iu5QiDbwNbREg75iYaxIJ_V-zppuv4QFuBhAW-qiAlM,1061
47
+ nova_trame-0.27.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.3
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any