New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skinning] Skin timer implementation #21320
Conversation
cc8702f
to
224671f
Compare
Ok, I think I've adjusted all the comments. Thanks much! |
02c2fe8
to
c8e5a9c
Compare
All three use cases mentioned in the PR post have been implemented and validated the implementation. |
Looks good to me from the brief look at the code. I will abstain from approval though until I make a Debian build. |
@enen92 I'll try and find the time later to look at that doxygen file, if not later then tomorrow at latest. FYI once this and your related Estuary PR's are in. I've got this ready to PR So ability to use or not use skin timer to autoclose seekbar when paused, and be able to configure the time after which autoclose takes effect. I've also been able to work after much trial & error how to have a configurable DisplayAfterSeek replacement using skin timers, which is the setting Seekbar autoclose after seeking time (seconds) |
Great! Too bad in the skin settings window we don't have access to setting levels (afaik). I am a bit afraid in that screenshots we clutter settings and add too much complexity. |
The additional complexity is why I'll leave it until your Estaury PR's are in, and then offer this as an enhancement. So nothing is held up if bike shedding starts on what I've done. If nothing else it will showcase to skinners the other possibilities such as doing a different displayafterseek replacement implementation. |
Merging by tomorrow night if no more feedback/requests |
Today is yesterday's tomorrow night :) |
Motivation and context
Currently time-based logic in the skinning engine is pretty limited: skins either rely on the
System.IdleTime
boolean condition (which is linked to input) for checking "idle" state which doesn't necessarily mean no actions on that time, dummy windows (ref) for auto closing other windows, trigger theAlarmClock
builtin with skin properties (see ref) or simply delegate time-based stuff to background python scripts. All of these solutions are quite hacky and some (such as python) have a performance penalty that may not be acceptable for a default skin or low-end hardware.I've created this with 3 main use cases in mind:
Player.DisplayAfterSeek
boolean condition which is a current design flaw of VP (see background in [EDL] Use TrickPlay in EDL seeks #20753 (comment)). In this case the core is currently dictating for how long the GUI/Skin should display stuff when a seek happens. Affects for example EDL since the seekbar overlays the video for no reason. (Done in [GUI][Info] Add Player.HasPerformedSeek(interval) #21366 and [skins] Remove player.displayafterseek in skins in favor of Player.Ha… #21380). Removal of displayafterseek from core done in [gui][info] Remove Player.DisplayAfterSeek #21425)Description
(c/p from the doxygen file)
Skin timers are skin objects that dependent on time and can be fully controlled from skins either using
builtin functions or boolean conditions/expressions. One can see them
as stopwatches that can be activated and deactivated automatically depending on the value of info expressions or simply activated/deactivated manually from builtins.
The framework was created to allow skins to control the visibility of windows (or controls) depending on
the elapsed time of timers the skin define. Skin timers allow multiple use cases in skins, previously only available via the execution of python scripts (or other hacks):
Skin timers are defined in a
Timers.xml
file within the xml directory of the skin. The file has the following "schema":Examples
The following example illustrates the simplest possible skin timer. This timer is completely manual (it has to be manually started and stopped):
This timer can be controlled from your skin by executing the
Skin.TimerStart(mymanualtimer)
builtin orthe
Skin.TimerStop(mymanualtimer)
builtin. You can define the visibility of skin elements based on the internalproperties of the timer, such as the fact that the timer is active/running using
Skin.TimerIsRunning(mymanualtimer)
or depending on the elapsed time (e.g. 5 seconds) using the expressionInteger.IsGreaterOrEqual(Skin.TimerElapsedSecs(mymanualtimer),5)
.The following timer is a variation of the previous timer with the particularity of being automatically stopped by the skinning engine after a maximum of elapsed 5 seconds without having to issue the
Skin.TimerStop(mymanualtimer)
builtin:This type of timer is particularly useful if you want to automatically close a specific window (or triggering a close animation) after x time has elapsed, while guaranteeing the timer is also stopped. See the example below which trigger a slide animation on a window after it has been open for 5 seconds:
The following timer presents a notification (for 1 sec) whenever the timer is activated or deactivated:
The following timer is an example of a completely automatic timer. The timer is automatically activated or deactivated based on the value
of boolean info expressions. In this particular example, the timer is automatically started whenever the Player is playing a file (if not already running). It is stopped if
there is no file being played (and of course if previously running). Since the timer can be activated/deactivated multiple times,
reset="true"
ensures the timer isalways reset to 0 on each start operation. Whenever the timer is started or stopped, notifications are issued.
In certain situations you might want to reset your timer without having to stop and start. For instance, if you want to stop the timer after 4 seconds
but have the timer resetting to 0 seconds if the user provides some input to Kodi. For such cases the
<reset/>
condition can be used:Available tags
How has this been tested?
Runtime tested with a skin timer implementation equivalent to #20816:
Timers.xml:
Window:
I plan to implement the other 2 use-cases shortly. Since they will stress test the implementation and they may require changes to this one I suggest only to merge this once they are finished. Code review is appreciated though whenever you find time.
What is the effect on users?
Skinners should now have a more powerful way of defining time-based logic in skins.
Types of change
Checklist: