Kodi Community Forum

Full Version: <onfocus>-tag with condition System.IdleTime().
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Why does a idle timeout greater than zero fail, when conditioning the <onfocus>-tag ?

Result is in the comment after the various <onfocus> tags :

                <control type="togglebutton" id="705">
                    <onfocus condition="System.IdleTime(2)">Control.SetFocus(5300,1)</onfocus> <!-- Never. -->
                    <!-- <onfocus>Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
                    <!-- <onfocus condition="Player.HasVideo">Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
                    <!-- <onfocus condition="System.IdleTime(1)">Control.SetFocus(5300,1)</onfocus> --> <!-- Never. -->
                    <!-- <onfocus condition="System.IdleTime(0)">Control.SetFocus(5300,1)</onfocus> --> <!-- Immediate. -->
Im guessing the onfocus is poled, ie. it gets checked, then checked again every x amount of time. So it won't run a condition while waiting.
Because onfocus conditions are checked when the button gains focus. At that time the condition is false because the system hasn't been idle for the required amount of time.
I resolved this in my addon.
Which is a terrible solution because this is something that belongs in the UI.
I wish that I had never touched upon Kodi skinning. It's a bit of a mess with just XML, and no XSLT transforms and XSD schemas. Everything UI is done in just XML and some Python, which I'm not a big fan of (anymore), when it's not possible (but should be) in XML. The lack of <onXXXXX> tags is somewhat amazing.

But there is hope because JavaScript, Lua and Java are being added : https://github.com/AlwinEsch/kodi-dev-kit
Though it's in pre pre alpha state now. When usable, I will be rewriting my addon to JavaScript rightaway. No more snakes in my HTPC. Tongue
Like these.. 319654 (thread)
I'm not sure what you were trying to do, but you could have used an AlarmClock


And cancel it onunfocus (or onup, ondown etc.).
(2017-09-19, 23:32)badaas Wrote: [ -> ]Like these.. 319654 (thread)


We need something like the concept of defining custom events, which is built into JS. And then code event handlers to add/attach to, remove from, and trigger these custom events.
If that project on GitHub goes full monty (not python Tongue ) with the JS implementation we will have all that.

That thread you linked, also puts the finger on the gaps of information in the documentation. For example, nowhere is documented which attributes are allowed, per tag. Which built-in functions and bools are allowed in the condition attribute, per tag.
Just a few points (plus all other Kodi limits, Kodi document structures, etc) an XSD schema (for validation) could resolve.
But I know how hard it is to document, and even harder to keep docs up-to-date. So this is the first and last time I mention this about the Kodi docs Wiki.
I did bump into v17 Kodi development docs though, through that GitHub repo : https://alwinesch.github.io/index.html
But I haven't gone through them to check if they are really for v17 skinning, and more thorough.

For now, I'm stopping skinning activity. It was a fun few weeks. But I'm sticking to default Estuary (or maybe Grid) with a few mods.