Encyclopaedia

class encyclopaedia.Encyclopaedia(sorting_mode: int = 0, show_locked_buttons: bool = False, show_locked_entry: bool = False, list_screen: str = 'encyclopaedia_list', entry_screen: str = 'encyclopaedia_entry', name: str = '')[source]

Bases: EventEmitter, object

Container that manages the behaviour of a collection of EncEntry objects.

Parameters:
sorting_mode: int = 0

The default for how entries are sorted. Default sorting is by Number.

show_locked_buttons: bool = False

If True, locked entries show a placeholder label on the listing screen.

show_locked_entry: bool = False

If True, locked entries can be viewed, but the data is hidden from view with a placeholder.

list_screen: str = 'encyclopaedia_list'

The Ren’Py screen to display the list of entries.

entry_screen: str = 'encyclopaedia_entry'

The Ren’Py screen to display an open entry.

name: str = ''

A optional name for the Encyclopaedia.

all_entries

All entries, regardless of status.

unlocked_entries

Only unlocked entries.

filtered_entries

Entries that match a subject filter.

filtering

The subject that’s being used as a filter.

size_all

Length of self.all_entries.

size_unlocked

Length of self.unlocked_entries.

reverse_sorting

Should sorting occur in reverse or not.

nest_alphabetical_sort

Should alphabetical sorting display each letter as a subject.

current_position

Index for the current entry open.

subjects

Collection of every subject.

active

The currently open entry.

locked_at_bottom

True if locked entries should appear at the bottom of the entry list or not.

ClearFilter() ClearFilter[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

CloseActiveEntry() CloseActiveEntry[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

FilterBySubject(subject: str) FilterBySubject[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

NextEntry() NextEntry[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

NextPage() NextPage[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

PreviousEntry() PreviousEntry[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

PreviousPage() PreviousPage[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

ResetSubPage() ResetSubPage[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

SetEntry(given_entry: EncEntry) SetEntry[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

Sort(sorting_mode: SortMode) SortEncyclopaedia[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Parameters:
sorting_mode: SortMode

The type of sorting to use. If None specified, use the current sorting.

Returns:

Screen Action

ToggleShowLockedButtons() ToggleShowLockedButtonsAction[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

ToggleShowLockedEntry() ToggleShowLockedEntryAction[source]

Wrapper around the Action of the same name.

Use with a renpy button.

Returns:

Screen Action

add_entry(entry: EncEntry) None[source]

Add an entry to the Encyclopaedia’s internal lists and sorts it.

Attempts to create duplicates are softly ignored. subjects list is updated when a new entry is added.

Parameters:
entry: EncEntry

The Entry to add to the Encyclopaedia

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_entries : list[EncEntry]

Get all the entries which should be visible to the user.

Returns:

List of EncEntries. If filtering, only entries that match the filter are returned.

property current_entry : EncEntry

Get the entry at current_position.

If show locked entries, pull from all_entries. Else, pull from unlocked_entries.

Returns:

EncEntry

next_entry() bool[source]

Set the next entry as the current entry.

property percentage_unlocked : float

Get the percentage of the Encyclopaedia that’s unlocked.

Returns:

Percentage of the Encyclopaedia that’s unlocked

Return type:

float

Raises:

ZeroDivisionError – If the Encyclopaedia is empty

previous_entry() bool[source]

Set the previous entry as the current entry.

sort_entries(entries: list[EncEntry], sorting: int = 0, reverse: bool = False) None[source]

Sort entry lists by whatever the current sorting mode is.

Parameters:
entries: list[EncEntry]

The EncEntry list to sort

sorting: int = 0

The sorting mode to use

reverse: bool = False

If the sorting should be done in reverse or not

property word_count : int

Get the total word count for the Encyclopaedia.

Returns:

The number of words in every EncEntry in the Encyclopaedia.