Custom dialog python

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
brodul Offline
Junior Member
Posts: 1
Joined: Feb 2012
Reputation: 0
Post: #1
Hi,

I want to add a custom dialog to my python script.
I found this howto: http://wiki.xbmc.org/index.php?title=HOW...a_skinning
So I know I have to create a file named custom<number>.xml.

But I don't know:
  • Where to put the file in the dir structure? (so that the custom dialog will be read)
  • How to call the dialog in python?
  • Which <id>s are valid, which are prefered (for a custom dialog)?

Txn

P.S.
I will add/update the wiki.
find quote
sphere Offline
Team-XBMC Member
Posts: 1,204
Joined: Jul 2009
Reputation: 50
Location: Germany
Post: #2
Hi,

you can name the xml file like you want. Common is something like "script-<addon_name>-main.xml". For your dialog I would use "script-<addon_name>-dialog.xml".

It should be placed in the path "<addon_dir>/resources/skins/Default/720p" to open it with:

Code:
Addon = xbmcaddon.Addon('<addon_id>')
__path__ = Addon.getAddonInfo('path')

gui = GUI('script-<addon_name>-main.xml', __path__, 'Default')
gui.doModal()
The first two lines are just to demonstrate how to get the path and could be done in a different way.

GUI has to be a python class which inherits from "xbmcgui.WindowXMLDialog".

You can have a look to my (not very good) demo script: https://github.com/dersphere/script.demo
But this is a full script - I think you want something to be returned from your dialog so its not a very good example.

Just have a look how other addon authors do something similar you need.

Regards,
sphere

My GitHub. My Add-ons:
[Image: IOoywq0.jpg]
find quote
paddycarey Offline
Senior Member
Posts: 246
Joined: Sep 2009
Reputation: 8
Post: #3
It depends what kind of dialog you need?

is it just to enable selection of something? display something? a complete custom skin for your addon?
find quote
yabsie Offline
Member
Posts: 57
Joined: Jan 2010
Reputation: 0
Location: Internet
Post: #4
(2012-03-06 13:04)sphere Wrote:  Hi,

Code:
Addon = xbmcaddon.Addon('<addon_id>')
__path__ = Addon.getAddonInfo('path')

gui = GUI('script-<addon_name>-main.xml', __path__, 'Default')
gui.doModal()
The first two lines are just to demonstrate how to get the path and could be done in a different way.

GUI has to be a python class which inherits from "xbmcgui.WindowXMLDialog".

I am trying to use this exampe to build a search dialog, collect the info and launch a query to load the list.

However when I do that, the progress bar appears over the dialogbox blocking it out. Do you know what I am doing wrong?
find quote
sphere Offline
Team-XBMC Member
Posts: 1,204
Joined: Jul 2009
Reputation: 50
Location: Germany
Post: #5
(2012-12-10 23:34)yabsie Wrote:  I am trying to use this exampe to build a search dialog, collect the info and launch a query to load the list.

However when I do that, the progress bar appears over the dialogbox blocking it out. Do you know what I am doing wrong?

Which XBMC Version? (Eden or Frodo (alpha, beta)?)
Which type of add-on/extension point, script or plugin?

It would be useful if you could upload your code (pastebin is fine).

My GitHub. My Add-ons:
[Image: IOoywq0.jpg]
find quote
yabsie Offline
Member
Posts: 57
Joined: Jan 2010
Reputation: 0
Location: Internet
Post: #6
(2012-12-11 00:02)sphere Wrote:  
(2012-12-10 23:34)yabsie Wrote:  I am trying to use this exampe to build a search dialog, collect the info and launch a query to load the list.

However when I do that, the progress bar appears over the dialogbox blocking it out. Do you know what I am doing wrong?

Which XBMC Version? (Eden or Frodo (alpha, beta)?)
Which type of add-on/extension point, script or plugin?

It would be useful if you could upload your code (pastebin is fine).
Eden, not tried with frodo,

I am trying to bring back the netflix plugin which was dead, its quite a large code base, and its currently in a stateof flux , I am happy to share the code with you , I have a verison on google code if you want to go that far.
svn checkout http://netflixbmc.googlecode.com/svn/trunk/ netflixbmc-read-only


Maybe I am doing this all wrong too. While I am a professional software developer, I am brand new to xbmc and python. I want to be able to define a bunch of search parameters (year, rating,mpaa etc ) and hit up the netflix api to find movies , but I cant seem to get this dialog working. I have spent a lot of free time, and the project is pretty easy if I can just get the interface to cooperate.
find quote