settings_manager module

core.settings_manager.CONFIG_VERSION = 3

The current configuration version. Used for migration.

core.settings_manager.DEFAULT_SETTINGS = {'auto_save_enabled': True, 'auto_save_interval_seconds': 300, 'default_cols': 25, 'default_rows': 25, 'grid_size': 50, 'grid_type': 'square', 'last_profile_used': None, 'multiplayer_default_port': 8765, 'multiplayer_last_host': '', 'multiplayer_player_name': '', 'recent_files': [], 'show_tutorial': True, 'theme': 'dark_teal.xml'}

Default settings for the application.

class core.settings_manager.SettingsManager(path='config/settings.json')

Bases: object

Manages application settings, including loading, saving, and migrating configuration files.

Parameters:

path (str) – Path to the settings JSON file.

get(key, default=None)

Get a setting value.

Parameters:
  • key (str) – The setting key.

  • default (Any) – The default value if the key is not found.

Returns:

The value of the setting or default.

save_settings()

Save the current settings to the configuration file.

set(key, value)

Set a setting value and save the configuration.

Parameters:
  • key (str) – The setting key.

  • value (Any) – The value to set.