• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 11
  •   
Release script.toolbox
#1
Star 
Since the Python API is more powerful than the skinning API in most aspects I think it would be useful to expose some Python functions to skinners.
This script does that: https://github.com/phil65/script.toolbox

Example:

This code:
PHP Code:
<onclick>SetProperty(Dialog.1.Label,Test)</onclick>
<
onclick>SetProperty(Dialog.1.BuiltIn,builtin1)</onclick>
<
onclick>SetProperty(Dialog.2.Label,Test 2)</onclick>
<
onclick>SetProperty(Dialog.2.BuiltIn,builtin2)</onclick>
<
onclick>SetProperty(Dialog.3.Label,Test 3)</onclick>
<
onclick>SetProperty(Dialog.3.BuiltIn,builtin3)</onclick>
<
onclick>SetProperty(Dialog.4.Label,Test 4)</onclick>
<
onclick>SetProperty(Dialog.4.BuiltIn,builtin4)</onclick>
<
onclick>RunScript(script.toolbox,info=selectdialog,header=This is a custom dialog)</onclick

would create a dialog like this:

Image

When the user clicks on a listitem then the corresponding builtin will be executed.
This way skinners can make use of DialogSelect which can be very useful on some occasions for settings with more than 2 states. At the moment there is no good way for skinners to implement those type of buttons since also spincontrol cannot be used.
DialogOK and DialogYesNo are also implemented.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#2
Nice idea, but can I suggest an alternative implementation - something along the lines of:

Code:
<onclick python="xbmcgui.Dialog().select">
    <heading>This is a custom dialog</heading>
    <item value="some_value">Label</item>
    <item value="some_value_2">Labe_2</item>
    ...
</onclick>

Which would match more directly to the actual python methods, and - for me - is more readable Smile (though the Python interface doesn't directly provide a multiselect dialog, does it?)

(2014-10-30, 00:27)phil65 Wrote: Some idea to simplify skinning a bit:
Since Python is more powerful than the skinning xml engine in most aspects I think it would be useful to expose some Python functions to skinners.
I coded a small example into script.extendedinfo (commit link):

This code:

PHP Code:
<onclick>SetProperty(Dialog.Header,This is a custom dialog)</onclick>
<
onclick>SetProperty(Dialog.NumItems,4)</onclick>
<
onclick>SetProperty(Dialog.Target,Name_of_Skin_String)</onclick>
<
onclick>SetProperty(Dialog.1.Label,Test)</onclick>
<
onclick>SetProperty(Dialog.1.Value,some_value)</onclick>
<
onclick>SetProperty(Dialog.2.Label,Test 2)</onclick>
<
onclick>SetProperty(Dialog.2.Value,some_value2)</onclick>
<
onclick>SetProperty(Dialog.3.Label,Test 3)</onclick>
<
onclick>SetProperty(Dialog.3.Value,some_value3)</onclick>
<
onclick>SetProperty(Dialog.4.Label,Test 4)</onclick>
<
onclick>SetProperty(Dialog.4.Value,some_value4)</onclick>
<
onclick>RunScript(script.extendedinfo,info=dialog)</onclick

would create a dialog like this:

Image

When the user clicks on a listitem then the string with name "Name_of_Skin_String" will be set to the value of the selected listitem.
This could also be extended to make use of thumbs, multiselect etc if needed.
This way skinners can make use of DialogSelect which can be very useful on some occasions for settings with more than 2 states. At the moment there is no good way for skinners to implement those type of buttons since also spincontrol cannot be used.
The same could be done for DialogOK and DialogYesNo for example.
I could also change it to a way that it uses script parameters instead of setting window properties, but that would get a bit messy probably when there are lot of options.
I don´t really need this myself since the skin I am workin on atm already has deep python integration so I don´t need a separate script for that, if it helps you guys to create more nice skins I´d still put some minutes in to get that stuff workin.
Opinions?
Reply
#3
That would need work in C++ and it would take ages for me to get it done in a proper way. In Python it just takes 5 minutes. Smile
EDIT: The other option would be RunScript(script.extendedinfo,info=dialog,header=Some Dialog Header,options=Label 1|value1||Label 2|value2[,some more])
and no, it doesnt support multiselect natively so it needs a bit more code in python, but still pretty easy to do.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#4
My bad, didn't look at your link so didn't realise you were using Python to extend the skinning engine to use Python Blush. I'll leave the suggestion for when (hopefully inevitably) this gets implemented in core.

Edit: Your edit is more readable to me, but only lets the skinner set the label and not the value (presumably purely because it's a quick idea, not something fully realised). Still, that's on the way to a better implementation for me Smile
Reply
#5
no, both possible, I just have to use different separators. ( | vs. || in the example, there are probably better ones)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#6
I'm going to blame sleep deprivation for not noticing that :p For me, that's a great implementation - providing the Python function in a way comparable to the Python method. However I, like you (just a hell of a lot less successfully Wink), merge Python and skins in my own endeavours, so this is probably a good time for more 'pure' skinners to weigh in Smile
Reply
#7
Hehe that´s what I always blame, too Smile
yes, exactly, this is aimed for skinners who do not get into Python themselves. I also started skinning without python some years ago so I think I have a pretty good overview about where the skinning engine is lacking and those multistate buttons always were a pain in the a**. (Example use case which is part of lot of skins: InfoPanel Mode with options [On,Off,delayed,manual]. Some skins were / are using 3 or 4 radiobuttons for that setting which completely clutters the UI)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#8
Count me in as very interested. I know very little to no Python and am always grateful for the scripts you guys make to help us improve our skins.
Reply
#9
Any opinion which way to set the dialog up is preferred? Setting properties or using script parameters?
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#10
Count me in too. I think script parameters are the most easy way to go.

IMO you should separate this from the extendedinfo script to a standalone script and add more skinning stuff like this. Spin controls is another one. If the available selected items are 3 - 4, spin controls (maybe with only one direction ?) are better than to open another window just to select one of the only three values available.

Cheers
Nessus
Reply
#11
you can already "fake" spincontrols by using pure xml.
Example:

Code:
<control type="button" id="1635">
                    <label>$LOCALIZE[31674]</label>
                    <label2>$INFO[Skin.String(TriPanelPosition)]</label2>
                    <include>ViewtypeSettingsButton</include>
                    <onclick condition="Stringcompare(Skin.String(TriPanelPosition),1)">Skin.SetString(TriPanelPosition,2)</onclick>
                    <onclick condition="Stringcompare(Skin.String(TriPanelPosition),4)">Skin.SetString(TriPanelPosition,1)</onclick>
                    <onclick condition="Stringcompare(Skin.String(TriPanelPosition),3)">Skin.SetString(TriPanelPosition,4)</onclick>
                    <onclick condition="Stringcompare(Skin.String(TriPanelPosition),2)">Skin.SetString(TriPanelPosition,3)</onclick>
                    <onclick condition="Stringcompare(Skin.String(TriPanelPosition),1)">Skin.SetString(TriPanelPosition,2)</onclick>
                </control>

Will see if it is worth it to expose "native" spincontrols to skinners. I´m not a big fan of them though, even for 3 items i would prefer a selectdialog.
(In general I don´t like buttons those more complex buttons. In my opinion pressing left/right/up/down should always move the focus to the next control)

I won´t create a separate add-on for one or two functions, but if more stuff like this is needed I will create a separate add-on.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#12
I think the SetProperty method is better. It is in line with other methods and the xml should be clean as possible.
It should stay as straight forward as possible for people who want to make some changes to their skin.

I'd love to see this extended to other dialog types. And as separate script for implementing 'higher' skinning functions.
Like a controlled way of using predefined python functions within the xml.
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#13
(2014-10-30, 17:27)phil65 Wrote: you can already "fake" spincontrols by using pure xml.
Will see if it is worth it to expose "native" spincontrols to skinners. I´m not a big fan of them though, even for 3 items i would prefer a selectdialog.
(In general I don´t like buttons those more complex buttons. In my opinion pressing left/right/up/down should always move the focus to the next control)

I won´t create a separate add-on for one or two functions, but if more stuff like this is needed I will create a separate add-on.
I am aware of the xml fake spin controls but they require a lot of click actions and stringcompares. If this can be done with lees code it will be much better. I agree with you about the left/right/up/down navigation logic that's why all my fake spin controls are coded only in one direction with no up/down arrows. Just a label changing every time you click. As for the separated addon, give it a little time (as more stuff added) and you will get there Big Grin


(2014-10-30, 22:16)MassIV Wrote: I think the SetProperty method is better. It is in line with other methods and the xml should be clean as possible.
It should stay as straight forward as possible for people who want to make some changes to their skin.
On second thought this makes more sense.


Cheers
Nessus
Reply
#14
(2014-10-30, 22:16)MassIV Wrote: I think the SetProperty method is better. It is in line with other methods and the xml should be clean as possible.
It should stay as straight forward as possible for people who want to make some changes to their skin.

I'd love to see this extended to other dialog types. And as separate script for implementing 'higher' skinning functions.
Like a controlled way of using predefined python functions within the xml.

yeah i used properties because it seemed more readable and therefore more suited to non-programmer skinners.
(from a programmer´s perspective it would be nicer to use script parameters, but I wouldn´t mind doing it the other way if skinners are more happy with it)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#15
Agreed, it's a lot easier to read.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 11
  •   



Logout Mark Read Team Forum Stats Members Help
script.toolbox2
This forum uses Lukasz Tkacz MyBB addons.