Commit 3ae04259 authored by Ayres, Andrew's avatar Ayres, Andrew
Browse files

fixes to code spacing

parent ed25e69c
Loading
Loading
Loading
Loading
Loading
+41 −41
Original line number Diff line number Diff line
@@ -77,14 +77,15 @@ To get started, let\'s create the Fractal class. Create an empty file at `src/no
*   **`run_fractal_tool` method**: This method encapsulates the logic for running the `fractal` tool. Let\'s examine the key steps within this method:

    *   **Instantiate `Connection`, `Tool`, and `Parameters`**: We create instances of the `Connection`, `Tool`, and `Parameters` classes:
    
```python
    def run_fractal_tool(self):
        conn = Connection(galaxy_url=self.galaxy_url, galaxy_key=self.galaxy_key)
        tool = Tool(id="neutrons_fractal")
        params = Parameters()
        params.add_input(name="option", value=self.fractal_type)

```

Note that we create a `Tool` object with the `id="neutrons_fractal"`. This tells `nova-galaxy` which NDIP tool we want to run. The obvious question at this point is how do we know the id of the tool and what parameters it expects? We can look at the tool\'s launch page in calvera for some hints but ultimately we have to look at the tool\'s [xml file](https://code.ornl.gov/ndip/galaxy-tools/-/blob/dev/tools/neutrons/test_tools/fractal.xml?ref_type=heads). 

*   **Connect and Run the Tool**:  The `with conn.connect() as galaxy_connection:` block establishes a connection to NDIP and ensures proper handling of the connection:
@@ -99,7 +100,6 @@ To get started, let\'s create the Fractal class. Create an empty file at `src/no
        print("Fractal tool finished successfully.")
```


**2. `main.py` - Calling the Model (`src/nova_tutorial/app/main.py`):**

We are now going to modify the existing `main.py` file. Change the main method to match the code below.
+34 −36
Original line number Diff line number Diff line
@@ -171,7 +171,6 @@ Let\'s see how to implement the MVVM pattern using `nova-mvvm` and incorporate P
    fractal_type: Literal["mandelbrot", "julia", "random", "markus"] = Field(default="mandelbrot")
    galaxy_url: str = Field(default_factory=lambda: os.getenv("GALAXY_URL"), description="NDIP Galaxy URL")
    galaxy_key: str = Field(default_factory=lambda: os.getenv("GALAXY_API_KEY"), description="NDIP Galaxy API Key")

    image_data: str = Field(default="", description="Base64 encoded PNG")
```

@@ -209,7 +208,6 @@ from .fractal import Fractal # Import Fractal
from nova_tutorial.app.view_models.main import MainViewModel

class FractalTab:

    def __init__(self, view_model: MainViewModel) -> None:
        self.view_model = view_model
        self.create_ui()
+24 −24

File changed.

Contains only whitespace changes.