From 33409d2a6e54063ef0a81f4a7aa90590ca140793 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 14 Dec 2025 00:43:32 +0100 Subject: [PATCH] update: fixed gui graphical bug on main page --- gui/__main__.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gui/__main__.py b/gui/__main__.py index d2aff1b..27688c0 100755 --- a/gui/__main__.py +++ b/gui/__main__.py @@ -1554,6 +1554,19 @@ class MenuPage(Page): for profile_name, profile_value in self.profiles_data.items(): self.create_profile_widget(profile_name, profile_value) self.update_scroll_widget_size() + + def refresh_menu_buttons(self): + for widget in self.scroll_widget.findChildren(QLabel): + widget.setParent(None) + + for widget in self.scroll_widget.findChildren(QPushButton): + widget.setParent(None) + + self.profile_button_map.clear() + self.button_group = QButtonGroup(self) + self.buttons = [] + + self.create() def update_scroll_widget_size(self): if self.number_of_profiles == 0: @@ -2296,6 +2309,7 @@ class MenuPage(Page): def on_finished_update_gui(self, is_enabled, profile_id, profile_type, profile_connection): try: if is_enabled: + print(f"Adding connected profile: {profile_id}") self.connection_manager.add_connected_profile(profile_id) target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id) @@ -2320,27 +2334,24 @@ class MenuPage(Page): if profile_obj and profile_obj.connection and profile_obj.connection.code == 'wireguard' and ConfigurationController.get_endpoint_verification_enabled(): self.print_profile_details(f"Profile_{profile_id}") else: + print(f"Removing connected profile: {profile_id}") self.connection_manager.remove_connected_profile(profile_id) - target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id) - + print('profile_type: ', profile_type) if profile_type == 1: - if target_button: - target_button.setIcon(QIcon(self.not_connected_profile)) if profile_id in self.button_states: + print('deleting button state') del self.button_states[profile_id] else: self.IsSystem -= 1 - if target_button: - target_button.setIcon(QIcon(self.not_connected_profile)) if profile_id in self.button_states: del self.button_states[profile_id] if self.IsSystem == 0: self.update_status.update_image() - if target_button: - self.show_disconnect_button(False, profile_type, target_button) self.boton_edit.setEnabled(True) + self.refresh_menu_buttons() + if profile_id == self.reverse_id: self.print_profile_details(f"Profile_{profile_id}") except IndexError: