XBMC Community Forum  

Go Back   XBMC Community Forum > Development > Plugin/Script (Python) Development

Plugin/Script (Python) Development Developers forum for XBMC Python Plugins/Scripts. Scripters/coders only!
Not for posting feature requests, bugs, or end-user support requests!

Reply
 
Thread Tools Search this Thread Display Modes
Old 2004-04-15, 10:35   #1
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

i have been trying to get a parent window to open a child window but for the life of me can't get it to work. either i get errors like "finally pops bad exception" or xbmc freezes. here is some stripped down code that causes xbmc to freeze (2004-04-13 build - didn't seem to include a new python dll though):

Quote:
import xbmcgui

class mainwin( xbmcgui.window ):
def ( self ):
xbmcgui.window.( self, 9990 )
self.addcontrol( xbmcgui.controlimage( \
0, 0, self.getwidth(), self.getheight(), \
'background.png' ) )
self.addcontrol( xbmcgui.controllabel( \
50, 30, 200, 20, "parent", 'font16', '0xffffffff' ) )

def onaction( self, action ):
try:
if action == 10:
self.close()
elif action == 7:
child = childwin()
child.domodal()
del child

except exception, ex:
traceback.print_exc()
xbmcgui.dialog().ok( "error", str(ex) )

class childwin( xbmcgui.window ):
def ( self ):
xbmcgui.window.( self, 9991 )
self.addcontrol( xbmcgui.controlimage( \
0, 0, self.getwidth(), self.getheight(), \
'background.png' ) )
self.addcontrol( xbmcgui.controllabel( \
50, 30, 200, 20, "child", 'font16', '0xffffffff' ) )

def onaction( self, action ):
try:
if action == 10:
self.close()

except exception, ex:
traceback.print_exc()
xbmcgui.dialog().ok( "error", str(ex) )

parent = mainwin()
parent.domodal()
del parent
if this worked the way i wanted it to, you should be able to open the child by pressing the 'select' button. then you can close the child window by pressing the 'previous menu' button. any ideas?

also, my windows are a bit more complex than this example. i kept getting errors like "an integer is required" when i had additional parameters to the window constructor. i'm guessing that python is expecting the window id to be passed after the self parameter. this is not necessarily true for new window classes derived from xbmcgui.window.

my workaround for this was to not have any parameters for the constructor and then call a method to initialize the window object after it was constructed. the other way should've worked as well but for some reason it didn't.

i also tried using show() and close() with a loop at the end of my script instead of domodal() but it didn't seem to make a difference...

oh, i should add that if i use xbmcgui.dialog() from the parent, it seems to work fine. so xbmcgui.dialog() must be doing something different than xbmcgui.window().
madtw is offline   Reply With Quote
Old 2004-04-15, 11:01   #2
ent
Member
 
Join Date: Mar 2004
Posts: 74
ent is on a distinguished road
Default

just out of curiosity madtw what are you exactly working on?
ent is offline   Reply With Quote
Old 2004-04-15, 14:35   #3
burriko
Senior Member
 
Join Date: Oct 2003
Posts: 199
burriko is on a distinguished road
Default

i found the same thing as you, madtw. what i did instead is to simply draw background.png over the top of everything so you get a fresh screen to draw on. once you've finished with it just removecontrol on everything you've drawn for the child window, including the new background.png to get back to the main window.
burriko is offline   Reply With Quote
Old 2004-04-15, 18:23   #4
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

i'm working on the python mythtv frontend. the parent window currently shows you all your recorded shows. the child window will show you the details of the recorded show, plus a screenshot of the show, and give you the option to watch the show, delete it, and maybe edit some of the properties (e.g. auto expire, etc.). i have communication with the mythbackend all sorted out for generating pixmaps, deleting a show, retrieving show info, etc..

i want to use the same idea for browsing the tv schedule... a parent window to display the schedule stored in the myth database and a child window when you select a program. you'll be able to specify if you want to record the program once, everytime on this channel, etc. much like the mythtv web interface.

burriko: thanks for the idea... i guess that'll work. it messes up all my classes but it sounds like a work around.
madtw is offline   Reply With Quote
Old 2004-04-15, 19:56   #5
b01
Senior Member
 
Join Date: Nov 2003
Location: Southfield, MI
Posts: 114
b01 is on a distinguished road
Send a message via AIM to b01
Default

you have to be clever, i want to create a file manager like in ava for xbmc with a parent window and about four child windows, but it was not neccessary.

what i plan to do is use a main window. then use image labels to represent the child windows, and use list and text labels to display the directory contents.
__________________
reading must be magical or something, it's how i find all da anwsers!
------
Ubuntu 8.10 (64bit) | AMD Sempron 2600+ | ATi 2400HD Pro | Asus AE1 Barebone ---- Ubuntu 9.04RC (64bit) | AMD 5000+ | BIOSTAR TA790GX XE w/ ATi 3300
b01 is offline   Reply With Quote
Old 2004-04-18, 18:00   #6
darkie
Team-XBMC Developer
 
Join Date: Sep 2003
Posts: 530
darkie is on a distinguished road
Default

Quote:
if this worked the way i wanted it to, you should be able to open the child by pressing the 'select' button. *then you can close the child window by pressing the 'previous menu' button. *any ideas?
i have an idea .
it was a nasty bug in the python sources but it is fixed now
btw, this is the code i used
Quote:
import xbmcgui

action_select_item * * * * * *= 7
action_previous_menu * * * *= 10

class mainwin(xbmcgui.window):
*def (self):
* *self.addcontrol( xbmcgui.controlimage(0, 0, self.getwidth(), self.getheight(), 'background.png' ))
* *self.addcontrol( xbmcgui.controllabel(50, 200, 200, 20, "parent", 'font16', '0xffffffff'))

*def onaction(self, action):
* *if action == action_previous_menu:
* * *self.close()
* *elif action == action_select_item:
* * *child = childwin()
* * *child.domodal()
* * *del child

class childwin(xbmcgui.window):
*def (self):
* *self.addcontrol(xbmcgui.controlimage(0, 0, self.getwidth(), self.getheight(), 'background.png'))
* *self.addcontrol(xbmcgui.controllabel(50, 200, 200, 20, "child", 'font16', '0xffffffff'))

*def onaction(self, action):
* *if action == action_previous_menu:
* * *self.close()

parent = mainwin()
parent.domodal()
del parent
edit:
just noticed that this board changed my code
def (self): should be def --init-- (self):



__________________
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.


darkie is offline   Reply With Quote
Old 2004-04-21, 06:40   #7
madtw
Senior Member
 
Join Date: Mar 2004
Posts: 174
madtw is on a distinguished road
Default

Quote:
Originally Posted by (darkie @ april 18 2004,09:00)
i have an idea .
it was a nasty bug in the python sources but it is fixed now
excellent... i was hoping it was just a bug.

guess i'm waiting for a new build of the python lib...
madtw is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple RSS? tomlangford XBMC for Xbox Specific Support 2 2005-10-12 06:39
Multiple rss feeds hannibol XBMC for Xbox Specific Support 1 2005-03-22 16:04
Smb with windows 2000 != windows xp ? rmariani XBMC for Xbox Specific Support 0 2004-10-30 02:58
Multiple subtitles Seren XBMC for Xbox Specific Support 1 2004-03-31 11:45
Multiple OGM subtitles Seren XBMC Feature Suggestions 1 1970-01-01 02:00


All times are GMT +2. The time now is 06:47.


Protected by Akismet, We recommend WordPress blogs
Copyright © 2008, XBMC Project