GUI question, adding elements to existing gui.
#1
Just started yesterday on learning how to create a xbmc addon. The addon itself is fairly simple, but i have one question regarding gui.

is it possible for mye "script.mymediadb" addon to display buttons on top of the info bar (press i during playback)? and how would one go about achieving this?

What im trying to achieve is to add a couple of image buttons that when invoked calls a function in my addon, and then updates the view when done.
Reply
#2
It's generally not advised to do this, but with that said you can do it. You need to grab the window (by it's id) then call addControl on it to add your controls.

Note that this may or may not cause issues - depending exactly on what you add.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Is there any documentation describing the different windows and their id's?

Or how would i go about finding the id of the window in question? random guessing?
Reply
#4
The skinning manual on the wiki contains 'em all. You're wanting FullScreenInfo I think?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
http://wiki.xbmc.org/index.php?title=Lis...n_Controls
Reply
#6
netbrain,

I'm trying to do similar things. Let me know how you get on!

theDeadman
Reply
#7
Will do, for now i have figured out how to add elements to existing windows.

Here is an example.

i = xbmcgui.ControlButton(100, 250, 200, 50, 'Test', font='font14')
window = xbmcgui.Window(10142)
window.addControl(i)

will add a button to the window with id 10142. However, the button dissapears from the window after closing the window and then opening it again. don't know why tho.
Reply
#8
Sad 
As far as i can tell, it is impossible to do anything useful by adding gui elements in a programmatic fashion. For example, if i add a button to a window, there is no way i can actually assign an action to be performed when the button is clicked.

The skinning xml files has properties like "onclick", but this isn't a property i can set myself through python.

If i want to add buttons to the gui, i probably have to make my own skin. Eek
Reply
#9
Correct - you can't set the onclick property, and given that your script isn't running permanently (I presume) you probably won't be able to pick up the onClick event.

I wonder whether it may be useful for python to be able to create a control by specifying the XML block instead - this would give all properties available to the skinner, at the "cost" of you generating the XML (though I presume you can easily just have a separate XML file for it, or a string XML element in your code.

Thoughts?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#10
Actually my script is running as a service, continuously.

Anyway, what really should be incorporated into xbmc is more of the MVC design principles. For example, i should be able to attach an event listener to any gui component. Something along the lines of this:

someButton = getAnExistingButtionWithID('1234')
myActionListener = MyActionListsener()
someButton.addActionListener(myActionListener)

and then when some kind of event occurs on someButton, then it would pass the event along to every listener added to the button.

The same goes for the VideoPlayer.isVideoPlaying() (unsure if this is the correct method name). A common use for this method is to:
loop forever, then check if a video is playing, if it is, then do something, if not, then sleep for x seconds. A better solution would be the listener interface from the MVC design principles. Where one can register an event listener, and then it is VideoPlayer's responsibility to fire off the isPlayingVideo event.

However, for the addition of new gui elements, i have to agree with you. there should be some sort of way to extend or hook into gui elements. For example defining your own gui elements in an xml file, then fetch them through some api.

xbmcaddon.getControl('someId')

and then wire the gui elements to existing Windows and ControlGroups. Exactly how this should work probably needs to be evaluated by someone with a lot more xbmc GUI experience than me Smile But anyways, my two cents.
Reply
#11
Would it not be simpler in the short term to add the facility for us to add onclick / onfocus actions to buttons / list items etc from Python?

To do this would immediately open doors to the skinner / scripting community to experiment much more with the general XBMC GUI experience without the need to bother the main dev team with constant feature requests :-) In terms of the future development of XBMC as a usable integrated media centre experience, surely this can only be a good thing!?

Having said that, i've raised this issue both in another thread and on TRAC (http://trac.xbmc.org/ticket/11294) with little in the way of response, leading me to suspect that I'm getting something fundamentally wrong with the way XBMC works, and the nature of the XBMC GUI / Python relationship. Some clarity on this would be appreciated, lest I waste any more time chasing my own tail!

Cheers,
theDeadman.
Reply
#12
Anybody?

Can't help thinking I'm talking to myself ATM. If someone could at least let me know that I'm not chasing the impossible?
Reply
#13
I've replied to your trac ticket. What you're attempting is troublesome, depending on exactly where and how you're planning to do it.

Basically XBMC has full control over media windows - you should not attempt to alter these in any way (and ideally XBMC shouldn't allow you to).

If you own the window, then you can do whatever you like.

If the skin passes information in to you specifically for you to fill a static container, then using setStaticContent is the way to go.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#14
Thanks jMarshall,

I'll be good :-)

theDeadMan.
Reply

Logout Mark Read Team Forum Stats Members Help
GUI question, adding elements to existing gui.0