v16 getting my window id
#1
im trying to set window properties in python and grab them in xml, but its not working.
so i tried to confirm the window id by self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId()) and then xbmc.log and ive tried the debugging and all it says is home.xml. how can i define the window id?


default.py

class WindowXML(xbmcgui.WindowXML):

def onInit(self):
self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
self.window.setProperty('windowLabel', '')
self.window.setProperty('menu1', 'chiquita')
self.list_control = self.window.getControl(50)
self.games_list = {}

self.get_games_list()
pass
def get_games_list(self):
link = plugintools.openURL(gamesfile).replace('\n','').replace('\r','').replace('\t','')
match = re.compile('name="(.+?)".+?onsole="(.+?)".+?enre="(.+?)".+?rl="(.+?)".+?con="(.+?)".+?anart="(.+?)"').findall(link)
for name, console, genre, link, icon, fanart in match:
#self.games_list = {console: [(name,genre,link,icon)]}
self.list_control.addItem(xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=icon))

pass

def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
def onClick(self,controlID):
pass

def onFocus(self,controlID):
if controlID == 1001:
self.setProperty('menu1','yuppers')
elif controlID == 1002:
self.clearProperty('menu1')
pass

if __name__ == "__main__":
scriptDir = xbmcaddon.Addon('script.template').getAddonInfo('path')
sys.path.insert(0, os.path.join(scriptDir, 'resources', 'src'))
w = WindowXML("home.xml", scriptDir)
w.doModal()
del w
xbmc.log(str(xbmcgui.Window(xbmcgui.getCurrentWindowId())))


home.xml

<window>
<id>13001</id>
<defaultcontrol>1001</defaultcontrol>
<type>window</type>
<coordinates>
<system>1</system>
<posx>0</posx>
<posy>0</posy>
<views>50</views>
</coordinates>
</control>
<control type="grouplist" id="1000">
<description>Maine Menu</description>
<defaultcontrol>1001</defaultcontrol>
<left></left>
<top>80</top>
<width>1280</width>
<height>75</height>
<itemgap>25</itemgap>
<pagecontrol>25</pagecontrol>
<scrolltime tween="sine" easing="out">200</scrolltime>
<orientation>horizontal</orientation>
<usecontrolcoords>false</usecontrolcoords>
<visible>true</visible>
<onup></onup>
<ondown></ondown>
<onleft></onleft>
<onright></onright>
<align>center</align>
<animation effect="fade" time="200" condition="Skin.HasSetting(Animate_Skin)">WindowOpen</animation>
<animation effect="fade" time="200" condition="Skin.HasSetting(Animate_Skin)">WindowClose</animation>
<control type="button" id="1001">
<description>menu1</description>
<left>0</left>
<top>0</top>
<width>150</width>
<height>50</height>
<visible>true</visible>
<colordiffuse></colordiffuse>
<texturefocus colordiffuse="">menu-click.png</texturefocus>
<texturenofocus colordiffuse="">menu.png</texturenofocus>
<label>menu1</label>
<wrapmultiline>true</wrapmultiline>
<font>font12</font>
<textcolor></textcolor>
<focusedcolor></focusedcolor>
<disabledcolor></disabledcolor>
<invalidcolor></invalidcolor>
<align></align>
<aligny></aligny>
<textoffsetx></textoffsetx>
<textoffsety></textoffsety>
<pulseonselect></pulseonselect>
<onclick></onclick>
<onfocus></onfocus>
<onunfocus>-</onunfocus>
<onup>2</onup>
<ondown>50</ondown>
<onleft>1</onleft>
<onright>1</onright>
<aspectratio>keep</aspectratio>
</control>
<control type="button" id="1002">
<description>Backup</description>
<left>0</left>
<top>0</top>
<width>150</width>
<height>50</height>
<visible>true</visible>
<colordiffuse></colordiffuse>
<texturefocus colordiffuse="">Backup-clicked.png</texturefocus>
<texturenofocus colordiffuse="">Backup.png</texturenofocus>
<label></label>
<wrapmultiline>true</wrapmultiline>
<font>font12</font>
<textcolor></textcolor>
<focusedcolor></focusedcolor>
<disabledcolor></disabledcolor>
<invalidcolor></invalidcolor>
<align></align>
<aligny></aligny>
<textoffsetx></textoffsetx>
<textoffsety></textoffsety>
<pulseonselect></pulseonselect>
<onclick></onclick>
<onfocus></onfocus>
<onunfocus>-</onunfocus>
<onup>2</onup>
<ondown>3</ondown>
<onleft>1</onleft>
<onright>1</onright>
<aspectratio>keep</aspectratio>
</control>
<control type="wraplist" id="50">
<description>My first wraplist container</description>
<left>150</left>
<top>200</top>
<width>1280</width>
<height>440</height>
<visible>!IsEmpty(Window(3001).Property(menu1))</visible>
<onup>2</onup>
<ondown>3</ondown>
<onleft>1</onleft>
<onright>1</onright>
<viewtype label="3D list">list</viewtype>
<orientation>vertical</orientation>
<pagecontrol>25</pagecontrol>
<focusposition>5</focusposition>
<scrolltime tween="sine" easing="out">200</scrolltime>
<autoscroll>false</autoscroll>
<itemlayout width="600" height="29">
<control type="image">
<left></left>
<top></top>
<width>300</width>
<height>29</height>
<texture>buttons-normal.png</texture>
</control>
<!--control type="image">
<left>5</left>
<top>3</top>
<width>22</width>
<height>22</height>
<info>ListItem.Icon</info>
</control-->
<control type="label">
<left>30</left>
<top>3</top>
<width>250</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<selectedcolor>green</selectedcolor>
<align>left</align>
<info>ListItem.Label</info>
</control>
<!--control type="label">
<left>475</left>
<top>3</top>
<width>300</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<selectedcolor>green</selectedcolor>
<textcolor>grey</textcolor>
<align>right</align>
<info>ListItem.Label2</info>
</control-->
</itemlayout>
<focusedlayout height="29" width="600">
<control type="image">
<left></left>
<top></top>
<width>300</width>
<height>29</height>
<texture>buttons-active.png</texture>
</control>
<control type="image">
<width>30</width>
<height>30</height>
<left>0</left>
<top>0</top>
<visible>Control.HasFocus(50)</visible>
<texture>Arrow.png</texture>
</control>
<control type="image">
<left>300</left>
<top>-100</top>
<width>400</width>
<height>224</height>
<info>ListItem.Icon</info>
</control>
<control type="label">
<left>30</left>
<top>3</top>
<width>250</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<alignx>center</alignx>
<selectedcolor>green</selectedcolor>
<align>left</align>
<info>ListItem.Label</info>
</control>
<control type="label">
<left>475</left>
<top>3</top>
<width>300</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<selectedcolor>green</selectedcolor>
<textcolor>grey</textcolor>
<align>right</align>
<info>ListItem.Label2</info>
</control>
</focusedlayout>
</control>

