OK, you won't be surprised to hear I'm a little baffled again. A quick update on what I've done:
- I created PageUp and PageDown buttons (panel control maybe a little advance for me at this stage);
- spent a long time trying to work out how to increment the page number, without it re-setting to 1 each time, but I think I've cracked that now by creating a page number variable (in function locate_image) when the first page loads, setting that as global and then increasing or decreasing it with eah button click, as follows:
Code:
class MyClass(xbmcgui.WindowXMLDialog):
def __init__( self, xmlFile, resourcePath ):
urllib.urlretrieve(locate_image(1)[0], create_file())
self.addControl = (xbmcgui.ControlImage(5, 10, 500, 650, create_file()))
def onClick(self, action):
page = locate_image()[2]
if action == 1001: # my button id for page down
page = page +1 # calls the global variable I set up
locate_image(page) # updates the global variable by sending parameter to the function
urllib.urlretrieve(locate_image(page)[0], create_file())
self.addControl = (xbmcgui.ControlImage(5, 10, 500, 650, create_file()))
print ('onClick returns: ', page)
Full code
here
So, now when I press the up or down button the new image is called and saved to my addon data folder, which I can check by opening the image in a picture viewer, and the log shows the changing calls:
Quote:NOTICE: ('image url is ', u'http://www.peachnote.com/rest/api/v0/image?sid=IMSLP49966&page=3&w=300')
NOTICE: ('image url is ', u'http://www.peachnote.com/rest/api/v0/image?sid=IMSLP49966&page=4&w=300')
Not sure if this is the correct way of doing this but it works to the point of overwriting the currently displayed image. Where I'm stuck is how to refresh the image in the window.xml to change the old image to the new one. Having overwritten the previous image it is still called "score.png", I just can't get the page to refresh to show the new version. I tried adding the command 'xbmc.executebuiltin('ReplaceWindow(3001)')' at the end of my def onClick function and the log says:
Quote:NOTICE: ('onClick returns: ', 4)
DEBUG: Activating window ID: 13001
DEBUG: ------ Window Deinit (custom1.xml) ------
DEBUG: ------ Window Init (custom1.xml) ------
but nothing actually changes in the window.
So, once again I turn to your wisdom to explain why this isn't working.
Thanks