Trying to work around ControlList limitations/quirks
#1
I'm looking for a sanity check here. Am I missing something obvious, or is there a better way?

In the Text to Speech script that I am reworking, I am creating a custom python Settings gui. The first challenge is to select a language from a dynamic list based upon the speech engine. There may be over 200 to chose from. Requirements are 1) The list is presented on it's own dialog with an OK/Cancel button, 2) the gui is voiced 2) the settings changes are reflected immediately by the voicing engine so that the user has immediate feedback. 4) An item should visually indicate that it is selected. 5) Only one item can be selected at a time.

Now for the problem(s).

I started with a standard "list" control in my selection-dialog.xml. There is no onClick event when a selection is made. The list sets ListItem.select as items are scrolled, and not when selected by mouse/key select. It seems impossible for me to customize the behavior without onClick. I might be able to kludge something with onAction events, but it is problematic.

I next tried to use ControlList.setStaticContent(). This allows me to have an onClick event, however, you lose any data from getSelectedPosition, getListItem(idx), etc.. More critically, I can't figure out how to visually indicate the current selected item. I can create a Skin.String or other property to track the selected item, however it seems that there is no way to have conditional that takes two $INFO expressions, such as <visible>Skin.String(selectedindex, $INFO[ListItem.Label2])</visible> where 'selectedindex' contains the index of the selected item and Label2 contains the index of the ListItem. I can't have the python code mark the listItem as selected, because I don't have access to the list items when using static content.

I tried using a plugin to load the data: <content>plugin://service.xbmc.tts?arg1=foo</content>, but the load time was surprisingly slow, taking a second or more. Further, it has the same problems as static content, ControlList.size() returns 0 and there is no access to the list items from Python.

The only other approach that I can think of is to try a groupList with a lot of statically created buttons with the unused ones set to invisible. Since there is no python interface I don't think that I can dynamically add buttons. I'll have to create perhaps 300 buttons to cover the worst case, which is unappealing.

Thanks for any guidance.
Reply


Messages In This Thread
Trying to work around ControlList limitations/quirks - by fbacher - 2020-07-13, 19:04
Logout Mark Read Team Forum Stats Members Help
Trying to work around ControlList limitations/quirks0