</controls>

</window>
Reply
#2
you can't define window id's for python windows, they're assigned dynamically.

if you're setting window properties to your own window in python,
you can get them in xml using Window.Property(foo). you don't need to specify a window id here.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks for responding ronnie. Is there maybe some concepts i can learn that all of this is bassed off of. I dont understand the wiki. And id rather not bug with a thousand questions.
Reply
#4
for the skinning part, our wiki manual is pretty decent: http://kodi.wiki/view/Skinning_Manual

the kodi python documentation is located here: http://mirrors.xbmc.org/docs/python-docs...mcgui.html

it also wouldn't hurt to check out how other addons are doing it ;-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
Yeah im trying bro. Study as much as i can. Im in the skinning manual everyday. I learned some things from ur github. Hey, do u know a good list of example addons from the top of your head
Reply
#6
not really, i can only speak for the ones i'm maintaining.
perhaps have a look at the globalsearch addon?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#7
i want to make the label of my focused item, the label of a button outside my focusedlayout. how would i pull this information?
Reply
#8
or how do i set the property of the window based on focused item
Reply
#9
(2016-09-19, 12:09)Demonstratorz Wrote: i want to make the label of my focused item, the label of a button outside my focusedlayout. how would i pull this information?

you can use this in your skin for the button label:
$ INFO[Container (50).Listitem.Label]
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#10
thanks ive been sitting here for hours you are the man
Reply
#11
Quote:and how do i send this back to python for a boolean check?
disregard plz xbmc.getInfoLabel('Container(50).Listitem.Label2')
Reply

Logout Mark Read Team Forum Stats Members Help
getting my window id0