Commit 7a731ce2 authored by Duggan, John's avatar Duggan, John
Browse files

Merge remote-tracking branch 'origin/main' into 70-add-component-for-selecting-datafiles-from-oncat

parents 6991f538 2d4dd18b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2,6 +2,14 @@

* Added data_source and projection parameters to NeutronDataSelector to allow populating data files from ONCat (thanks to Andrew Ayres and John Duggan).

### nova-trame, 0.25.3

* Clearing NeutronDataSelector file selections will no longer send null/None values to the state (thanks to John Duggan).

### nova-trame, 0.25.2

* NeutronDataSelector should now reset its state properly when changing the instrument or experiment (thanks to John Duggan).

### nova-trame, 0.25.1

* ExecutionButtons now supports binding to stop_btn and download_btn parameters (thanks to John Duggan).
+791 −632

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ packages = [{include = "nova", from = "src"}]
altair = "*"
libsass = "*"
mergedeep = "*"
mpld3 = "^0.5.11"
python = ">=3.10,<4.0"
tomli = "*"
tornado = ">=6.5.0"
+8 −1
Original line number Diff line number Diff line
@@ -7,6 +7,13 @@ from trame_server.core import State
from nova.mvvm._internal.utils import rgetdictvalue, rsetdictvalue


# Trame state handlers don't work on nested properties. When writing Trame state handlers (e.g. flushState, dirty, or
# change), we instead use the name of the top-level property. For example, "config.parameter_group_a.option_x" becomes
# "config".
def get_state_name(name: str) -> str:
    return name.split(".")[0]


# Reads a state parameter from Trame. For internal use only, if you're using this in your application you're violating
# the MVVM framework. :)
def get_state_param(state: State, value: Union[Any, Tuple]) -> Any:
@@ -25,6 +32,6 @@ def set_state_param(state: State, value: Union[Any, Tuple], new_value: Any = Non
                rsetdictvalue(state, value[0], new_value)
            elif len(value) > 1:
                rsetdictvalue(state, value[0], value[1])
            state.dirty(value[0].split(".")[0])
            state.dirty(get_state_name(value[0]))

    return get_state_param(state, value)
+6 −2
Original line number Diff line number Diff line
@@ -70,7 +70,10 @@ class AnalysisDataSelectorState(NeutronDataSelectorState):
    def validate_state(self) -> Self:
        valid_facilities = self.get_facilities()
        if self.facility and self.facility not in valid_facilities:
            warn(f"Facility '{self.facility}' could not be found. Valid options: {valid_facilities}", stacklevel=1)
            warn(
                f"Facility '{self.facility}' could not be found. Valid options: {valid_facilities}",
                stacklevel=1,
            )

        valid_instruments = self.get_instruments()
        if self.instrument and self.facility != CUSTOM_DIRECTORIES_LABEL and self.instrument not in valid_instruments:
@@ -152,9 +155,10 @@ class AnalysisDataSelectorModel(NeutronDataSelectorModel):
        return self.get_directories_from_path(base_path)

    def get_datafiles(self, *args: Any, **kwargs: Any) -> List[str]:
        using_custom_directory = self.state.facility == CUSTOM_DIRECTORIES_LABEL
        if self.state.experiment:
            base_path = Path("/") / self.state.facility / self.get_instrument_dir() / self.state.experiment
        elif self.state.custom_directory:
        elif using_custom_directory and self.state.custom_directory:
            base_path = Path(self.state.custom_directory)
        else:
            return []
Loading