[WIP-Alpha] Skinners: Shortcuts Script

Discussion and development of skins for XBMC4XBOX
Post Reply
User avatar
Dom DXecutioner
Posts: 585
Joined: Thu Jul 05, 2012 11:59 pm
Location: California
Has thanked: 249 times
Been thanked: 216 times
Contact:

[WIP-Alpha] Skinners: Shortcuts Script

Post by Dom DXecutioner »

PURPOSE

To assist in making shortcuts to addons a bit easier, faster and - hopefully - less code... thats the idea anyway. :)

TO DO
- add a reset option (made some changes and forgot to added; too lazy and go back)
- add playlist support
- add emulators support
- i'm sure something else will come along...

HOW DOES IT WORK

The scripts does the following:
- "subclasses" the DialogSelect.xml
*in lames term, it uses the DialogSelect.xml (you can download it from https://www.mediafire.com/?dffrxd7vxnwb273) window and utilizes the list container with ID 6; all that needs to be done is use the XML file from mainline xbmc... it provides the "exact" same functionality
*to clarify, for any other skin that has not been updated, you will need a container with ID 6; the following will be available:
  • listItem.Property(Addon.ID)
  • listItem.Property(Addon.Name)
  • listItem.Property(Addon.Version)
  • listItem.Property(Addon.Creator)
  • listItem.Property(Addon.Icon)
  • listItem.Property(Addon.Summary)
  • listItem.Property(Addon.Description)
  • listItem.Property(Addon.Path)
  • listItem.Property(Addon.Fanart_Image)
- opens the window with the type of addon to select from, i.e., Video, Audio, Pictures, Programs, Scripts
- scans and reads all of the addon.xml for the appropriate info, i.e., title, version, description, etc
- when selecting the addon, it automatically sets the following skin strings, where "fo" is the id for the shortcut:
  • Skin.Shortcut.Title.fo (addon title)
  • Skin.Shortcut.Icon.fo (addon default icon - default.tbn or icon.png)
  • Skin.Shortcut.Path.fo (addon preformatted path)
  • Skin.Shortcut.Enabled.fo (addon enabled for conditional visibility- True or False)
Download: https://www.mediafire.com/?dffrxd7vxnwb273

HOW TO USE IT

Place the script in the skin's script folder...

To setup a shortcut you can call the addon from a buttons on click event, example:

Code: Select all

<onclick>Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,1)</onclick>
Using conditional onclick, you can use the following:

Code: Select all

<!-- run the script if the current shortcut id has not been enabled -->
<onclick condition="!Skin.HasSetting(skin.shortcut.Enabled.1)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,1)</onclick>
<!-- run the addon if the current shortcut id is enabled (has already been setup) -->
<onclick condition="Skin.HasSetting(skin.shortcut.Enabled.1)">$INFO[Skin.String(skin.shortcut.path.1)]</onclick>
To get the icon into an image control, use the following:

Code: Select all

<texture background="false">$INFO[Skin.String(Skin.Shortcut.Icon.1)]</texture>
To get the text into a label control, use the following:

Code: Select all

<label fallback="Configure 01">$INFO[Skin.String(Skin.Shortcut.Title.1)]</label>
To make a shortcut visible based on the shortcut being setup (enabled), used the following:

Code: Select all

<visible>Skin.HasSetting(skin.shortcut.Enabled.1)</visible>
TIPS

If you wish to allow any shortcuts that have not been yet setup, you can use a boolean setting to allow visibility; you can extend this to also re-setup all shortcuts (controls), whether they have been setup or otherwise... All you have to do is add a radiobutton/togglebutton control to enable/disable a configuration type of option...

Code: Select all

<!-- allow all controls to be visible if the user has enabled the "shortcuts" configuration mode -->
<visible>Skin.HasSetting(skin.shortcut.Configure)</visible>
In the radiobutton/togglebutton, you can use the following:

Code: Select all

<selected>Skin.HasSetting(Setting.Shortcuts.Configure)</selected>
<onclick>Skin.ToggleSetting(Setting.Shortcuts.Configure)</onclick>
EXAMPLE
If you're brave, in line #757, add the code below to the IncludesHomeRecentlyAdded.xml of your Confluence Lite skin; I strongly recommend saving a copy, just in case...

The code will allow a container to be visible when you have the focus on the programs section; navigate to the shortcut and press select to display and choose an addon.

Code: Select all

