Skip to content

Commit 705df3a

Browse files
committed
Add
- labels for selectors for more clarity
1 parent a05ce12 commit 705df3a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

custom_components/plex_recently_added/config_flow.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
SelectSelectorConfig,
88
SelectSelectorMode,
99
TextSelector,
10-
TextSelectorConfig
10+
TextSelectorConfig,
11+
ConstantSelector,
12+
ConstantSelectorConfig
1113
)
1214
from homeassistant.config_entries import ConfigEntry
1315
from homeassistant.core import callback
@@ -28,6 +30,8 @@
2830
ALL_SECTION_TYPES,
2931
CONF_SECTION_LIBRARIES,
3032
CONF_EXCLUDE_KEYWORDS,
33+
CONF_SECTION_LIBRARIES_LABEL,
34+
CONF_EXCLUDE_KEYWORDS_LABEL,
3135
CONF_ON_DECK,
3236
CONF_VERIFY_SSL
3337
)
@@ -48,7 +52,9 @@
4852
vol.Optional(CONF_MAX, default=5): vol.All(vol.Coerce(int), vol.Range(min=0)),
4953
vol.Optional(CONF_ON_DECK, default=False): vol.All(bool),
5054
vol.Optional(CONF_SECTION_TYPES, default={"movie", "show"}): SelectSelector(SelectSelectorConfig(options=ALL_SECTION_TYPES, mode=SelectSelectorMode.DROPDOWN ,multiple=True)),
55+
vol.Optional(CONF_SECTION_LIBRARIES + "_label"): ConstantSelector(ConstantSelectorConfig(value=CONF_SECTION_LIBRARIES_LABEL)),
5156
vol.Optional(CONF_SECTION_LIBRARIES): TextSelector(TextSelectorConfig(multiple=True, multiline=False)),
57+
vol.Optional(CONF_EXCLUDE_KEYWORDS + "_label"): ConstantSelector(ConstantSelectorConfig(value=CONF_EXCLUDE_KEYWORDS_LABEL)),
5258
vol.Optional(CONF_EXCLUDE_KEYWORDS): TextSelector(TextSelectorConfig(multiple=True, multiline=False)),
5359
})
5460

custom_components/plex_recently_added/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
ALL_SECTION_TYPES: Final = ["movie", "show", "artist", "photo"]
1111
CONF_SECTION_LIBRARIES: Final = 'section_libraries'
1212
CONF_EXCLUDE_KEYWORDS: Final = 'exclude_keywords'
13+
CONF_SECTION_LIBRARIES_LABEL: Final = 'Which libraries to consider:'
14+
CONF_EXCLUDE_KEYWORDS_LABEL: Final = 'Keyword to be exclude from the sensor:'
1315
CONF_ON_DECK: Final = 'on_deck'
1416
CONF_VERIFY_SSL: Final = 'verify_ssl'
1517

custom_components/plex_recently_added/options_flow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
SelectSelectorConfig,
88
SelectSelectorMode,
99
TextSelector,
10-
TextSelectorConfig
10+
TextSelectorConfig,
11+
ConstantSelector,
12+
ConstantSelectorConfig,
1113
)
1214

1315
from .const import (
@@ -16,6 +18,7 @@
1618
CONF_SECTION_LIBRARIES,
1719
ALL_SECTION_TYPES,
1820
CONF_EXCLUDE_KEYWORDS,
21+
CONF_EXCLUDE_KEYWORDS_LABEL,
1922
CONF_MAX,
2023
CONF_ON_DECK,
2124
)
@@ -49,6 +52,7 @@ async def async_step_init(self, user_input: dict[str, Any] | None = None) -> Con
4952
vol.Optional(CONF_MAX, default=self._config_entry.data[CONF_MAX]): vol.All(vol.Coerce(int), vol.Range(min=0)),
5053
vol.Optional(CONF_SECTION_TYPES, default=self._config_entry.data.get(CONF_SECTION_TYPES, [])): SelectSelector(SelectSelectorConfig(options=ALL_SECTION_TYPES ,multiple=True, mode=SelectSelectorMode.DROPDOWN)),
5154
vol.Optional(CONF_SECTION_LIBRARIES, default=self._config_entry.data.get(CONF_SECTION_LIBRARIES, [])): SelectSelector(SelectSelectorConfig(options=[str(item) for item in coordinator.data["libraries"]] ,multiple=True, mode=SelectSelectorMode.DROPDOWN)),
55+
vol.Optional(CONF_EXCLUDE_KEYWORDS + "_label"): ConstantSelector(ConstantSelectorConfig(value=CONF_EXCLUDE_KEYWORDS_LABEL)),
5256
vol.Optional(CONF_EXCLUDE_KEYWORDS, default=self._config_entry.data.get(CONF_EXCLUDE_KEYWORDS, [])): TextSelector(TextSelectorConfig(multiple=True, multiline=False)),
5357
vol.Optional(CONF_ON_DECK, default=self._config_entry.data.get(CONF_ON_DECK, False)): vol.All(bool),
5458
})

0 commit comments

Comments
 (0)