Commit 6991f538 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 1ac450f4 6e9e626d
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

* 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.1

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

### nova-trame, 0.25.0

* FileUpload now supports a return_contents parameter (thanks to John Duggan).
+15 −4
Original line number Diff line number Diff line
"""Module for the Progress Tab."""

from typing import Tuple, Union

from trame.app import get_server
from trame.widgets import client
from trame.widgets import vuetify3 as vuetify
@@ -15,16 +17,17 @@ class ExecutionButtons:
    This is intended to be used with the `nova-galaxy ToolRunner <https://nova-application-development.readthedocs.io/projects/nova-galaxy/en/latest/core_concepts/tool_runner.html>`__.
    """

    def __init__(self, id: str, stop_btn: bool = False, download_btn: bool = False) -> None:
    def __init__(self, id: str, stop_btn: Union[bool, Tuple] = False, download_btn: Union[bool, Tuple] = False) -> None:
        """Constructor for ExecutionButtons.

        Parameters
        ----------
        id : str
            Component id. Should be used consistently with ToolRunner and other components.
        stop_btn: bool
            Component id. Should be used consistently with ToolRunner and other components. Note that this parameter
            does not support Trame bindings.
        stop_btn: Union[bool, Tuple]
            Display stop button.
        download_btn : bool
        download_btn : Union[bool, Tuple]
            Display download button.

        Returns
@@ -69,6 +72,9 @@ class ExecutionButtons:
                click=self.run,
            )
            if self.stop_btn:
                extra_params = {}
                if isinstance(self.stop_btn, tuple):
                    extra_params["v_if"] = self.stop_btn
                vuetify.VBtn(
                    "Stop",
                    disabled=(f"{self.id}.stop_disabled",),
@@ -77,6 +83,7 @@ class ExecutionButtons:
                    id=f"{self.id}_stop",
                    prepend_icon="mdi-stop",
                    click=self.stop,
                    **extra_params,
                )
            vuetify.VBtn(
                "Cancel",
@@ -89,12 +96,16 @@ class ExecutionButtons:
                click=self.cancel,
            )
            if self.download_btn:
                extra_params = {}
                if isinstance(self.download_btn, tuple):
                    extra_params["v_if"] = self.download_btn
                vuetify.VBtn(
                    "Download Results",
                    disabled=(f"{self.id}.download_disabled",),
                    loading=(f"{self.id}.download_in_progress",),
                    id=f"{self.id}.download",
                    click=self.download,
                    **extra_params,
                )

    async def download(self) -> None:
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ class ProgressBar:
        Parameters
        ----------
        id : str
            Component id. Should be used consistently with ToolRunner and other components
            Component id. Should be used consistently with ToolRunner and other components. Note that this parameter
            does not support Trame bindings.

        Returns
        -------
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ class ToolOutputWindows:
        Parameters
        ----------
        id : str
            Component id. Should be used consistently with ToolRunner and other components
            Component id. Should be used consistently with ToolRunner and other components. Note that this parameter
            does not support Trame bindings.

        Returns
        -------
+1 −0
Original line number Diff line number Diff line
@@ -523,6 +523,7 @@ class App(ThemedApp):

                    ToolOutputWindows("test")
                    ExecutionButtons("test")
                    ExecutionButtons("test_bindings", stop_btn=("true",), download_btn=False)

            with layout.post_content:
                html.Div("Sticky Bottom Content", classes="text-center w-100")