From 475dfb70edcc7bfa0e3b37bc08037829191ed560 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 13 Jan 2026 10:19:37 -0500 Subject: [PATCH] Attempt to fix bug that causes settings to reinitialize when a change is made. This is a sneaky one, so can't be sure, but hopefully. --- src/cthulhu/acss.py | 19 +++++++++++++------ src/cthulhu/settings_manager.py | 5 +++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cthulhu/acss.py b/src/cthulhu/acss.py index 1fb62b3..f70ec16 100644 --- a/src/cthulhu/acss.py +++ b/src/cthulhu/acss.py @@ -88,12 +88,19 @@ class ACSS(dict): def __eq__(self, other): if not isinstance(other, ACSS): return False - if self.get(ACSS.FAMILY) != other.get(ACSS.FAMILY): - return False - if self.get(ACSS.RATE) != other.get(ACSS.RATE): - return False - if self.get(ACSS.AVERAGE_PITCH) != other.get(ACSS.AVERAGE_PITCH): - return False + compareKeys = ( + ACSS.FAMILY, + ACSS.RATE, + ACSS.AVERAGE_PITCH, + ACSS.GAIN, + ACSS.PITCH_RANGE, + ACSS.STRESS, + ACSS.RICHNESS, + ACSS.PUNCTUATIONS, + ) + for key in compareKeys: + if self.get(key) != other.get(key): + return False return True def __setitem__ (self, key, value): diff --git a/src/cthulhu/settings_manager.py b/src/cthulhu/settings_manager.py index eefb2d5..7c368ab 100644 --- a/src/cthulhu/settings_manager.py +++ b/src/cthulhu/settings_manager.py @@ -32,6 +32,7 @@ __date__ = "$Date$" __copyright__ = "Copyright (c) 2010 Consorcio Fernando de los Rios." __license__ = "LGPL" +import copy import importlib import os from gi.repository import Gio, GLib @@ -232,6 +233,10 @@ class SettingsManager(object): value = getattr(settings, key) except Exception: pass + try: + value = copy.deepcopy(value) + except Exception: + pass self.defaultGeneral[key] = value def _getCustomizedSettings(self):