Skip to content

Commit

Permalink
add UI return, then visualize() can return now (#1466)
Browse files Browse the repository at this point in the history
* add UI return, then user can use fv = m.fs.visualize(), then call the save_diagram etc.

* add string description for return type here, return type defined in UI code, this way has no need to up date PSE when want to update return items in UI

* Update idaes/core/base/flowsheet_model.py

update return to snake_case

Co-authored-by: Ludovico Bianchi <[email protected]>

* Use Sphinx way to generate a clickable reference for Sphinx doc for this module

Co-authored-by: Ludovico Bianchi <[email protected]>

* Fix Sphinx interpretation issue by removing incorrect `visualize_result:` prefix. This prevents Sphinx from incorrectly adding an extra "Return type" field in the documentation.

Co-authored-by: Ludovico Bianchi <[email protected]>

---------

Co-authored-by: Ludovico Bianchi <[email protected]>
  • Loading branch information
CopyDemon and lbianchi-lbl authored Aug 28, 2024
1 parent 2b41748 commit 2a587ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions idaes/core/base/flowsheet_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def stream_table(self, true_state=False, time_point=0, orient="columns"):
dict_arcs, time_point=time_point, orient=orient, true_state=true_state
)

def visualize(self, model_name, **kwargs):
def visualize(self, model_name, **kwargs) -> "VisualizeResult":
"""
Starts up a flask server that serializes the model and pops up a
webpage with the visualization
Expand All @@ -275,9 +275,10 @@ def visualize(self, model_name, **kwargs):
**kwargs: Additional keywords for :func:`idaes.core.ui.fv.visualize()`
Returns:
None
The :class:`idaes_ui.fv.fsvis.VisualizeResult` instance returned by :meth:`UI.visualize`
"""
UI().visualize(self, model_name, **kwargs)
visualize_result = UI().visualize(self, model_name, **kwargs)
return visualize_result

def _get_stream_table_contents(self, time_point=0):
"""
Expand Down

0 comments on commit 2a587ab

Please sign in to comment.