From d52ca4842c1dbc9559c6f65428c48f52ae2b6948 Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Fri, 17 Jul 2026 22:31:27 -0400 Subject: [PATCH] Edit Profile logic pushed to core. GUI nows passes just the profile id, key, and data. And core returns the results of the save --- gui/v2/ui/pages/editor_page.py | 47 +++++++++------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/gui/v2/ui/pages/editor_page.py b/gui/v2/ui/pages/editor_page.py index 89d7974..c5bc420 100755 --- a/gui/v2/ui/pages/editor_page.py +++ b/gui/v2/ui/pages/editor_page.py @@ -10,6 +10,8 @@ from PyQt6 import QtCore, QtGui from core.controllers.ProfileController import ProfileController from core.controllers.LocationController import LocationController +from core.models.Result import Result, ResultError +from core.controllers.profile_state.update_profile import update_profile from gui.v2.ui.pages.Page import Page from gui.v2.ui.pages.browser_page import BrowserPage @@ -795,49 +797,24 @@ class EditorPage(Page): self._prefetched_profiles = None def update_core_profiles(self, key, new_value): - profile = ProfileController.get( - int(self.update_status.current_profile_id)) - self.update_res = False - if key == 'dimentions': - profile.resolution = new_value - self.update_res = True + profile_id = int(self.update_status.current_profile_id) - elif key == 'name': - profile.name = new_value + # Sends to core directly, + result = update_profile(profile_id, key, new_value) - elif key == 'connection': - if new_value == 'tor': - profile.connection.code = new_value - profile.connection.masked = True - elif new_value == 'just proxy': - profile.connection.code = 'system' - profile.connection.masked = True - else: - self.update_status.update_status( - 'System wide profiles not supported atm') + if result.valid: + self.update_status.update_status( + f'Updated profile {profile_id}') - elif key == 'browser': - browser_type, browser_version = new_value.split(':', 1) - profile.application_version.application_code = browser_type - profile.application_version.version_number = browser_version + if key == "resolution": + self.update_res = True - elif key == 'protocol': - if self.data_profile.get('connection') == 'system-wide': + if result.data == "edit_to_session": self.edit_to_session() - else: - profile.connection.code = 'wireguard' if new_value == 'wireguard' else 'tor' - profile.connection.masked = False if new_value == 'wireguard' else True else: - location = self.connection_manager.get_location_info(new_value) + self.update_status.update_status(result.message) - if location: - profile.location.code = location.code - profile.location.country_code = location.country_code - profile.location.time_zone = location.time_zone - profile.subscription = None - - ProfileController.update(profile) def edit_to_session(self): id = int(self.update_status.current_profile_id)