# Path: pyDEA/core/utils/dea_utils.py
# def calculate_start_row_index(curr_page, nb_table_rows):
#     ''' Calculates row index of data that will be displayed given
#         current page and number of rows in the table.
# 
#         Note:
#             The first row of the table is reserved for displaying categories.
# 
#         Args:
#             curr_page (int): current page number. Pages start from 1.
#             nb_table_rows (int): number of rows in the table.
# 
#         Returns:
#             int: data row index
#     '''
#     if (curr_page == 0):
#         return 0
#     return (curr_page - 1) * (nb_table_rows - 1)


from tkinter import Spinbox, StringVar, N, W
from tkinter.ttk import Frame, Label, Button
from pyDEA.core.utils.dea_utils import calculate_start_row_index
            self.current_page_str.set(next_page_index)
            self.on_page_change()

    def on_page_change(self, *args):
        ''' Displays a page which number is currently stored in
            current_page_str.

            This method is called in show_next_page(), show_prev_page() and
            when the user enters data and presses Enter.
            args are supplied by Return event.
            If the entered value is invalid, then the first page is displayed.
            If the entered value is zero or negative, then the first page is
            isplayed.
            If the entered value is larger than the total number of pages,
            then the last page is displayed.
        '''
        try:
            curr_page = int(self.current_page_str.get())
        except ValueError:
            curr_page = 1
            self.current_page_str.set(curr_page)

        max_page = int(self.goto_spin.cget('to'))
        if curr_page > max_page:
            curr_page = max_page
            self.current_page_str.set(curr_page)
        if curr_page <= 0:
            curr_page = 1
            self.current_page_str.set(curr_page)
        # second -1 because row indeces start with 0

# Path: pyDEA/core/utils/dea_utils.py
# def calculate_start_row_index(curr_page, nb_table_rows):
#     ''' Calculates row index of data that will be displayed given
#         current page and number of rows in the table.
# 
#         Note:
#             The first row of the table is reserved for displaying categories.
# 
#         Args:
#             curr_page (int): current page number. Pages start from 1.
#             nb_table_rows (int): number of rows in the table.
# 
#         Returns:
#             int: data row index
#     '''
#     if (curr_page == 0):
#         return 0
#     return (curr_page - 1) * (nb_table_rows - 1)


# Path: pyDEA/core/gui_modules/navigation_frame_gui.py
from tkinter import Spinbox, StringVar, N, W
from tkinter.ttk import Frame, Label, Button
from pyDEA.core.utils.dea_utils import calculate_start_row_index

            self.current_page_str.set(next_page_index)
            self.on_page_change()

    def on_page_change(self, *args):
        ''' Displays a page which number is currently stored in
            current_page_str.

            This method is called in show_next_page(), show_prev_page() and
            when the user enters data and presses Enter.
            args are supplied by Return event.
            If the entered value is invalid, then the first page is displayed.
            If the entered value is zero or negative, then the first page is
            isplayed.
            If the entered value is larger than the total number of pages,
            then the last page is displayed.
        '''
        try:
            curr_page = int(self.current_page_str.get())
        except ValueError:
            curr_page = 1
            self.current_page_str.set(curr_page)

        max_page = int(self.goto_spin.cget('to'))
        if curr_page > max_page:
            curr_page = max_page
            self.current_page_str.set(curr_page)
        if curr_page <= 0:
            curr_page = 1
            self.current_page_str.set(curr_page)
        # second -1 because row indeces start with 0

        row_index = calculate_start_row_index(curr_page, self.table.nb_rows)