Improve profile modification-related logic

This commit is contained in:
codeking 2024-09-23 22:50:53 +02:00
parent 44451e0f0f
commit e422c3202c
2 changed files with 9 additions and 0 deletions

View file

@ -33,6 +33,14 @@ class ProfileController:
if profile_observer is not None:
profile_observer.notify('created', profile)
@staticmethod
def update(profile: Union[SessionProfile, SystemProfile], profile_observer: ProfileObserver = None):
Profile.save(profile)
if profile_observer is not None:
profile_observer.notify('updated', profile)
@staticmethod
def enable(profile: Union[SessionProfile, SystemProfile], force: bool = False, pristine: bool = False, profile_observer: ProfileObserver = None, application_version_observer: ApplicationVersionObserver = None, connection_observer: ConnectionObserver = None):

View file

@ -6,6 +6,7 @@ class ProfileObserver(BaseObserver):
def __init__(self):
self.on_created = []
self.on_updated = []
self.on_destroyed = []
self.on_disabled = []
self.on_enabled = []