Skip to content

Commit

Permalink
Improve visual appearance of list selection combobox for low numbers …
Browse files Browse the repository at this point in the history
…of lists
  • Loading branch information
watkins-matt committed Apr 24, 2024
1 parent b676979 commit b83f83e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
29 changes: 25 additions & 4 deletions custom_components/google_keep_sync/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import AbortFlow, FlowResult
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import selector

from .api import GoogleKeepAPI, ListCase
Expand Down Expand Up @@ -120,7 +119,19 @@ async def async_step_init(
{
vol.Required(
"lists_to_sync", default=existing_lists
): cv.multi_select({list.id: list.title for list in lists}),
): selector.SelectSelector(
selector.SelectSelectorConfig(
options=[
selector.SelectOptionDict(
value=list.id, label=list.title
)
for list in lists
],
mode=selector.SelectSelectorMode.DROPDOWN,
multiple=True,
custom_value=False,
)
),
vol.Optional(
"list_item_case", default=list_item_case
): selector.SelectSelector(
Expand Down Expand Up @@ -331,8 +342,18 @@ async def async_step_options(

options_schema = vol.Schema(
{
vol.Required("lists_to_sync", default=existing_lists): cv.multi_select(
{list.id: list.title for list in lists}
vol.Required(
"lists_to_sync", default=existing_lists
): selector.SelectSelector(
selector.SelectSelectorConfig(
options=[
selector.SelectOptionDict(value=list.id, label=list.title)
for list in lists
],
mode=selector.SelectSelectorMode.DROPDOWN,
multiple=True,
custom_value=False,
)
),
vol.Optional(
"list_item_case", default=list_item_case
Expand Down
6 changes: 4 additions & 2 deletions custom_components/google_keep_sync/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
},
"options": {
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]",
"description": "Choose which lists to synchronize and optionally add a prefix to the list names in Home Assistant.",
"description": "Choose lists to synchronize and configure other options.",
"data": {
"lists_to_sync": "Lists to Sync",
"list_prefix": "List Prefix",
"list_auto_sort": "Automatically Sort Lists",
"list_item_case": "Change List Item Case"
},
"data_description": {
"lists_to_sync": "Choose which lists to synchronize. You can select multiple lists. Archived or deleted lists are not shown here.",
"list_prefix": "(Optional, can be blank) Add a unique identifier to the front of each list name in Home Assistant. For example, entering 'Google' will display your shopping list as 'Google Shopping List'. Leave empty to have the lists named as they are in Google Keep.",
"list_auto_sort": "If checked, all of your selected lists will be changed to be sorted alphabetically. This is bidirectional, so your lists in both Home Assistant and Google Keep will be sorted.",
"list_item_case": "Changes all of your list items to the given case. Default is to not change anything. This is bidirectional, so your list items in both Home Assistant and Google Keep will be changed."
Expand All @@ -50,14 +51,15 @@
"step": {
"init": {
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]",
"description": "Choose which lists to synchronize and optionally add a prefix to the list names in Home Assistant.",
"description": "Choose lists to synchronize and configure other options.",
"data": {
"lists_to_sync": "Lists to Sync",
"list_prefix": "List Prefix",
"list_auto_sort": "Automatically Sort Lists",
"list_item_case": "Change List Item Case"
},
"data_description": {
"lists_to_sync": "Choose which lists to synchronize. You can select multiple lists. Archived or deleted lists are not shown here.",
"list_prefix": "(Optional, can be blank) Add a unique identifier to the front of each list name in Home Assistant. For example, entering 'Google' will display your shopping list as 'Google Shopping List'. Leave empty to have the lists named as they are in Google Keep.",
"list_auto_sort": "If checked, all of your selected lists will be changed to be sorted alphabetically. This is bidirectional, so your lists in both Home Assistant and Google Keep will be sorted.",
"list_item_case": "Changes all of your list items to the given case. Default is to not change anything. This is bidirectional, so your list items in both Home Assistant and Google Keep will be changed."
Expand Down
6 changes: 4 additions & 2 deletions custom_components/google_keep_sync/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
},
"options": {
"title": "Configure options",
"description": "Choose which lists to synchronize and optionally add a prefix to the list names in Home Assistant.",
"description": "Choose lists to synchronize and configure other options.",
"data": {
"lists_to_sync": "Lists to Sync",
"list_prefix": "List Prefix",
"list_auto_sort": "Automatically Sort Lists",
"list_item_case": "Change List Item Case"
},
"data_description": {
"lists_to_sync": "Choose which lists to synchronize. You can select multiple lists. Archived or deleted lists are not shown here.",
"list_prefix": "(Optional, can be blank) Add a unique identifier to the front of each list name in Home Assistant. For example, entering 'Google' will display your shopping list as 'Google Shopping List'. Leave empty to have the lists named as they are in Google Keep.",
"list_auto_sort": "If checked, all of your selected lists will be changed to be sorted alphabetically. This is bidirectional, so your lists in both Home Assistant and Google Keep will be sorted.",
"list_item_case": "Changes all of your list items to the given case. Default is to not change anything. This is bidirectional, so your list items in both Home Assistant and Google Keep will be changed."
Expand All @@ -50,14 +51,15 @@
"step": {
"init": {
"title": "Configure options",
"description": "Choose which lists to synchronize and optionally add a prefix to the list names in Home Assistant.",
"description": "Choose lists to synchronize and configure other options.",
"data": {
"lists_to_sync": "Lists to Sync",
"list_prefix": "List Prefix",
"list_auto_sort": "Automatically Sort Lists",
"list_item_case": "Change List Item Case"
},
"data_description": {
"lists_to_sync": "Choose which lists to synchronize. You can select multiple lists. Archived or deleted lists are not shown here.",
"list_prefix": "(Optional, can be blank) Add a unique identifier to the front of each list name in Home Assistant. For example, entering 'Google' will display your shopping list as 'Google Shopping List'. Leave empty to have the lists named as they are in Google Keep.",
"list_auto_sort": "If checked, all of your selected lists will be changed to be sorted alphabetically. This is bidirectional, so your lists in both Home Assistant and Google Keep will be sorted.",
"list_item_case": "Changes all of your list items to the given case. Default is to not change anything. This is bidirectional, so your list items in both Home Assistant and Google Keep will be changed."
Expand Down
6 changes: 4 additions & 2 deletions custom_components/google_keep_sync/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
},
"options": {
"title": "Configurar opciones",
"description": "Selecciona las listas de Google Keep que deseas sincronizar.\n\n*Prefijo de Lista* (Opcional): Agrega un identificador único al principio de cada nombre de lista en Home Assistant. Por ejemplo, al introducir 'Google', tu lista de compras se mostrará como 'Google Lista de Compras'. Déjalo vacío para mantener los nombres de las listas tal como están en Google Keep.",
"description": "Elija listas para sincronizar y configurar otras opciones.",
"data": {
"lists_to_sync": "Listas a Sincronizar",
"list_prefix": "Prefijo de Lista",
"list_auto_sort": "Ordenar Listas Automáticamente",
"list_item_case": "Cambiar mayúsculas de los elementos de la lista"
},
"data_description": {
"lists_to_sync": "Elija qué listas sincronizar. Puede seleccionar varias listas. Las listas archivadas o eliminadas no se muestran aquí.",
"list_prefix": "(Opcional, puede dejarse en blanco) Agrega un identificador único al principio de cada nombre de lista en Home Assistant. Por ejemplo, al introducir 'Google', tu lista de compras se mostrará como 'Google Lista de Compras'. Déjalo vacío para mantener los nombres de las listas tal como están en Google Keep.",
"list_auto_sort": "Si se marca, todas tus listas seleccionadas se cambiarán para ser ordenadas alfabéticamente. Esto es bidireccional, por lo que tus listas en Home Assistant y Google Keep serán ordenadas.",
"list_item_case": "Cambia todos los elementos de tu lista a la configuración de mayúsculas especificada. Por defecto no se cambia nada. Este cambio es bidireccional, por lo que los elementos de tu lista en Home Assistant y en Google Keep serán modificados."
Expand All @@ -50,14 +51,15 @@
"step": {
"init": {
"title": "Configurar opciones",
"description": "Selecciona las listas de Google Keep que deseas sincronizar y, opcionalmente, añade un prefijo a los nombres de las listas en Home Assistant.",
"description": "Elija listas para sincronizar y configurar otras opciones.",
"data": {
"lists_to_sync": "Listas a Sincronizar",
"list_prefix": "Prefijo de Lista",
"list_auto_sort": "Ordenar Listas Automáticamente",
"list_item_case": "Cambiar mayúsculas de los elementos de la lista"
},
"data_description": {
"lists_to_sync": "Elija qué listas sincronizar. Puede seleccionar varias listas. Las listas archivadas o eliminadas no se muestran aquí.",
"list_prefix": "(Opcional, puede dejarse en blanco) Agrega un identificador único al principio de cada nombre de lista en Home Assistant. Por ejemplo, al introducir 'Google', tu lista de compras se mostrará como 'Google Lista de Compras'. Déjalo vacío para mantener los nombres de las listas tal como están en Google Keep.",
"list_auto_sort": "Si se marca, todas tus listas seleccionadas se cambiarán para ser ordenadas alfabéticamente. Esto es bidireccional, por lo que tus listas en Home Assistant y Google Keep serán ordenadas.",
"list_item_case": "Cambia todos los elementos de tu lista a la configuración de mayúsculas especificada. Por defecto no se cambia nada. Este cambio es bidireccional, por lo que los elementos de tu lista en Home Assistant y en Google Keep serán modificados."
Expand Down
6 changes: 4 additions & 2 deletions custom_components/google_keep_sync/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
},
"options": {
"title": "Konfigurera alternativ",
"description": "Välj vilka Google Keep-listor som ska synkroniseras.\n\n*Listprefix* (Valfritt): Lägg till en unik identifierare framför varje listnamn i Home Assistant. Till exempel, genom att skriva 'Google' kommer din inköpslista att visas som 'Google Inköpslista'. Lämna fältet tomt för att behålla listornas namn som de är i Google Keep.",
"description": "Välj listor att synkronisera och konfigurera andra alternativ.",
"data": {
"lists_to_sync": "Listor att Synkronisera",
"list_prefix": "Listprefix",
"list_auto_sort": "Sortera Listor Automatiskt",
"list_item_case": "Ändra versalisering för listobjekt"
},
"data_description": {
"lists_to_sync": "Välj vilka listor som ska synkroniseras. Du kan välja flera listor. Arkiverade eller raderade listor visas inte här.",
"list_prefix": "(Valfritt, kan lämnas tomt) Lägg till en unik identifierare framför varje listnamn i Home Assistant. Till exempel, genom att skriva 'Google' kommer din inköpslista att visas som 'Google Inköpslista'. Lämna fältet tomt för att behålla listornas namn som de är i Google Keep.",
"list_auto_sort": "Om markerad kommer alla dina valda listor att ändras för att sorteras alfabetiskt. Detta är tvåvägs, så dina listor i både Home Assistant och Google Keep kommer att sorteras.",
"list_item_case": "Ändrar alla dina listobjekt till angivet skiftläge. Standard är att inte ändra något. Detta är dubbelriktat, så dina listobjekt i både Home Assistant och Google Keep kommer att ändras."
Expand All @@ -50,14 +51,15 @@
"step": {
"init": {
"title": "Konfigurera alternativ",
"description": "Välj vilka listor som ska synkroniseras och lägg eventuellt till ett prefix till listnamnen i Home Assistant.",
"description": "Välj listor att synkronisera och konfigurera andra alternativ.",
"data": {
"lists_to_sync": "Listor att Synkronisera",
"list_prefix": "Listprefix",
"list_auto_sort": "Sortera Listor Automatiskt",
"list_item_case": "Ändra versalisering för listobjekt"
},
"data_description": {
"lists_to_sync": "Välj vilka listor som ska synkroniseras. Du kan välja flera listor. Arkiverade eller raderade listor visas inte här.",
"list_prefix": "(Valfritt, kan lämnas tomt) Lägg till en unik identifierare framför varje listnamn i Home Assistant. Till exempel, genom att skriva 'Google' kommer din inköpslista att visas som 'Google Inköpslista'. Lämna fältet tomt för att behålla listornas namn som de är i Google Keep.",
"list_auto_sort": "Om markerad kommer alla dina valda listor att ändras för att sorteras alfabetiskt. Detta är tvåvägs, så dina listor i både Home Assistant och Google Keep kommer att sorteras.",
"list_item_case": "Ändrar alla dina listobjekt till angivet skiftläge. Standard är att inte ändra något. Detta är dubbelriktat, så dina listobjekt i både Home Assistant och Google Keep kommer att ändras."
Expand Down

0 comments on commit b83f83e

Please sign in to comment.