polyfoammesh.gui.settings_migration

Version-aware QSettings with schema validation and migration.

Ensures that persisted settings survive across app versions and that corrupted or stale values are caught before they reach widgets.

Usage:

from polyfoammesh.gui.settings_migration import AppSettings
s = AppSettings()
s.set_value("params/max_cell", 0.05)
val = s.get_value("params/max_cell", default=0.05)

Classes

AppSettings()

Wrapper around QSettings with schema validation and migration.

class polyfoammesh.gui.settings_migration.AppSettings[source]

Bases: object

Wrapper around QSettings with schema validation and migration.

Usage is identical to QSettings:

s = AppSettings()
s.set_value("params/max_cell", 0.05)
val = s.get_value("params/max_cell", default=0.05)
get_value(key, default=None)[source]

Read a value, returning default if missing or corrupt.

Return type:

Any

Parameters:
set_value(key, value)[source]

Write a value after validation, or log a warning on failure.

Return type:

None

Parameters:
sync()[source]

Flush to disk immediately. Call from closeEvent.

Return type:

None

remove(key)[source]
Return type:

None

Parameters:

key (str)

contains(key)[source]
Return type:

bool

Parameters:

key (str)

all_keys()[source]
Return type:

list[str]

property raw: QSettings
purge_stale_keys()[source]

Remove keys that are no longer in the schema. Returns count.

Return type:

int