diff --git a/hnn_core/gui/_viz_manager.py b/hnn_core/gui/_viz_manager.py index 5821ad22e8..869e4d3e5b 100644 --- a/hnn_core/gui/_viz_manager.py +++ b/hnn_core/gui/_viz_manager.py @@ -117,17 +117,25 @@ def unlink_relink(attribute): def _unlink_relink(f): @wraps(f) def wrapper(self, *args, **kwargs): - # Unlink the widgets using the provided link object - link_attribute: link = getattr(self, attribute) - link_attribute.unlink() - # Call the original function - result = f(self, *args, **kwargs) + # For development purposes only + # Remove after gui development + try: + # Unlink the widgets using the provided link object + link_attribute: link = getattr(self, attribute) + link_attribute.unlink() - # Re-link the widgets - link_attribute.link() + # Call the original function + result = f(self, *args, **kwargs) + + # Re-link the widgets + link_attribute.link() + + return result + except Exception as e: + # Handle the exception and print it + print(f"An error occurred: {e}") - return result return wrapper return _unlink_relink @@ -884,4 +892,4 @@ def _simulate_edit_figure(self, fig_name, ax_name, simulation_name, if operation == "plot": buttons.children[0].click() elif operation == "clear": - buttons.children[1].click() + buttons.children[1].click() \ No newline at end of file