# `Configuration`

class mnemosyne.libmnemosyne.configuration.Configuration(component_manager)
  activate()

    Initialisation code called when the component is about to do actual work, and which can’t happen in the constructor, e.g. because components on which it relies have not yet been registered.

  card_type_properties = ['background_colour', 'alignment', 'hide_pronunciation_field', 'language_id', 'sublanguage_id', 'foreign_fact_key', 'translation_language_id', 'font', 'font_colour']
  card_type_properties_for_fact_key = ['font', 'font_colour']
  card_type_properties_generic = ['background_colour', 'alignment', 'hide_pronunciation_field', 'language_id', 'sublanguage_id', 'foreign_fact_key', 'translation_language_id']
  card_type_property(property_name, card_type, fact_key=None, default=None)
  change_user_id(new_user_id)

    When a client syncs for the first time with a server, we need to set the client’s user_id identical to the one of the server, in order for the uploaded anonymous logs to be consistent.

  clone_card_type_properties(old_card_type, new_card_type)
  component_type = 'config'
  default_language()

    use the OS language settings and if possible return with the language code like ‘en’, ‘de’, ‘it’, etc. If we don’t have a translation for the default OS language return with the default ‘en’

  delete_card_type_properties(card_type)
  determine_dirs()
  fill_dirs()

    Fill data_dir and config_dir. Do this even if they already exist, because we might have added new files since the last version.

  load()
  load_user_config()
  machine_id()
  save()
  set_card_type_property(property_name, property_value, card_type, fact_key=None)

    Set a property (like font, colour, ..) for a certain card type. If fact_key is None, then this will be applied to all fact keys.

    This info is not stored in the database, but in the configuration, to allow different clients to have different settings, even though they exchange data during sync.

  set_defaults()

    Fill the config with default values. Is called after every load, since a new version of Mnemosyne might have introduced new keys.