Add menu audio controls and menu music
This commit is contained in:
@@ -72,6 +72,32 @@ class UserProfileIntegration:
|
||||
if self.current_profile and 'settings' in self.current_profile:
|
||||
return self.current_profile['settings'].get(setting_name, default_value)
|
||||
return default_value
|
||||
|
||||
def set_setting(self, setting_name, value):
|
||||
"""Persist a setting on the active local profile."""
|
||||
if not self.current_profile:
|
||||
return False
|
||||
|
||||
try:
|
||||
with self.profiles_file.open('r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
profile_name = self.current_profile['name']
|
||||
if profile_name not in data.get('profiles', {}):
|
||||
return False
|
||||
|
||||
profile = data['profiles'][profile_name]
|
||||
profile.setdefault('settings', {})
|
||||
profile['settings'][setting_name] = value
|
||||
self.current_profile = profile
|
||||
|
||||
with self.profiles_file.open('w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error updating setting {setting_name}: {e}")
|
||||
return False
|
||||
|
||||
def register_new_user(self, user_id):
|
||||
"""Registration is handled locally via the profile manager."""
|
||||
|
||||
Reference in New Issue
Block a user