EncEntry

class encyclopaedia.EncEntry(parent: Encyclopaedia | EncEntry | None = None, number: int | None = None, name: str = '', text: str | list[str] = '', subject: str = '', viewed: bool = False, viewed_persistent: bool | None = False, locked: bool = False, locked_persistent: bool | None = False, image: str | None = None, locked_name: str = '???', locked_text: str = '???', locked_image: str | None = None, locked_image_tint: tuple[float, float, float] = (0.0, 0.0, 0.0))[source]

Bases: EventEmitter, object

Store an Entry’s content.

EncEntry instances should be added to an Encyclopaedia or another EncEntry.

Parameters:
parent: Encyclopaedia | EncEntry | None = None

The parent container for the EncEntry.

number: int | None = None

The entry’s number. If this is not set then it will be given a number automatically.

name: str = ''

Title, normally used for buttons and headings.

text: str | list[str] = ''

The text that will be displayed when the entry is viewed.

subject: str = ''

The subject to associate the entry with. Used for sorting and filtering.

viewed: bool = False

Set the viewed status of the EncEntry. Default is False. Only use if the Encyclopaedia is save-game independent.

viewed_persistent: bool | None = False

Use persistent data for recording viewed status.

locked: bool = False

Set the locked status of the EncEntry. Default is False.

locked_persistent: bool | None = False

Use persistent data for recording locked status.

image: str | None = None

The image displayed with the Entry text. Default is None.

locked_name: str = '???'

Placeholder text for the name. Shown when the entry is locked.

locked_text: str = '???'

Placeholder text for the text. Shown when the entry is locked.

locked_image: str | None = None

Placeholder image for the image. Shown when the entry is locked.

locked_image_tint: tuple[float, float, float] = (0.0, 0.0, 0.0)

If no specific locked image is provided, a tinted version of the image will be used. The amount of tinting can be set with RGB values in a tuple.

has_image

True if an image was provided, else False.

pages

List of all the pages this entry contains.

has_pages

If an entry has any sub-entries.

add_entry(entry: EncEntry) bool[source]

Add multiple pages to the entry in the form of sub-entries.

Parameters:
entry: EncEntry

The entry to add as a sub-entry.

Returns:

True if anything was added, else False.

Raises:
  • AttributeError – If the entry is already the page of another entry.

  • ValueError – If the entry has a number that is already taken.

add_entry_to_unlocked_entries(entry: EncEntry) None[source]

Add an entry to the list of unlocked entries.

Parameters:
entry: EncEntry

The Entry to add to the unlocked entries list.

property current_page : EncEntry

Get the sub-page that’s currently viewing viewed.

Setting this attribute should be done using an integer.

property image : str

The image for the entry. Return placeholder when entry is locked.

property label : str

name’.

Type:

The number and name of the entry, in the format of ‘number

property locked : bool

Determine if the entry’s data can be viewed or not.

Changing this variable will modify the entry’s locked status.

property name : str

The name for the entry. Return placeholder when entry is locked.

next_page() bool[source]

Set the next sub-entry page as the current page.

previous_page() bool[source]

Set the previous sub-entry page as the current page.

property text : list[str]

The text for the entry. Return placeholder when entry is locked.

property viewed : bool

Determine if the entry has been viewed or not.

Changing this variable will modify the entry’s viewed status.

property word_count : int

Get the word count for the EncEntry’s text.

Returns:

The number of words in the EncEntry.