<control type="group">			<!-- shortcuts -->
	<posx>240</posx>
	<posy>50</posy>
	<visible>Container(9000).Hasfocus(1)</visible> 
	<include>VisibleFadeEffect</include>
		<control type="label">
			<description>Title label</description>
			<posx>160</posx>
			<posy>220</posy>
			<height>20</height>
			<width>480</width>
			<label>Shortcuts</label>
			<align>center</align>
			<aligny>center</aligny>
			<font>font12_title</font>
			<textcolor>white</textcolor>
			<shadowcolor>black</shadowcolor>
		</control>
		<control type="list" id="8003">
			<animation effect="slide" start="0,0" end="100,0" time="0" condition="StringCompare(Container(8003).NumItems,3)">conditional</animation>
			<animation effect="slide" start="0,0" end="200,0" time="0" condition="StringCompare(Container(8003).NumItems,2)">conditional</animation>
			<animation effect="slide" start="0,0" end="300,0" time="0" condition="StringCompare(Container(8003).NumItems,1)">conditional</animation> 
			<posx>0</posx>
			<posy>0</posy>
			<width>800</width>
			<height>240</height>
			<onleft>8002</onleft>
			<onright>8002</onright>
			<onup>20</onup>
			<ondown>610</ondown>
			<viewtype label="535">list</viewtype>
			<pagecontrol>-</pagecontrol>
			<scrolltime>200</scrolltime>
			<orientation>Horizontal</orientation>
				<itemlayout height="220" width="200">
					<control type="image">
						<description>background</description>
						<posx>0</posx>
						<posy>0</posy>
						<width>200</width>
						<height>220</height>
						<texture border="15">RecentAddedBack.png</texture>
					</control>
					<control type="image">
						<posx>10</posx>
						<posy>10</posy>
						<width>180</width>
						<height>155</height>
						<aspectratio>keep</aspectratio>
						<texture background="true">$INFO[ListItem.Icon]</texture>
						<bordertexture border="5">button-nofocus.png</bordertexture>
						<bordersize>5</bordersize>
					</control>
					<control type="label">
						<posx>100</posx>
						<posy>170</posy>
						<width>180</width>
						<height>20</height>
						<font>font10</font>
						<textcolor>grey2</textcolor>
						<shadowcolor>black</shadowcolor>
						<selectedcolor>selected</selectedcolor>
						<align>center</align>
						<aligny>center</aligny>
						<label>$INFO[ListItem.Label2]</label>
					</control>
					<control type="label">
						<posx>100</posx>
						<posy>190</posy>
						<width>180</width>
						<height>20</height>
						<font>font12</font>
						<textcolor>white</textcolor>
						<shadowcolor>black</shadowcolor>
						<selectedcolor>selected</selectedcolor>
						<align>center</align>
						<aligny>center</aligny>
						<label>$INFO[ListItem.Label]</label>
					</control>
				</itemlayout>
				<focusedlayout height="220" width="200">
					<control type="image">
						<description>background</description>
						<posx>0</posx>
						<posy>0</posy>
						<width>200</width>
						<height>220</height>
						<texture border="15">RecentAddedBack.png</texture>
					</control>
					<control type="image">
						<posx>10</posx>
						<posy>10</posy>
						<width>180</width>
						<height>155</height>
						<aspectratio>keep</aspectratio>
						<texture background="true">$INFO[ListItem.Icon]</texture>
						<bordertexture border="5">folder-focus.png</bordertexture>
						<bordersize>5</bordersize>
						<visible>Control.HasFocus(8003)</visible>
					</control>
					<control type="image">
						<posx>10</posx>
						<posy>10</posy>
						<width>180</width>
						<height>155</height>
						<aspectratio>keep</aspectratio>
						<texture background="true">$INFO[ListItem.Icon]</texture>
						<bordertexture border="5">button-nofocus.png</bordertexture>
						<bordersize>5</bordersize>
						<visible>!Control.HasFocus(8003)</visible>
					</control>
					<control type="label">
						<posx>100</posx>
						<posy>170</posy>
						<width>180</width>
						<height>20</height>
						<font>font10</font>
						<textcolor>grey2</textcolor>
						<shadowcolor>black</shadowcolor>
						<selectedcolor>selected</selectedcolor>
						<align>center</align>
						<aligny>center</aligny>
						<label>$INFO[ListItem.Label2]</label>
					</control>
					<control type="label">
						<posx>100</posx>
						<posy>190</posy>
						<width>180</width>
						<height>20</height>
						<font>font12</font>
						<textcolor>white</textcolor>
						<shadowcolor>black</shadowcolor>
						<selectedcolor>selected</selectedcolor>
						<align>center</align>
						<aligny>center</aligny>
						<label>$INFO[ListItem.Label]</label>
					</control>
					<control type="label">
						<posx>100</posx>
						<posy>190</posy>
						<width>180</width>
						<height>20</height>
						<font>font12</font>
						<textcolor>blue</textcolor>
						<selectedcolor>selected</selectedcolor>
						<align>center</align>
						<aligny>center</aligny>
						<label>$INFO[ListItem.Label]</label>
						<visible>Control.HasFocus(8002)</visible>
					</control>
				</focusedlayout>
				<content>
					<item>
						<label fallback="Configure 01">$INFO[Skin.String(Skin.Shortcut.Title.1)]</label>
						<label2>Shortcut 01</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.1)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,1)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.1)">$INFO[Skin.String(Skin.Shortcut.Path.1)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.1)]</thumb>
					</item>
					<item>
						<label fallback="Configure 02">$INFO[Skin.String(Skin.Shortcut.Title.2)]</label>
						<label2>Shortcut 02</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.2)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,2)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.2)">$INFO[Skin.String(Skin.Shortcut.Path.2)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.2)]</thumb>
					</item>
					<item>
						<label fallback="Configure 03">$INFO[Skin.String(Skin.Shortcut.Title.3)]</label>
						<label2>Shortcut 03</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.3)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,3)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.3)">$INFO[Skin.String(Skin.Shortcut.Path.3)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.3)]</thumb>
					</item>
					<item>
						<label fallback="Configure 04">$INFO[Skin.String(Skin.Shortcut.Title.4)]</label>
						<label2>Shortcut 04</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.4)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,4)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.4)">$INFO[Skin.String(Skin.Shortcut.Path.4)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.4)]</thumb>
					</item>
					<item>
						<label fallback="Configure 05">$INFO[Skin.String(Skin.Shortcut.Title.5)]</label>
						<label2>Shortcut 05</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.5)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,5)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.5)">$INFO[Skin.String(Skin.Shortcut.Path.5)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.5)]</thumb>
					</item>
					<item>
						<label fallback="Configure 06">$INFO[Skin.String(Skin.Shortcut.Title.6)]</label>
						<label2>Shortcut 06</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.6)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,6)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.6)">$INFO[Skin.String(Skin.Shortcut.Path.6)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.6)]</thumb>
					</item>
					<item>
						<label fallback="Configure 07">$INFO[Skin.String(Skin.Shortcut.Title.7)]</label>
						<label2>Shortcut 07</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.7)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,7)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.7)">$INFO[Skin.String(Skin.Shortcut.Path.7)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.7)]</thumb>
					</item>
					<item>
						<label fallback="Configure 08">$INFO[Skin.String(Skin.Shortcut.Title.8)]</label>
						<label2>Shortcut 08</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.8)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,8)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.8)">$INFO[Skin.String(Skin.Shortcut.Path.8)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.8)]</thumb>
					</item>
					<item>
						<label fallback="Configure 09">$INFO[Skin.String(Skin.Shortcut.Title.9)]</label>
						<label2>Shortcut 09</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.9)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,9)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.9)">$INFO[Skin.String(Skin.Shortcut.Path.9)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.9)]</thumb>
					</item>
					<item>
						<label fallback="Configure 10">$INFO[Skin.String(Skin.Shortcut.Title.10)]</label>
						<label2>Shortcut 10</label2>
						<onclick condition="!Skin.HasSetting(Skin.Shortcut.Enabled.10)">Xbmc.RunScript(special://skin/scripts/script.skin.shortcuts.py,10)</onclick>
						<onclick condition="Skin.HasSetting(Skin.Shortcut.Enabled.10)">$INFO[Skin.String(Skin.Shortcut.Path.10)]</onclick>
						<icon>defaultFolder.png</icon>
						<thumb>$INFO[Skin.String(Skin.Shortcut.Icon.10)]</thumb>
					</item>
				</content>					
		</control>
		<control type="button">
			<description>left Arrow</description>
			<posx>-40</posx>
			<posy>90</posy>
			<width>30</width>
			<height>40</height>
			<texturefocus>arrow-big-left.png</texturefocus>
			<texturenofocus>arrow-big-left.png</texturenofocus>
			<onclick>Control.Move(8002,-1)</onclick>
			<visible>Control.HasFocus(8002) + Container(8002).HasPrevious</visible>
			<include>VisibleFadeEffect</include>
		</control>
		<control type="button">
			<description>right Arrow</description>
			<posx>810</posx>
			<posy>90</posy>
			<width>30</width>
			<height>40</height>
			<texturefocus>arrow-big-right.png</texturefocus>
			<texturenofocus>arrow-big-right.png</texturenofocus>
			<onclick>Control.Move(8002,1)</onclick>
			<visible>Control.HasFocus(8002) + Container(8002).HasNext</visible>
			<include>VisibleFadeEffect</include>
		</control>				
</control>
Attachments
screenshot001.jpg
screenshot002.jpg
screenshot003.jpg
screenshot004.jpg
Image
fxmech
Posts: 673
Joined: Wed Aug 01, 2012 9:15 am
Has thanked: 37 times
Been thanked: 46 times

Re: [WIP-Alpha] Skinners: Shortcuts Script

Post by fxmech »

Dom, excellent contribution. :)

You just made every skin way cooler in every way.

For Rapier Clarity Mod and Transparency skins this was emulated by creating a shortcut to a favorite (then for good measure deleting the favorite used for the shortcut). Now that this cuts straight to the point, how about adding "favorites" to the list of TO DO? Basically so we can have shortcuts to within an addon.

Links to programs/apps and emulators are the same task, I think?
Post Reply