windowXMLdialog questions.
#1
so I am attempting to make a custom notification dialog but I am running in to issues.
python:
class notify(xbmcgui.WindowDialog):
def __init__(self, *args, **kwargs):
#xbmc.executebuiltin('Container.SetViewMode(50)')
self.text = kwargs['txt']
self.note = xbmcgui.ControlLabel(x=0, y=0, width=800, height=250, label=self.text)
#self.note= self.getControl(100)
self.addControl(self.note)
This works but i want to use a custom xml file... so i used
python:
class notify(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
#xbmc.executebuiltin('Container.SetViewMode(50)')
self.text = kwargs['txt']
self.note = xbmcgui.ControlLabel(x=0, y=0, width=800, height=250, label=self.text)
#self.note= self.getControl(100)
self.addControl(self.note)

and i am calling it as
python:
window = d.notify('script-tbd-notification.xml', u.cwd, 'default', '1080i',txt='This is a Test')
window.show()
xbmc.sleep(5000)
window.close()

but using the above code does not work... can someone point me to a working example of window.xmldialog()

the xml file is
xml:
<?xml version="1.0" encoding="UTF-8"?>
<window>
<views>50</views>
<controls>
<control type="label" id="100">
<description>testing</description>
<onup>300</onup>
<ondown>200</ondown>
<!-- <onleft>100</onleft> -->
<!-- <onright>100</onright> -->
<width>800</width>
<top>90</top>
<left>60</left>
<height>250</height>
<visible>true</visible>
<align>left</align>
<wrapmultiline>true</wrapmultiline>
<font>font12</font>
<textoffsetx>50</textoffsetx>
<textcolor>FFFFFFFF</textcolor>
<focusedcolor>FFFFFFFF</focusedcolor>
<disabledcolor>80FFFFFF</disabledcolor>
<invalidcolor>FFFFFFFF</invalidcolor>
<label>Not ass cool</label>
</control>
</controls>
</window>
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#2
you're using code that belongs to the Window class: xbmcgui.ControlLabel(x=0, y=0, width=800, height=250, label=self.text)
such code can't be used when you're working with the WindowXML class.


python:
self.note = self.getControl(100)
self.note.setLabel(self.text)
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
I can not get it to work with just that ... and maybe I am miss understanding the window subclasses.

So what I want to do is define the type of control in the python code... and like making a skin I want to use the xml to style it.
I would like to do this for windows and dialogs.

And I may be wrong but self.getControl() is apart of the window class as well, I can make it show without the getcontrol but the problem is I can not style it as it has no id.

https://codedocs.xyz/xbmc/xbmc/group__py...9835092d65
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#4
(2018-06-12, 00:22)smitchell6879 Wrote: So what I want to do is define the type of control in the python code... and like making a skin I want to use the xml to style it.
you shouldn't define controls in python. with WindowXML you define your controls in your xml file and use python to modify them (such a changing the label text).

(2018-06-12, 00:22)smitchell6879 Wrote: And I may be wrong but self.getControl() is apart of the window class as well,
true, some methods are available in both the Window and the WindowXML class.
 
(2018-06-12, 00:22)smitchell6879 Wrote: I can make it show without the getcontrol but the problem is I can not style it as it has no id.
what do you mean 'it has no id'? your label has an id of 100 the code you've posted...
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
(2018-06-12, 00:22)smitchell6879 Wrote: I can make it show without the getcontrol but the problem is I can not style it as it has no id.
what do you mean 'it has no id'? your label has an id of 100 the code you've posted...
[/quote]

python:
class notify(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
xbmc.executebuiltin('Container.SetViewMode(50)')
self.text = kwargs['txt']
self.note = xbmcgui.ControlLabel(x=0, y=0, width=800, height=250, label=self.text)
self.addControl(self.note)
This is what works for me but does not have a id
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply
#6
Your label in the window xml has the id 100:
Code:
<control type="label" id="100">

So you can do things like this in python:
Code:
label_control = self.getControl(100)
label_control.setLabel('add text here')

Same with all other controls that you define in your window xml.

What will not work (afaik) is to define the basic layout of one button in the xml file and then add several buttons per python code. You need to design the complete window/dialog in xml and can just modify the existing controls in python. So if you want to have 5 buttons in your dialog, you will need 5 buttons in yor window xml, all with a different id.
Reply
#7
You can definitely mix and match. What you can't do is create a control in python and refer to it in the xml. At least that's how I have my custom xml setup.
Reply
#8
(2018-06-13, 00:29)angelblue05 Wrote: You can definitely mix and match. What you can't do is create a control in python and refer to it in the xml. At least that's how I have my custom xml setup.
This is annoyingly true and the only down side I have found using python for custom xml.
If only you could assign a id to a control created in python would be having cake and eating it too.

Thank you @angelblue05 for your help. I am not 4 windows deep and loving it.
Shield TV | Windows 10 | Mariadb | Mii Box
Evolve Ecosystem Repo | TV Melodies | Madnox Holiday Mod
Reply

Logout Mark Read Team Forum Stats Members Help
windowXMLdialog questions.0