update: fixed gui graphical bug on main page

This commit is contained in:
Your Name 2025-12-14 00:43:32 +01:00
parent 626cd34940
commit 33409d2a6e

View file

@ -1555,6 +1555,19 @@ class MenuPage(Page):
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:
return
@ -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: