2013-09-21, 22:30
Hi, I've been building a skin/script combination that mostly just uses the home window (Home.xml) and occasionally uses a custom dialog. I've been using python scripts to gather data from an internet data source and setting window properties extensively to build lists, control views, and so forth. So far, so good.
Now I'm trying to build a login screen. Currently, the login view is just another custom view of the home window. I added some edit controls and then realized that python cannot read edit controls when they are instantiated from the window's xml files. So I got started on a small python script that runs when the view is selected to add the edit controls, in hopes of being able to read the username and password fields.
So here's my actual question: I see plenty of examples of how to add controls to a custom window that is entirely instantiated and controlled by python:
and I see plenty of examples of how to control lists and other attributes of an existing window
But I can't find an answer either way about if it's possible for python to add controls to an existing window.
I've tried this and it doesn't work, because the already instantiated and active window, 'win', doesn't already have an 'inputbox_username' attribute to assign anything to.
So, I'm guessing that once an xbmcgui window object has been instantiated (such as the Home.xml), then new controls cannot be added to that object. Is that right?
If there is some clever way to add controls to an existing xbmcgui window instance, I would love to hear it. Otherwise, I will probaby just draw a custom transparent dialog over the existing home window to contain and process the edit controls (or some other solution that I don't know about yet ;-)
Thanks!
Now I'm trying to build a login screen. Currently, the login view is just another custom view of the home window. I added some edit controls and then realized that python cannot read edit controls when they are instantiated from the window's xml files. So I got started on a small python script that runs when the view is selected to add the edit controls, in hopes of being able to read the username and password fields.
So here's my actual question: I see plenty of examples of how to add controls to a custom window that is entirely instantiated and controlled by python:
Code:
class MyClass(xbmcgui.Window):
self.list = xbmcgui.ControlList(200, 150, 300, 400)
self.addControl(self.list)
and I see plenty of examples of how to control lists and other attributes of an existing window
Code:
win = xbmcgui.Window(10000)
win.setProperty(mykey,myvalue)
category = win.getProperty(mykey)
But I can't find an answer either way about if it's possible for python to add controls to an existing window.
I've tried this and it doesn't work, because the already instantiated and active window, 'win', doesn't already have an 'inputbox_username' attribute to assign anything to.
Code:
win = xbmcgui.Window(10000)
win.inputbox_username = xbmcgui.ControlEdit(100, 250, 125, 75, 'Status', 'font16')
win.addControl(inputbox_username)
win.setFocus(inputbox_username)
So, I'm guessing that once an xbmcgui window object has been instantiated (such as the Home.xml), then new controls cannot be added to that object. Is that right?
If there is some clever way to add controls to an existing xbmcgui window instance, I would love to hear it. Otherwise, I will probaby just draw a custom transparent dialog over the existing home window to contain and process the edit controls (or some other solution that I don't know about yet ;-)
Thanks!