How to get boolean from settings.xml to visible tag in main screensaver xml
#1
Hey, so Im building a screensaver and need a point in the right direction, I would like to have an option to disable an overlay in my settings.xml, setting the boolean and retrieving it in my script file is fine, what I dont understand is how to get the boolean to a `<visible></visible>` in the screensavers xml file. Can any one point me in the right direction.

Secondly and maybe more complicated, is I would then like it to be possible to give a user a number of color options for that overlay, also fro m the settings.xml. So similar problem, I dont know how and kinda stuck. Linked the repo below in case its needed.

Thanks!

https://github.com/nazarja/movies-and-tv...creensaver
Reply
#2
While Im asking questions, an issue that I encountered was trying to add fonts that worked over all skins, Is there a way to add a font to the addons folder and keep it local. Couldnt see any examples of this, so I was thinking its a bit limiting in terms of using fonts so there must be a way that I havent come across?
Reply
#3
For the "bool" setting, you need to set a window property with your variable value, the property is then used by the skin.

As for color selection, you'll have to use a skin helper script... Offhand I do not recall which one included color selection. Once you use the script you would set the color using the same method described above.

Fonts and scripts are a long standing issue; your best bet is to stick to the main font names found in estuarys fonts.xml file. You can also write custom code to handle font changes between Kodi skins.

I'm away from my office, however when I get back I will post reference links to the aforementioned instructions.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#4
Ok, I figured out the variable from settings to xml issue, in case anyone else is looking for this solution, although Im not sure its the best way to do it. Credit to Lunatixz as I learned from his earth screensaver. 

Settings.xml:
<setting label="Hide Overlay" type="bool" id="HideOverlay" default="false"/>
<setting label="Highlight Color" type="enum" id="HighlightColor" default="3" values="red|pink|orange|yellow|green|blue|purple"/>

XML File:
For the boolean:
<visible>String.isEqual(Window.Property(hide_overlay),show)</visible>
For colors:
<colordiffuse>Window.Property(highlight_color)</colordiffuse>

gui.py:
hide_overlay = 'hide' if addon.getSetting('HideOverlay') == 'true' else 'show'
colors = ['80b80419', '80bd069e', '80c25808', '80c7b10a', '8022cc0c', '800385b5', '80810ccf']
highlight_color = colors[int(addon.getSetting('HighlightColor'))]

def onInit(self):
self.window_id = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
self.window_id.setProperty('hide_overlay', hide_overlay)
self.window_id.setProperty('highlight_color', highlight_color)
Reply
#5
(2019-04-22, 15:31)Lunatixz Wrote: For the "bool" setting, you need to set a window property with your variable value, the property is then used by the skin.

As for color selection, you'll have to use a skin helper script... Offhand I do not recall which one included color selection. Once you use the script you would set the color using the same method described above.

Fonts and scripts are a long standing issue; your best bet is to stick to the main font names found in estuarys fonts.xml file. You can also write custom code to handle font changes between Kodi skins.

I'm away from my office, however when I get back I will post reference links to the aforementioned instructions.
Thanks for your reply, Window Property was the way to go alright, much credit to you and your earth screensaver. Thanks so much!
Reply
#6
(2019-04-22, 15:39)nazarja Wrote: ...although Im not sure its the best way to do it

Would be thrilled to see a better solution Wink

Skins arguments do not compare bool strings, so you cannot use "True", "true", "False", "false". You need to create your own "Boolean" arguments. ie does this string match that string.

For handling color I recommend if you plan to offer more than a few, use a skin helper script that includes a built-in color selection wheel.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#7
I meant I think the way I implemented it probably wasn't the best way. Your code is excellent and I hope you dont mind me looking / learning from it. I agree on the color picker, I might try to do that.
Reply
#8
(2019-04-22, 16:46)nazarja Wrote: I meant I think the way I implemented it probably wasn't the best way. Your code is excellent and I hope you dont mind me looking / learning from it. I agree on the color picker, I might try to do that.

Glad it's helpful, I don't mind at all...
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply

Logout Mark Read Team Forum Stats Members Help
How to get boolean from settings.xml to visible tag in main screensaver xml0