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

fix: Hiding switch-to-meshing-mode command from tui and settings #3381

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions src/ansys/fluent/core/services/datamodel_tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ def __dir__(self) -> list[str]:
for x in PyMenu(
self._service, self._version, self._mode, self._path
).get_child_names()
if x != "exit"
if x not in ["exit", "switch_to_meshing_mode"]
]

def __getattribute__(self, name) -> Any:
if name == "exit" and not self._path:
if name in ["exit", "switch_to_meshing_mode"] and not self._path:
raise AttributeError(
f"'{self.__class__.__name__}' object has no attribute 'exit'"
f"'{self.__class__.__name__}' object has no attribute '{name}'"
)
try:
attr = super().__getattribute__(name)
Expand Down
1 change: 1 addition & 0 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,7 @@ def _process_cls_names(info_dict, names, write_doc=False):
commands = info.get("commands")
if commands:
commands.pop("exit", None)
commands.pop("switch-to-meshing-mode", None)
if commands and not user_creatable:
commands.pop("create", None)
if commands:
Expand Down
10 changes: 5 additions & 5 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,10 @@ def test_child_alias_with_parent_path(mixing_elbow_settings_session):


@pytest.mark.fluent_version(">=25.1")
def test_exit_not_in_settings(new_solver_session):
def test_commands_not_in_settings(new_solver_session):
solver = new_solver_session

assert "exit" not in dir(solver.settings)

with pytest.raises(AttributeError):
solver.settings.exit()
for command in ["exit", "switch_to_meshing_mode"]:
assert command not in dir(solver.settings)
with pytest.raises(AttributeError):
getattr(solver.settings, command)
10 changes: 5 additions & 5 deletions tests/test_tui_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def test_exit_not_in_meshing_tui(new_meshing_session):
meshing.tui.exit()


def test_exit_not_in_solver_tui(new_solver_session):
def test_commands_not_in_solver_tui(new_solver_session):
solver = new_solver_session

assert "exit" not in dir(solver.tui)

with pytest.raises(AttributeError):
solver.tui.exit()
for command in ["exit", "switch_to_meshing_mode"]:
assert command not in dir(solver.tui)
with pytest.raises(AttributeError):
getattr(solver.tui, command)
Loading