Handler Object
The single object named handler
, which has multiple methods/attributes to access,
is responsible for handling some of the gallery-related functionality.
- object gallerynpy.handler
The only instance for the Handler class. A reassignment is not recommended.
- back(from_animation_options=False)
Gets the action to return to the menu since gallerynpy was called or to navigate between sliders.
- Parameters:
from_animation_options – If true, and the current slide is for animations, it means that it must return to the first valid slide of the current slider
- Returns:
The action to return or navigate.
- change_distribution(columns: int = None, rows: int = None)
Changes the distribution on each page of each slide.
- Parameters:
columns – The number of columns in the page.
rows – The number of rows in the page.
- change_slide(name: str)
Changes the current slide or slider to one with the given name (key).
- Parameters:
name – The name of the slide, or slide, to change.
- change_transition(transition)
Changes the current transition of the gallerynpy gallery.
- Parameters:
transition – The new transition.
- check_puts()
Adds all items in the base slider to the gallery if
load_in_put
is true.
- create_item(resource, thumbnail=None, song: str = None, condition: str = None, tooltip: str = None)
Creates an item with the given params.
- Parameters:
resource – The item resource
thumbnail – The item custom thumbnail resource.
song – A valid filepath for an audio that renpy can load.
condition – The condition to unlock the item.
tooltip – The tooltip text to display when the item is hovered.
- Returns:
The created item.
- Raises:
ValueError – If the given resource is None.
- create_slide(name: str, for_animation=False)
Create a slide with the given name and the base slider as its parent.
- Parameters:
name – The slide name
for_animation – Sets true if the slide will be marked as one for animations
- Returns:
The created slide
- create_slider(name: str)
Create a slider with the given name and the base slider as its parent
- Parameters:
name – The slider name
- Returns:
The created slider
- current_item_at(index: int)
Gets the item at the given index on the current slide name.
- Parameters:
index – The index where is the item.
- Returns:
The item at the given index. If the index is out of range, return None.
- current_slide_size()
Gets the size of the current slide name
- Returns:
The size of the slide
- is_current_for_animations()
Checks if the current slide is one for animations
- Returns:
True if the current slide is one for animations, False otherwise
- is_current_slide(name: str)
Checks if the given name is equal to the currently selected slide name.
- Parameters:
name – The name of the slide, or slide, to check.
- Returns:
True if the name is equal to the currently selected, False otherwise.
- item_at(where: str, index: int) Item | None
Gets the item at the given index on the slide with the given name
- Parameters:
where – The slide name in the current slider
index – The index where is the item.
- Returns:
The item at the given index. If the index is out of range or the object with the where name in the current slider not is a slide, return None
- make_current_button_at(index: int)
Creates a button to display the item at the given index of the current slide.
- Parameters:
index – The index of the item in the current slide
- Returns:
The created button. If the index is not valid, a button with none action will be returned.
- make_item_button(item: Item)
Creates a button to display the given item.
- Parameters:
item – The item to create its button.
- Returns:
The created button. If the item is not valid, a button with none action will be returned.
- next_page()
Gets the action to switch to the next page on the current slide.
- Returns:
The action to change the page, or None if the current page number is the last.
- previous_page()
Gets the action to switch to the previous page on the current slide.
- Returns:
The action to change the page, or None if the current page number is the first
- put_item(item: Item, where: str, for_animation_slide: bool = False)
Puts the given item into the gallerynpy gallery.
- Parameters:
item – The item to put
where – The name of the slide to put the item into
for_animation_slide – If true and the slide with the given name has not yet been created, the slide is marked as one for animations.
- Raises:
ValueError – If the where param is empty or None.
TypeError – If the given item is not valid.
- put_slide_like(slide: Slide | Slider)
Adds the given slide or slider to the base slider and all its items to the gallerynpy gallery.
- Parameters:
slide – The slide or slider to add
- scale_res(resource: Resource)
Scales the given resource according to the current thumbnail size.
- Parameters:
resource – The resource to scale
- slide_size(name: str)
Gets the size of the slide or slider with the given name.
- Parameters:
name – The slide name in the current slider
- Returns:
The size of the slide. If the name is not valid or not exists a slide or slider with the given name, return 0
- to_first_slide(sort: bool = False)
Changes the selected slide name to the name of the first valid slide in the current slider.
- Parameters:
sort – If true, sorts slide names before the change.
- update()
Updates the current start and end index of the current page on the current slide.
- property columns
- Getter:
Gets the maximum number of columns on each page of each slide.
- property current_slide_name
- Getter:
Gets the name of the currently selected slide.
- property current_slides
- Getter:
Gets all the names of the current slider items.
- property end
- Getter:
Gets the end index of the current page on the current slide.
- property idle_res
- Getter:
Gets the scaled idle resource of the gallerynpy gallery.
- property max_per_page
- Getter:
Gets the maximum number of items on each page of each slide.
- property page_items
- Getter:
Gets all buttons for the current page items on the current slide.
- property play_hover_res
- Getter:
Gets the scaled play_hover resource of the gallerynpy gallery.
- property play_idle_res
- Getter:
Gets the scaled play_idle resource of the gallerynpy gallery.
- property rows
- Getter:
Gets the maximum number of rows on each page of each slide.
- property start
- Getter:
Gets the starting index of the current page on the current slide.
- property tooltip
- Getter:
Gets the current tooltip.