Skip to content

Conversation

@gabriel-desmarchelier
Copy link

This PR implements an option to allow each tab from the NavigationTabs widget to have its own colors.

Here is the use case that drives me to suggest this feature :
I want to be able to use rules to apply a specific color to a tab, depending on the status of the device associated to this tab.
Let's say I manage several power supply units and I want the tab color to show me which one is up, which one is ramping up, which one is in fault.

What it looks like when I'm looking into Tab0 but something happened in Tab2 :

image

Of course, I also want to know that I'm looking into Tab0, even when everything goes wrong :

image

So I implemented :

  • new tab properties as part of the Tab StructuredWidgetProperty
    • individual_selected_color
    • individual_deselected_color
  • new widget property : enable_individual_tab_colors
    • if False : the usual selected_color and deselected_color are used
    • if True : the new individual_selected_color and individual_deselected_color are used
    • defaults to false, avoiding any breaking change

I also changed the name of tabs attribute and of setTabs method to clarify the fact that they refer to the tab names.

Here is a .bob with various configurations of NavigationTabs that use this feature :
nav_tabs_colors.tar.gz

Let me know if you think such a feature is relevant of if you think this not the right way to implement it.

Checklist

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

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.

1 participant