diff --git a/src/ansys/pyensight/core/renderable.py b/src/ansys/pyensight/core/renderable.py index 4585354730a..222a8ba791c 100644 --- a/src/ansys/pyensight/core/renderable.py +++ b/src/ansys/pyensight/core/renderable.py @@ -540,6 +540,20 @@ def __init__(self, *args, **kwargs) -> None: self._rendertype = "remote" self.update() + def _update_2023R2_or_less(self): + """Update the remote rendering widget and display it for + backend EnSight of version earlier than 2024R1 + """ + query_params = { + "autoconnect": "true", + "host": self._session.html_hostname, + "port": self._session.ws_port, + } + url = f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" + url += "/ansys/nexus/novnc/vnc_envision.html" + url += self._get_query_parameters_str(query_params) + self._url = url + def update(self): """Update the remote rendering widget and display it. @@ -549,29 +563,36 @@ def update(self): """ optional_query = self._get_query_parameters_str() version = _get_ansysnexus_version(self._session._cei_suffix) - html = f"\n" - rest_uri = ( - f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" - ) - ws_uri = f"{self._http_protocol}://{self._session.html_hostname}:{self._session.ws_port}" - - query_args = "" - if self._using_proxy and optional_query: - query_args = f', "extra_query_args":"{optional_query[1:]}"' - - attributes = ' renderer="envnc"' - attributes += ' ui="simple"' - attributes += ' active="true"' - attributes += ( - " renderer_options='" - + f'{{ "ws":"{ws_uri}", "http":"{rest_uri}", "security_token":"{self._session.secret_key}", "connect_to_running_ens":true {query_args} }}' - + "'" - ) + if int(self._session._cei_suffix) < 241: + self._update_2023R2_or_less() + else: + html = ( + f"\n" + ) + rest_uri = ( + f"{self._http_protocol}://{self._session.html_hostname}:{self._session.html_port}" + ) + ws_uri = ( + f"{self._http_protocol}://{self._session.html_hostname}:{self._session.ws_port}" + ) - html += f"\n" + query_args = "" + if self._using_proxy and optional_query: + query_args = f', "extra_query_args":"{optional_query[1:]}"' + + attributes = ' renderer="envnc"' + attributes += ' ui="simple"' + attributes += ' active="true"' + attributes += ( + " renderer_options='" + + f'{{ "ws":"{ws_uri}", "http":"{rest_uri}", "security_token":"{self._session.secret_key}", "connect_to_running_ens":true {query_args} }}' + + "'" + ) - # refresh the remote HTML - self._save_remote_html_page(html) + html += f"\n" + + # refresh the remote HTML + self._save_remote_html_page(html) super().update()