CardTypeConverter
¶
- class mnemosyne.libmnemosyne.card_type_converter.CardTypeConverter(component_manager, **kwds)¶
Converts a set of sister cards to a new card type.
used_for = CardTypeConverter.card_type_converter_key (old_type class, new_type class)
Note that the function of this class is NOT to edit the fact data behind the cards, which is trivial and handled in the main controller, but rather to delete, create or convert cards to make the transition to the new card type.
‘correspondence’ {old_fact_key: new_fact_key} is the dictionary which relates fact keys in the two card types, in order to determine in which way cards should be created or deleted.
We return ‘new_cards’, ‘edited_cards’, ‘deleted_cards’ in order to be able to handle them in the database storage.
- card_type_converter_key(new_card_type)¶
Creates a single key to store a card type converter in the component_manager.
- component_type = 'card_type_converter'¶
- convert(cards, old_card_type, new_card_type, correspondence)¶