Encyclopaedia¶
-
class encyclopaedia.Encyclopaedia(sorting_mode: SortMode =
SortMode.NUMBER
, show_locked_buttons: bool =False
, show_locked_entry: bool =False
, list_screen: str ='encyclopaedia_list'
, entry_screen: str ='encyclopaedia_entry'
, hyperlink_screen: str ='encyclopaedia_list'
, name: str =''
)[source]¶ Bases:
EventEmitter
,object
Container to manage the behaviour of a collection of EncEntry objects.
- Parameters:¶
- sorting_mode: SortMode =
SortMode.NUMBER
¶ How entries are sorted. Default is SortMode.NUMBER.
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.
- hyperlink_screen: str =
'encyclopaedia_list'
¶ The Ren’Py screen to display an entry opened from a hyperlink.
- name: str =
''
¶ A optional name for the Encyclopaedia.
- sorting_mode: SortMode =
- all_entries¶
All entries, regardless of status.
- unlocked_entries¶
Only unlocked entries.
- filtered_entries¶
Entries that match a subject filter.
- filtering¶
The subject name 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, reverse: bool =
False
) SortEncyclopaedia [source]¶ Wrapper around the Action of the same name.
Use with a renpy button.
- 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: Book | 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.
- property current_entries : list[Book | 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 : Book | EncEntry¶
Get the entry at current_position.
If show locked entries, pull from all_entries. Else, pull from unlocked_entries.
- Returns:¶
EncEntry
- property percentage_unlocked : float¶
Get the percentage of the Encyclopaedia that’s unlocked.
- property reverse_sorting : bool¶
Get the direction of the current sorting.
- Returns:¶
True if sorting is reversed, else False.
-
sort(mode: SortMode | None =
None
, reverse: bool =False
) None [source]¶ Sort the entries in the Encyclopaedia.
The attribute sorting_mode will be set to the value of mode.
- property sorting_mode : SortMode¶
Get the current sorting mode of the Encyclopaedia.