Unverified Commit 6e9e626d authored by Duggan, John's avatar Duggan, John Committed by GitHub
Browse files

Merge pull request #134 from nova-model/120-executionbuttons---add-binding-support-for-parameters

Add binding support for ExecutionButtons
parents d317631a 92b8f081
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
### 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).
+1 −1
Original line number Diff line number Diff line
[project]
name = "nova-trame"
version = "0.25.0"
version = "0.25.1"
description = "A Python Package for injecting curated themes and custom components into Trame applications"
authors = [
    { name = "John Duggan", email = "dugganjw@ornl.gov" },
+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
        -------
Loading