@
mardukL
I've created a custom dialog as monitor, as per your suggestion, implemented it and it works fine. However I'm experiencing a problem now which I can't figure out. Let me explain as detailed as possible.
I have a keymaps.xml which invokes my remote's power button to show a custom dialog with buttons (labels actually) with id 1150.
xml:
<keymap>
<global>
<keyboard>
<key id="61662">ActivateWindow(1150)</key>
<key id="61656" mod="longpress">Action(info)</key>
<key id="61624">ReloadSkin()</key>
<key id="61625">Skin.ToggleDebug()</key>
</keyboard>
</global>
</keymap>
In the estuary skin folder (
/usr/share/kodi/addons/skin.estuary/xml) this is the file "
Custom_1150_Menu.xml":
xml:
<?xml version="1.0" encoding="utf-8"?>
<window id="1150" type="dialog">
<onload>RunScript(/home/user/.kodi/userdata/monitoron0.py)</onload>
<onload>ActivateWindow(1159)</onload>
<defaultcontrol>1</defaultcontrol>
<include>Animation_DialogPopupOpenClose</include>
<controls>
<control type="group">
<centerleft>50%</centerleft>
<width>600</width>
<centertop>50%</centertop>
<height>700</height>
<include content="DialogBackgroundCommons">
<param name="darken_bg" value="false" />
<param name="width" value="600" />
<param name="height" value="80" />
<param name="header_label" value="Choose an option" />
<param name="header_id" value="1" />
</include>
<control type="panel" id="1">
<include>ButtonMenuList</include>
<content>
<item>
<label>Suspend</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>ActivateScreensaver</onclick>
<onclick>SetVolume(0, showvolumebar)</onclick>
<onclick>PlayerControl(stop)</onclick>
<onclick>Dialog.Close(all,true)</onclick>
<onclick>ActivateWindow(home)</onclick>
<onclick>SetFocus(9000)</onclick>
<onclick>RunScript(/home/user/.kodi/userdata/kodiidle.py)</onclick>
<visible>true</visible>
</item>
<item>
<label>Monitor off</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>RunScript(/home/user/.kodi/userdata/monitoroff0.py)</onclick>
<visible>true</visible>
</item>
<item>
<label>Speakers</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>RunScript(/home/user/.kodi/userdata/speakerselect.py)</onclick>
<visible>true</visible>
</item>
<item>
<label>Ambilight</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>ActivateWindow(1151)</onclick>
<visible>true</visible>
</item>
<item>
<label>Player process info</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>ActivateWindow(playerprocessinfo)</onclick>
<visible>true</visible>
</item>
<item>
<label>Storage</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>RunScript(/home/user/.kodi/userdata/storage.py)</onclick>
<visible>false</visible>
</item>
<item>
<label>Favourites</label>
<onclick>Dialog.Close(1150)</onclick>
<onclick>ActivateWindow(Favourites)</onclick>
<visible>true</visible>
</item>
</content>
</control>
</control>
</controls>
</window>
This also loads the monitor dialog "
Custom_1159_MenuMonitor.xml":
xml:
<?xml version="1.0" encoding="utf-8"?>
<window id="1159" type="dialog">
<visible>System.IdleTime(10) + Window.IsActive(1151)</visible>
<onload condition="Window.IsVisible(1151)">Dialog.Close(1151)</onload>
<controls></controls>
</window>
This dialog monitors, when the ambilight button is pressed, the "
Custom_1151_MenuAmbilight.xml":
xml:
<?xml version="1.0" encoding="utf-8"?>
<window id="1151" type="dialog">
<defaultcontrol>1</defaultcontrol>
<include>Animation_DialogPopupOpenClose</include>
<controls>
<control type="group">
<centerleft>50%</centerleft>
<width>600</width>
<centertop>50%</centertop>
<height>700</height>
<include content="DialogBackgroundCommons">
<param name="darken_bg" value="false" />
<param name="width" value="600" />
<param name="height" value="80" />
<param name="header_label" value="Ambilight" />
<param name="header_id" value="1" />
</include>
<control type="panel" id="1">
<include>ButtonMenuList</include>
<content>
<item>
<label>Power</label>
<onclick>RunScript(/home/user/.kodi/userdata/ambilightselect.py)</onclick>
<onclick>Action(Down)</onclick>
<visible>true</visible>
</item>
<item>
<label>Mode</label>
<onclick>RunScript(/home/user/.kodi/userdata/ambilightmode.py)</onclick>
<onclick>Action(Down)</onclick>
<visible>true</visible>
</item>
<item>
<label>Up</label>
<onclick>RunScript(/home/user/.kodi/userdata/ambilightup.py)</onclick>
<visible>true</visible>
</item>
<item>
<label>Down</label>
<onclick>RunScript(/home/user/.kodi/userdata/ambilightdown.py)</onclick>
<visible>true</visible>
</item>
</content>
</control>
</control>
</controls>
</window>
As soon as this dialog is up, the monitor dialog (1159) closes the ambilight dialog (1151) when no key is pressed after 10 seconds. Just as expected.
But now I want to do more development on the 1150 and 1151 dialogs so I decided to remove the monitor dialog for the time being by removing the line
xml:
<onload>ActivateWindow(1159)</onload>
from the 1150 dialog.
I then rebooted and to my suprise the monitor dialog (1159) is still working even though it is not called from my custom dialogs! When I look at the kodi log it shows that the monitor dialog
"Custom_1150_Menu.xml" is loaded on GUI init:
xml:
..
2021-07-09 10:06:48.582 T:434 INFO <general>: Unloaded skin
2021-07-09 10:06:48.585 T:434 INFO <general>: load skin from: /usr/share/kodi/addons/skin.estuary/ (version: 3.0.5)
2021-07-09 10:06:48.585 T:434 INFO <general>: load fonts for skin...
2021-07-09 10:06:48.588 T:434 INFO <general>: Loading skin includes from /usr/share/kodi/addons/skin.estuary/xml/Includes.xml
2021-07-09 10:06:48.669 T:434 INFO <general>: Loading fonts from /usr/share/kodi/addons/skin.estuary/xml/Font.xml
2021-07-09 10:06:48.783 T:434 INFO <general>: load new skin...
2021-07-09 10:06:48.783 T:434 INFO <general>: Loading custom window XMLs from skin path /usr/share/kodi/addons/skin.estuary/xml
2021-07-09 10:06:48.799 T:434 INFO <general>: initialize new skin...
2021-07-09 10:06:48.799 T:434 INFO <general>: Loading skin file: Custom_1109_TopBarOverlay.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.823 T:434 INFO <general>: Loading skin file: DialogBusy.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.826 T:434 INFO <general>: Loading skin file: DialogNotification.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.828 T:434 INFO <general>: Loading skin file: DialogSeekBar.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.846 T:434 INFO <general>: Loading skin file: Custom_1159_MenuMonitor.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.846 T:434 INFO <general>: Loading skin file: DialogExtendedProgressBar.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.849 T:434 INFO <general>: Loading skin file: Pointer.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.851 T:434 INFO <general>: Loading skin file: DialogBusy.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.852 T:434 INFO <general>: Loading skin file: DialogVolumeBar.xml, load type: LOAD_ON_GUI_INIT
2021-07-09 10:06:48.855 T:434 INFO <general>: Loading resource://resource.uisounds.kodi/sounds.xml
2021-07-09 10:06:48.938 T:434 INFO <general>: skin loaded...
2021-07-09 10:06:48.938 T:434 INFO <general>: Loading skin file: Startup.xml, load type: LOAD_EVERY_TIME
2021-07-09 10:06:48.939 T:434 INFO <general>: Loading skin file: Home.xml, load type: KEEP_IN_MEMORY
..
Before I start messing things up I'd like to know what's happening here. Why is the monitor dialog loaded on GUI init?