Why Do My ControlButtons gor inactive?
#1
hey all:

i realize i may need to post the script for the solution but i will do my best to describe:

i can select a controlbutton and the expected oncontrol is executed, then if i attempt to select the same or entirley different button, while there is an audible 'click' there is no action... even as simple as self.close()....

any ideas...

many thanks,
-tartag



Reply
#2
i'd say your code has some kind of bug preventing it from running the action twice. look at the code in oncontrol and see if you can find anything preventing it from happening. or try to comment that code part out first and put in a "pass" and see if you can click it twice then. good luck.
xbmcscripts.com administrator
Reply
#3
enderw:
thanks for the repsonse

here is the oncontrol:
Quote:if control == self.titlebtn:
self.getmymovieslst()
which calls:
Quote: def getmymovieslst(self):
dialog = xbmcgui.dialog()
progress = xbmcgui.dialogprogress()


try:

#open socket with page url
self.statlist.reset()
mymode = "fromxbmc"
rh_sock2 = urllib.urlopen(movieurl + mymode)
movie_html = rh_sock2.read()
rh_sock2.close()
moviesel = re.compile('<!--movie-->(.*?)<!--movie-->')
moviesel2 = moviesel.findall(movie_html)
movietitle = moviesel2
self.setfocus(self.titlebtn)
for info in movietitle:
title = info
if mode == "main":
titlevar = string.split(title, '||')
mtitle = titlevar[1]
mtag = titlevar[2]
mtitle2 = mtitle + "\n" + mtag
mid = titlevar[0] + ".jpg"
tcover = root + covers + mid
item = xbmcgui.listitem(label=mtitle2,thumbnailimage=tcover )
self.statlist.setitemheight( 100 )
self.statlist.setimagedimensions( 100, 100 )
self.statlist.additem( item )

except:
progress.close()
dialog.ok("sorry...","could not complete action")

unsure of how to debug this...
Reply
#4
take the progress.close() out of the except: or add another in the try:, it may not be closing properly.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#5
sweet, i'll give it a go...
Reply
#6
Wink 
nope, no dice...
Reply
#7
that progress.close() shouldn't be there as i can't see any progress.create() in your code. you can't close something that isn't created. other than that, try putting """ (yes, three " in a row) over the 'try:' and over the last dialog.ok line. then it should always display a dialog each time you press the button. if that doesn't work something else than this code is acting up...(if done correctly). i'm leaving for some days now, so good luck Smile

-edit-

like this:
Quote:def getmymovieslst(self):
      dialog = xbmcgui.dialog()
   progress = xbmcgui.dialogprogress()

"""
try:

#open socket with page url
self.statlist.reset()
mymode = "fromxbmc"
rh_sock2 = urllib.urlopen(movieurl + mymode)  
movie_html = rh_sock2.read()
rh_sock2.close()
moviesel = re.compile('<!--movie-->(.*?)<!--movie-->')
moviesel2 = moviesel.findall(movie_html)
movietitle = moviesel2
self.setfocus(self.titlebtn)
for info in movietitle:
title = info
if mode == "main":
   titlevar = string.split(title, '||')
mtitle = titlevar[1]
mtag = titlevar[2]
mtitle2 = mtitle + "\n" + mtag
mid = titlevar[0] + ".jpg"
tcover = root + covers + mid
item = xbmcgui.listitem(label=mtitle2,thumbnailimage=tcover )
self.statlist.setitemheight( 100 )
         self.statlist.setimagedimensions( 100, 100 )
self.statlist.additem( item )

except:
progress.close()
"""
dialog.ok("sorry...","could not complete action")

this way the code inbetween the """  isn't executed, but ignored instead. remember to edit indent accordingly.



xbmcscripts.com administrator
Reply
#8
you do get this behavior if you have a typo or dereference something that doesnt exist in python. basically the python engine crashes while the main xbmc gui code does not (thus you can still navigate but it wont do anything).

at this point i would comment out as much stuff as you can to avoid the error and slowly uncomment the code back in to see where the typo is.

try looking at your new code for a typo...
Reply
#9
okay so while not completly a typo, i belive i have at least identified the issue.  

on my main controls i have a button named "genre" when selected it creats a selectlist of the available genre's i can only assume that since it does not exist until the genre button is created it causes a "crash"...
Quote:     if control == self.genrebtn:
      self.getgenrelst()

calls
Quote:    def getgenrelst(self):
    self.genrelist = xbmcgui.controllist(90,240, 125, 150, "font13", space=0)
self.addcontrol(self.genrelist)
self.setfocus(self.genrelist)
self.genrelist.controlleft(self.titlebtn)
self.genrelist.additem("action")
self.genrelist.additem("adventure")
self.genrelist.additem("comedy")
self.genrelist.additem("crime")
self.genrelist.additem("documentary")
self.genrelist.additem("drama")
self.genrelist.additem("family")
self.genrelist.additem("fantasy")
self.genrelist.additem("horror")
self.genrelist.additem("music")
self.genrelist.additem("mystery")
self.genrelist.additem("romance")
self.genrelist.additem("sci-fi")
self.genrelist.additem("thriller")
self.genrelist.additem("war")  

in turn this is part of my oncontrol def:
Quote:     if control == self.genrelist:
    self.cleanup()
    self.getmymovieslst()

for troubleshooting i took any of the selectepostion stuff out...

really pretty stumped.

-tartag



Reply

Logout Mark Read Team Forum Stats Members Help
Why Do My ControlButtons gor inactive?0