Kodi Community Forum
Release script.skinshortcuts - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+---- Forum: Skin helper addons (https://forum.kodi.tv/forumdisplay.php?fid=300)
+---- Thread: Release script.skinshortcuts (/showthread.php?tid=178294)



RE: script.skinshortcuts - jingai - 2015-10-05

(2015-10-05, 15:59)BobCratchett Wrote: @jingai - the properties i]should[/i] be being saved into the .properties file in each profiles addon_data folder. If that's not happening, this is a new bug Wink

Ahh yes, you're right, they are stored separately in the profiles folder. Sorry, I don't actually use multiple profiles myself.

(2015-10-05, 15:59)BobCratchett Wrote: Even more unfortunately (not least because neither I, nor presumably those who tried the beta versions) use profiles, it introduced a new bug whereby the code was being asked to load the correct .properties file, but was actually returning a cached version of the file (which was for the first profile the menu was being built for). This should* finally be fixed in 0.6.1, on Git.

This was apparently the problem as 0.6.1 made it work.

Thanks, I'll let the user know.


RE: script.skinshortcuts - Mr. V - 2015-10-05

(2015-10-05, 15:51)BobCratchett Wrote: @Mr. V - Have you tried setting the buttonID of your <propertySettings /> to 312? (Logically this should work, which means it probably won't!)

Do you mean change the 511 to 312?
<propertySettings property="widgetArt" buttonID="511" title="Widget Art" />

I have assigned 511 to a widgetArt selection dialog
Code:
<control type="button" id="511">
                    <description>Change widget art</description>
                    <width>1316</width>
                    <height>90</height>
                    <textoffsetx>30</textoffsetx>
                    <font>font15</font>
                    <label>Widget Art</label>
                    <label2>$VAR[WidgetArtLabelVar]</label2>
                    <visible>!IsEmpty(Container(211).ListItem.Property(widgetName)) + !StringCompare(Container(211).ListItem.Property(widgetName),weather)</visible>
                </control>

I have another button with an id of 312 for widget selection.

I also was looking at the documentation for Custom shortcut properties. It doesn't seem like there is away to add an icon
I was hoping I could use something like
<property property="[Property]" label="[label]" condition="[condition]" icon="[imagepath]">[Property Value]</property>
So I guess this would be a feature request.


RE: script.skinshortcuts - BobCratchett - 2015-10-05

Sorry, I should have explained fully Blush

It may be possible to use:-

Code:
<propertySettings property="widgetArt" buttonID="312" title="Widget Art" />

With the way the Skin Shortcuts code is structured, it should mean that when 312 is clicked, it will first let the user select a widget, then it will show the custom property selector. If it actually does all work like that (that's just what looking at the code suggests it will do, I'm not actually playing with any code for a day or two!), it could negate the need to have to clear the property when 312 is selected. And one downside, again looking at the code, it should show the custom property dialog if 'None' is selected as the widget... (though it shouldn't show if they cancel)

You could still keep a separate button if the user wanted to select the widgetArt property separately - within your current 511 for example

Code:
<onclick>SetProperty(chooseProperty,widgetArt)</onclick>
<onclick>SendClick(404)</onclick>

Just a thought, which might not work and might not do what you want anyway!

Edit:- Feature request noted Wink


RE: script.skinshortcuts - Mr. V - 2015-10-05

Wow. That's great, works a treat. Smile This was something I was thinking about.

One amazing plugin. Thats making recoding these widgets very quick. Smile


RE: script.skinshortcuts - BobCratchett - 2015-10-06

Nice Smile I'll add it on to my list of things to do to make that method officially supported (so that (a) it won't break if and when someone corrects the bad coding that means it works and (b) it won't show if the user cancels) Smile


RE: script.skinshortcuts - Mr. V - 2015-10-06

Hi Bob,

Another query for you.
Is there anyway to get a list of each property that is set for widgetType, widget ect for the built in widgets?

Otherwise I will just build the menu for each widget and compile a table. I need this to set visibility conditions to limit artwork choices based upon the chosen widget.


RE: script.skinshortcuts - BobCratchett - 2015-10-06

I presume you've already seen this...?

For specific widgetTypes for nodes/playlists/add-ons, I believe they are:-
  • songs
  • albums
  • movies
  • tvshows
  • episodes
  • musicvideos
  • mixed

(In the case of add-ons, it's a best-guess at the content type, based on the artwork the plugin makes available, thanks to some fantastic code from marcelveldt)

In the case of the 'Default Widgets' they're provided by the Skin Helper Script, so I'll defer to marcelveldt if they return any surprises in their values Wink but I presume their 'widget' value will be 'Addon' and the 'widgetType' will be the appropriate value for the content from the list above (or the alternatives of 'video', 'audio', 'picture', 'program' if they don't provide specific content).


RE: script.skinshortcuts - Mr. V - 2015-10-06

Thanks. I did see that link. Was of some help.

What I didn't realize was that the default widgets came from the Skin helper Script. I had it installed but was visible without me adding any code. (unless there is something I missed)

Not all values returned are what I expected.

So my plan of attack is to set each widget and build the menu. Then record each value in an excel spreadsheet. Will make coding the visibility condition much easier and likely help some other kodi community members.


RE: script.skinshortcuts - braz - 2015-10-06

(2015-10-05, 23:31)BobCratchett Wrote: It may be possible to use:-

Code:
<propertySettings property="widgetArt" buttonID="312" title="Widget Art" />
This is great, was able to remove the extra button. Though like you say, it also prompts for Widget Art when selecting none. And in my testing, it also prompts when canceling the widget dialog.


RE: script.skinshortcuts - im85288 - 2015-10-06

Hi Bob,

Credit where it is due the new documentation is extremely good. You have done a brilliant Job putting it all together in a way that is easy to follow, which makes some of the advanced topics not seem to be so daunting.

Having read through them a bit I discovered the "Just Select" method. Is it possible to use that dialog to select a widget (instead of a shortcut action)? This could be useful for supplying custom widgets to areas not associated with a particular menu item.

Thanks again for the great work here.


RE: script.skinshortcuts - User 224999 - 2015-10-06

Ian, you can use the just select for widgets, note the list property it can return...


RE: script.skinshortcuts - im85288 - 2015-10-06

Thanks Marcel, When I looked here Just Select and followed the example given I was only able to select shortcut actions and have the path available in for example the skinAction or skinList properties. Was there something simple I missed?


RE: script.skinshortcuts - User 224999 - 2015-10-06

(2015-10-06, 13:49)im85288 Wrote: Thanks Marcel, When I looked here Just Select and followed the example given I was only able to select shortcut actions and have the path available in for example the skinAction or skinList properties. Was there something simple I missed?

There is no "native" method to use skinshortcuts for widgets only but you can use the just select method for it.
The list property (skin string) it returns will contain the actual path, not the onclick action.
With some visiblity conditions in your overrides.xml you can show/hide values for availability in the select shortcut dialog.


RE: script.skinshortcuts - im85288 - 2015-10-06

(2015-10-06, 13:52)marcelveldt Wrote:
(2015-10-06, 13:49)im85288 Wrote: Thanks Marcel, When I looked here Just Select and followed the example given I was only able to select shortcut actions and have the path available in for example the skinAction or skinList properties. Was there something simple I missed?

There is no "native" method to use skinshortcuts for widgets only but you can use the just select method for it.
The list property (skin string) it returns will contain the actual path, not the onclick action.
With some visiblity conditions in your overrides.xml you can show/hide values for availability in the select shortcut dialog.

Sorry to be a pain on this one, but I'm not following how the list property will be set on the skin string.

Looking at the code I see the following:

Code:
# Now set the skin strings
            if selectedShortcut is not None and selectedShortcut.getProperty( "Path" ):
                path = urllib.unquote( selectedShortcut.getProperty( "Path" ) )
                if selectedShortcut.getProperty( "chosenPath" ):
                    path = urllib.unquote( selectedShortcut.getProperty( "chosenPath" ) )

                if path.startswith( "pvr-channel://" ):
                    path = "RunScript(script.skinshortcuts,type=launchpvr&channel=" + path.replace( "pvr-channel://", "" ) + ")"
                if self.LABEL is not None and selectedShortcut.getLabel() != "":
                    xbmc.executebuiltin( "Skin.SetString(" + self.LABEL + "," + selectedShortcut.getLabel() + ")" )
                if self.ACTION is not None:
                    xbmc.executebuiltin( "Skin.SetString(" + self.ACTION + "," + path + " )" )
                if self.SHORTCUTTYPE is not None:
                    xbmc.executebuiltin( "Skin.SetString(" + self.SHORTCUTTYPE + "," + selectedShortcut.getLabel2() + ")" )
                if self.THUMBNAIL is not None and selectedShortcut.getProperty( "icon" ):
                    xbmc.executebuiltin( "Skin.SetString(" + self.THUMBNAIL + "," + selectedShortcut.getProperty( "icon" ) + ")" )
                if self.THUMBNAIL is not None and selectedShortcut.getProperty( "thumbnail" ):
                    xbmc.executebuiltin( "Skin.SetString(" + self.THUMBNAIL + "," + selectedShortcut.getProperty( "thumbnail" ) + ")" )
                if self.LIST is not None:
                    xbmc.executebuiltin( "Skin.SetString(" + self.LIST + "," + DATA.getListProperty( path ) + ")" )

Which seems to coincide with the documentation where it sets for example skinAction, skinList, skinLabel and skinThumbNail. Are you saying a different skin string is set for widgets that I cannot see in the documentation.


RE: script.skinshortcuts - User 224999 - 2015-10-06

(2015-10-06, 14:28)im85288 Wrote: Which seems to coincide with the documentation where it sets for example skinAction, skinList, skinLabel and skinThumbNail. Are you saying a different skin string is set for widgets that I cannot see in the documentation.

No, I guess you misunderstand... There's no widget property. The just select method just returns whatever the user selected.
It wil return the path in a skin string (the full activatewindow..) and the path to be used in a widget.

So, use skinList to get the widget path...