Skip to content

Kivy: swap from the tab carousel to navigation bar #4930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alwaysintreble
Copy link
Collaborator

What is this fixing or adding?

Navigation bar is a bit less buggy, but it doesn't come with a built-in underline, so that had to be made custom. The only noticeable change here from the user perspective is that the underline is more responsive, while this offsets a bunch of boilerplate off to the kv to make it easier to maintain.

How was this tested?

Tried out various clients that have various amounts of tabs and checked that they still behaved as expected. Still currently has an issue where the underline won't get moved to the proper position after everything has finished getting set up and not sure how to fix it.

@github-actions github-actions bot added the affects: core Issues/PRs that touch core and may need additional validation. label Apr 26, 2025
Copy link
Collaborator

@Silvris Silvris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC there should be an indicator on MDNavigationBar anyways, so we may not even need a underline bar if we can figure out its issue.

Comment on lines +930 to +933
if -1 < index <= len(self.tabs.children):
index = len(self.tabs.children) - index
self.tabs.add_widget(new_tab, index=index)
self.screens.add_widget(new_screen, index=index)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to check this behavior, the reason this was added is because the add_widget indexing is inverted between the tabs container and the carousel

Comment on lines -771 to -776
def remove_tab(self, tab, content=None):
if content is None:
content = tab.content
self.ids.container.remove_widget(tab)
self.carousel.remove_widget(content)
self.on_size(self, self.size)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are clients relying on this function (UT iirc), so removing it may not be the best choice. Especially if the tab behavior is being split between self.tabs and self.screens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants