Skip to content
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

Tab hide disable #3112

Merged
merged 7 commits into from
Aug 21, 2023
Merged

Tab hide disable #3112

merged 7 commits into from
Aug 21, 2023

Conversation

rodrigogiraoserrao
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao commented Aug 17, 2023

This fixes #3088.

Adds API to enable/disable/show/hide tabs.

  • A Tab widget can be disabled directly via the reactive .disabled, which then fires a Tab.Disabled message, which is turned into a Tabs.Disabled message.
  • Preferably, and in line with the show/hide API, one can use the methods on Tabs or TabbedContent.

@rodrigogiraoserrao rodrigogiraoserrao marked this pull request as ready for review August 21, 2023 10:16
@willmcgugan
Copy link
Collaborator

Can I see a screenshot / video of a disabled tab?

Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

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

Nice work. Just one request.

src/textual/widgets/_tabs.py Outdated Show resolved Hide resolved
@rodrigogiraoserrao
Copy link
Contributor Author

Screenshots from textual run tests/snapshot_tests/snapshot_apps/modified_tabs.py.

Tabs 1 and 2 are disabled, tab 1 was disabled while active:

Untitled1

Tab 5 active while 1 and 2 are disabled:

Untitled 2

@rodrigogiraoserrao rodrigogiraoserrao merged commit 900c372 into main Aug 21, 2023
19 checks passed
@rodrigogiraoserrao rodrigogiraoserrao deleted the tab-hide-disable branch August 21, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to hide and disable tabs
2 participants