menu package

Discuss API design here.
User avatar
velocity
Senior Member
Posts: 220
Joined: Sat May 10, 2014 6:17 pm

menu package

Postby velocity » Sun Feb 26, 2017 12:31 pm

When creating a PagedMenu

Syntax: Select all

menu = PagedMenu(
title='Zones',
top_separator='',
bottom_separator='',
select_callback=some_callback
)


it has 8.Back, 9.Next, 0.Close none-highlighted and it displays 'the amount of pages' [1/1], when there is less than 8 items, which is weird.

Is it possible to add a feature that allows you to hide the 8. Back, 9. Next, 0. Close and amount of pages, when the menu has fewer items than 8 (1 page) or even when the menu has multiple pages because on some level the buttons seem redundant before there is a next page available and it takes away the ability to do menu designs. Also, a feature that allows you to change the actual text of the buttons.
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: menu package

Postby Ayuto » Sun Feb 26, 2017 1:17 pm

The reason why Back and Next are always shown is that it provides a constant appearance. If you whish to customize this behaviour, you can subclass PagedRadioMenu and implement your own _format_footer method:
https://github.com/Source-Python-Dev-Te ... #L234-L270

If you want to change the header, you need to override _format_header:
https://github.com/Source-Python-Dev-Te ... #L179-L201

Return to “API Design”

Who is online

Users browsing this forum: No registered users and 11 guests