Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/gui mode #430

Merged
merged 16 commits into from
May 30, 2022
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/ansys/fluent/core/launcher/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def launch_fluent(
ip: str = None,
port: int = None,
cleanup_on_exit: bool = True,
show_gui: bool = None,
) -> Session:
"""Start Fluent locally in server mode or connect to a running Fluent
server instance.
Expand Down Expand Up @@ -183,6 +184,15 @@ def launch_fluent(
PyFluent is exited or exit() is called on the session instance,
by default True.

show_gui : bool, optional
When True, the Fluent GUI will be displayed as long as start_instance
is also True, which can also be set by the environment
variable PYFLUENT_SHOW_SERVER_GUI=<0 or 1>``. The show-gui argument has
the effect of overriding the PYFLUENT_SHOW_SERVER_GUI variable. E.g., if
PYFLUENT_SHOW_SERVER_GUI is set to 1, the gui is hidden if show-gui is
set to False. The default is None so that explicit False settings can
be detected.

Returns
-------
ansys.fluent.session.Session
Expand All @@ -200,7 +210,9 @@ def launch_fluent(
launch_string += f" {additional_arguments}"
launch_string += f' -sifile="{server_info_filepath}"'
launch_string += " -nm"
if not os.getenv("PYFLUENT_SHOW_SERVER_GUI"):
if (show_gui is False) or (
show_gui is None and (os.getenv("PYFLUENT_SHOW_SERVER_GUI") != "1")
):
launch_string += " -hidden"
LOG.info("Launching Fluent with cmd: %s", launch_string)
sifile_last_mtime = Path(server_info_filepath).stat().st_mtime
Expand Down