update: fixed gui graphical bug on main page
This commit is contained in:
parent
626cd34940
commit
33409d2a6e
1 changed files with 19 additions and 8 deletions
|
|
@ -1554,6 +1554,19 @@ class MenuPage(Page):
|
||||||
for profile_name, profile_value in self.profiles_data.items():
|
for profile_name, profile_value in self.profiles_data.items():
|
||||||
self.create_profile_widget(profile_name, profile_value)
|
self.create_profile_widget(profile_name, profile_value)
|
||||||
self.update_scroll_widget_size()
|
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):
|
def update_scroll_widget_size(self):
|
||||||
if self.number_of_profiles == 0:
|
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):
|
def on_finished_update_gui(self, is_enabled, profile_id, profile_type, profile_connection):
|
||||||
try:
|
try:
|
||||||
if is_enabled:
|
if is_enabled:
|
||||||
|
print(f"Adding connected profile: {profile_id}")
|
||||||
self.connection_manager.add_connected_profile(profile_id)
|
self.connection_manager.add_connected_profile(profile_id)
|
||||||
target_button: QPushButton = self.connection_manager.get_profile_button_objects(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():
|
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}")
|
self.print_profile_details(f"Profile_{profile_id}")
|
||||||
else:
|
else:
|
||||||
|
print(f"Removing connected profile: {profile_id}")
|
||||||
self.connection_manager.remove_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 profile_type == 1:
|
||||||
if target_button:
|
|
||||||
target_button.setIcon(QIcon(self.not_connected_profile))
|
|
||||||
if profile_id in self.button_states:
|
if profile_id in self.button_states:
|
||||||
|
print('deleting button state')
|
||||||
del self.button_states[profile_id]
|
del self.button_states[profile_id]
|
||||||
else:
|
else:
|
||||||
self.IsSystem -= 1
|
self.IsSystem -= 1
|
||||||
if target_button:
|
|
||||||
target_button.setIcon(QIcon(self.not_connected_profile))
|
|
||||||
if profile_id in self.button_states:
|
if profile_id in self.button_states:
|
||||||
del self.button_states[profile_id]
|
del self.button_states[profile_id]
|
||||||
if self.IsSystem == 0:
|
if self.IsSystem == 0:
|
||||||
self.update_status.update_image()
|
self.update_status.update_image()
|
||||||
|
|
||||||
if target_button:
|
|
||||||
self.show_disconnect_button(False, profile_type, target_button)
|
|
||||||
self.boton_edit.setEnabled(True)
|
self.boton_edit.setEnabled(True)
|
||||||
|
|
||||||
|
self.refresh_menu_buttons()
|
||||||
|
|
||||||
if profile_id == self.reverse_id:
|
if profile_id == self.reverse_id:
|
||||||
self.print_profile_details(f"Profile_{profile_id}")
|
self.print_profile_details(f"Profile_{profile_id}")
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue