update: fixed error on profile enable
This commit is contained in:
parent
f478505f68
commit
fc944b0cb5
1 changed files with 20 additions and 15 deletions
|
|
@ -2257,18 +2257,21 @@ class MenuPage(Page):
|
||||||
try:
|
try:
|
||||||
if is_enabled:
|
if is_enabled:
|
||||||
self.connection_manager.add_connected_profile(profile_id)
|
self.connection_manager.add_connected_profile(profile_id)
|
||||||
if profile_type == 1:
|
|
||||||
target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id)
|
target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id)
|
||||||
|
|
||||||
|
if profile_type == 1:
|
||||||
|
if target_button:
|
||||||
icon_path = self.connected_tor_profile if profile_connection == 'tor' else self.connected_profile
|
icon_path = self.connected_tor_profile if profile_connection == 'tor' else self.connected_profile
|
||||||
target_button.setIcon(QIcon(icon_path))
|
target_button.setIcon(QIcon(icon_path))
|
||||||
self.button_states[profile_id] = icon_path
|
self.button_states[profile_id] = icon_path
|
||||||
else:
|
else:
|
||||||
target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id)
|
if target_button:
|
||||||
target_button.setIcon(QIcon(self.system_wide_connected_profile))
|
target_button.setIcon(QIcon(self.system_wide_connected_profile))
|
||||||
self.update_status.update_image(appearance_value='background_connected')
|
self.update_status.update_image(appearance_value='background_connected')
|
||||||
self.button_states[profile_id] = self.system_wide_connected_profile
|
self.button_states[profile_id] = self.system_wide_connected_profile
|
||||||
self.IsSystem += 1
|
self.IsSystem += 1
|
||||||
|
|
||||||
|
if target_button:
|
||||||
self.show_disconnect_button(True, profile_type, target_button)
|
self.show_disconnect_button(True, profile_type, target_button)
|
||||||
self.boton_edit.setEnabled(False)
|
self.boton_edit.setEnabled(False)
|
||||||
|
|
||||||
|
|
@ -2278,21 +2281,23 @@ class MenuPage(Page):
|
||||||
self.print_profile_details(f"Profile_{profile_id}")
|
self.print_profile_details(f"Profile_{profile_id}")
|
||||||
else:
|
else:
|
||||||
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)
|
||||||
|
|
||||||
if profile_type == 1:
|
if profile_type == 1:
|
||||||
target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id)
|
if target_button:
|
||||||
target_button.setIcon(QIcon(self.not_connected_profile))
|
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]
|
||||||
else:
|
else:
|
||||||
self.IsSystem -= 1
|
self.IsSystem -= 1
|
||||||
target_button: QPushButton = self.connection_manager.get_profile_button_objects(profile_id)
|
if target_button:
|
||||||
target_button.setIcon(QIcon(self.not_connected_profile))
|
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.show_disconnect_button(False, profile_type, target_button)
|
||||||
self.boton_edit.setEnabled(True)
|
self.boton_edit.setEnabled(True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue