Skip to content

Navigation

morphui.uix.dataview.navigation

MorphDataViewNavigationButton(**kwargs)

Bases: MorphSimpleIconButton

A button used in the data view navigation component.

page_offset = NumericProperty(0) class-attribute instance-attribute

The page offset to apply when this button is pressed.

This property determines how many pages to move forward or backward in the data view when the button is activated. Positive values move forward, while negative values move backward. - A value of 0 indicates no movement. - A value of float('inf') indicates moving to the last page. - A value of -float('inf') indicates moving to the first page.

:attr:page_offset is a :class:~kivy.properties.NumericProperty and defaults to 0.

MorphDataViewNavigationPageLabel(**kwargs)

Bases: MorphSimpleLabel

A label used in the data view navigation component.

Initialize the page label with default configuration.

current_page = NumericProperty(0) class-attribute instance-attribute

The current page number displayed by the label.

:attr:current_page is a :class:~kivy.properties.NumericProperty and defaults to 0.

total_pages = NumericProperty(0) class-attribute instance-attribute

The total number of pages displayed by the label.

:attr:total_pages is a :class:~kivy.properties.NumericProperty and defaults to 0.

format_string = AliasProperty(lambda self: f'{self.current_page} / {self.total_pages}', None, bind=['current_page', 'total_pages']) class-attribute instance-attribute

The formatted string displaying the current and total pages.

This property generates a string in the format "current_page / total_pages" to represent the pagination status.

:attr:format_string is an :class:~kivy.properties.AliasProperty and is bound to changes in current_page and total_pages.

default_config = dict(theme_color_bindings=(dict(normal_content_color='content_surface_color')), typography_role='Label', typography_size='medium', typography_weight='Regular', pos_hint={'center_y': 0.5}, halign='left', valign='center', auto_size=True, padding=[dp(2), dp(0)]) class-attribute instance-attribute

Default configuration for the MorphDataViewNavigationPageLabel.

MorphDataViewNavigation(**kwargs)

Bases: MorphBoxLayout

A navigation component for data views.

This widget provides controls for navigating through pages of data, including buttons to go to the first, previous, next, and last pages. It also includes a label to display the current page and total number of pages, as well as a button to toggle between repository data and metadata.

Initialize the navigation component.

current_page = NumericProperty(0) class-attribute instance-attribute

The current page number in the navigation.

This property tracks the current page being viewed in the data view.

:attr:current_page is a :class:~kivy.properties.NumericProperty and defaults to 0.

total_pages = NumericProperty(0) class-attribute instance-attribute

The total number of pages available in the data view.

This property indicates the total number of pages that can be navigated through in the data view.

:attr:total_pages is a :class:~kivy.properties.NumericProperty and defaults to 0.

default_config = dict(orientation='horizontal', size_hint=(1, None), auto_size=(False, True), spacing=(dp(0)), padding=(dp(0)), theme_color_bindings={'normal_surface_color': 'transparent_color'}) class-attribute instance-attribute

Default configuration for the MorphDataViewNavigation.

navigate_by_offset(offset)

Navigate to a page by applying an offset to the current page.

This method updates the current_page property based on the provided offset value. It ensures that the new page number remains within valid bounds (0 to total_pages - 1).

PARAMETER DESCRIPTION
offset

The page offset to apply. Positive values move forward, negative values move backward. Special values float('inf') and -float('inf') navigate to the last and first pages, respectively.

TYPE: float

on_total_pages(instance, total_pages)

Event handler called when the total number of pages changes.

This method ensures that the current_page remains valid when the total_pages property is updated.