Posts: 20
Joined: Jun 2017
Reputation:
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?
Posts: 7,217
Joined: May 2011
Reputation:
395
2019-04-22, 15:31
(This post was last modified: 2019-04-22, 15:32 by Lunatixz.)
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.
Posts: 20
Joined: Jun 2017
Reputation:
2
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)
Posts: 20
Joined: Jun 2017
Reputation:
2
2019-04-22, 16:46
(This post was last modified: 2019-04-22, 16:48 by nazarja.)
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.