@@ -201,11 +201,19 @@ The Outputs can be used by the rest of your application, saved, or simply discar
At times, it may be desirable to execute a tool or workflow without waiting on the result. The class Tool method run has an optional `wait` parameter. The default is true so that the tool is run in a blocking manner. However, by setting the parameter to false, the tool will be run asynchronously in a non-blocking manner. It is beyond the scope of this episode, but if you were to attempt modify the example to run the tool asynchronously, your code might look something like this.
Note, when run in this manner, the output of tool.run() will be `None`. In order to retrieve results, you can use `tool.get_results()`. If the tool has not finished execution, this will also return `None`. As soon as results are available, the method will provide the results, exactly like the blocking execution.
This command will download the template to a directory called `advanced_pydantic`. Copier will prompt you with a series of questions. Please answer the questions as follows:
This command will download the template to a directory called `pydantic_mvvm`. Copier will prompt you with a series of questions. Please answer the questions as follows:
@@ -38,7 +38,7 @@ The complete code for this episode is available in the `code/episode_7` director
Let\'s start by setting up a new application from the template. When answering the `copier` questions, make sure you select "no" for installing Mantid and set up a Trame-based, multi-tab view based on MVVM.
@@ -91,7 +91,7 @@ The pandas install is only necessary for loading example data from Plotly, which
Now, we can create a view that displays a Plotly figure.
**1. `PlotlyView` View Class (`src/viz_examples/views/plotly.py`) (Create):**
**1. `PlotlyView` View Class (`src/viz_examples/app/views/plotly.py`) (Create):**
***Imports**: Pay special attention to the plotly import. This module contains a Trame widget that will allow us to quickly add a Plotly chart to our view.
@@ -218,7 +218,7 @@ class PlotlyConfig(BaseModel):
First, let's add replace the sample tabs from the template with the following:
**7. `PyVistaConfig` Model Class (`src/viz_examples/models/pyvista.py`):**
**7. `PyVistaConfig` Model Class (`src/viz_examples/app/models/pyvista.py`):**
***Imports:**`download_knee_full` yields a 3D dataset that is suitable for volume rendering. You can find more datasets in PyVista\'s [Dataset Gallery](https://docs.pyvista.org/api/examples/dataset_gallery).
@@ -403,7 +403,7 @@ PyVista\'s volume rendering engine isn\'t currently suitable for large data. If
@@ -483,7 +483,7 @@ PyVista isn't compatible with VTK 9.4, yet. If you are not using PyVista, there
Once more, let's setup a view and model.
**11. `VTKView` View Class (`src/viz_examples/views/vtk.py`):**
**11. `VTKView` View Class (`src/viz_examples/app/views/vtk.py`):**
***Imports:** The `vtkRenderingVolumeOpenGL2` import is necessary despite being unreferenced.
@@ -544,7 +544,7 @@ class VTKView:
self.render_window.Render()
```
**12. `VTKConfig` Model Class (`src/viz_examples/models/vtk.py`):**
**12. `VTKConfig` Model Class (`src/viz_examples/app/models/vtk.py`):**
***Imports:** We are only using PyVista to get an example dataset. There are two references to it as we use `KNEE_DATA` to compute min/max bounds for the data and `KNEE_DATAFILE` to pass the data file into a VTK reader. The FixedPointVolumeRayCastMapper is CPU-based, but other mappers are available if you need GPU support.
@@ -676,7 +676,7 @@ class VTKConfig:
This is very similar to the Plotly and PyVista setup.