Database

The app uses pony to manage a sqlite-database. The database is structured as follows.

_images/ponyorm_diagram.png
class acg.db.CD(new_path)[source]

Context manager for changing the current working directory to new_path.

class acg.db.Card[source]

Bases: db.Entity

Object containing the data for a card.

add_media(self, **kwargs)[source]

Add a new MediaFile to this card.

get_media(self, field_key)[source]

Get MediaFile of this card by field_key which is unique.

write_media_files_to_folder(self, folder)[source]

Write media-files in media_files to folder with name folder.

class acg.db.MediaFile[source]

Bases: db.Entity

Class containing a media-file.

card[source]

Relation to Card object.

content[source]

Bytes object with media-file.

field_key[source]

Name of the field of the card which the content belongs to.

id[source]

Unique id.

type[source]

File type, e.g. “mp3”, “jpg”, “png”, etc. …

update(self, **kwargs)[source]

Update attributes by *kwargs.

class acg.db.Template[source]

Bases: db.Entity

Contains data of a fields.Template and all cards that have been generated with the template.

add_card(self, name)[source]

Create a new Card with relation to this template.

additional_info[source]

Additional info.

cards[source]

References to all the cards that have been generated using this template.

description[source]

A short description of the template.

get_card(self, name)[source]

Get a single Card by name. (unique attribute).

get_cards_by_selector(self, selector)[source]

Get cards by selector.

id[source]

Id.

name[source]

A unique name for the template.

classmethod names(cls)[source]

Return list of all Templates in database.

acg.db.update_word_state_dict(word, state)[source]

Set state in app.word_state_dict.