windowXML slide show
#1
Hi, I'm try to do a slide show of radar images that will loop seamlessly.

This works but is not seamless(annoying flicker between images) -
Code:
def __init__( self, *args, **kwargs ):
        xbmcgui.WindowXMLDialog.__init__( self )
        self.images = kwargs.get( "images" )
        
    def onInit(self):
        self.img = self.getControl(102)
        while xbmc.getCondVisibility('Window.IsActive(3000)') == 1:
            for i in self.images:
                self.img.setImage(i)
                xbmc.sleep(1000)

This is seamless but the images(on screen) don't loop -
Code:
def onInit(self):
        while xbmc.getCondVisibility('Window.IsActive(3000)') == 1:
            control = 100
            for i in range(len(self.images)):
                control += 1
                self.getControl(control).setImage(self.images[i])
                xbmc.sleep(1000)

Any ideas?
Thanks
Reply
#2
Think I found a solution -
Code:
def onInit(self):
        control = 100
        for i in range(len(self.images)):
            control += 1
            self.getControl(control).setImage(self.images[i])
            xbmc.sleep(1000)
            self.getControl(control).setVisible(False)
        while xbmc.getCondVisibility('Window.IsActive(3000)') == 1:
            control = 100
            for i in range(len(self.images)):
                control += 1
                self.getControl(control).setVisible(True)
                xbmc.sleep(1000)
                self.getControl(control).setVisible(False)

Any thoughts are welcome.
Reply
#3
Cinema Experience runs a WindowXML slideshow. We use a skin to provide the image layout with animation(fade in and fade out)

Reply
#4
Thanks for the hint! After playing with animations and viewing the Cinema Experience XMLs, I found that adding the <fadetime> element to the control with a small value(10) seems to work well.

For reference this is what I ended up with -
Code:
class GUI(xbmcgui.WindowXMLDialog):
    def __init__( self, *args, **kwargs ):
        xbmcgui.WindowXMLDialog.__init__( self )
        self.images = kwargs.get( "images" )

    def onInit(self):
        self.img = self.getControl(101)
        while xbmc.getCondVisibility('Window.IsActive(13000)') == 1:
            for i in range(len(self.images)):
                self.img.setImage(self.images[i])
                if i == (len(self.images)-1):
                    xbmc.sleep(5000)
                else:
                    xbmc.sleep(1000)

window.xml -
Code:
<window>
    <id>13000</id>
    <allowoverlay>false</allowoverlay>
    <defaultcontrol always="true">101</defaultcontrol>
    <controls>
        <control type="image" id=101>
            <posx>0</posx>
            <posy>0</posy>
            <width>1280</width>
            <height>720</height>
            <fadetime>10</fadetime>
        </control>
    </controls>
</window>

Reply
#5
i would use a multiimage if you don't need user input to control (eg speed up or slow down or pause)

PHP Code:
<control type="multiimage">
                    <
description>maps multiimage</description>
                    <
posx>-70</posx>
                    <
posy>40</posy>
                    <
width>720</width>
                    <
height>486</height>
                    <
imagepath>$INFO[Window.Property(MapsPath)]</imagepath>
                    <
timeperimage>500</timeperimage>
                    <
pauseatend>1000</pauseatend>
                    <
fadetime>0</fadetime>
                    <
randomize>false</randomize>
                    <
loop>yes</loop>
                    <
aspectratio>keep</aspectratio>
                    <
aligny>center</aligny>
                    <
animation effect="fade" time="200" start="100" end="15" condition="Control.HasFocus(5201) | Control.HasFocus(5202) | Control.HasFocus(5203) | ControlGroup(5100).HasFocus">Conditional</animation>
                    <
animation effect="zoom" reversible="true" center="325,360" start="100" end="117" time="100" condition="Skin.HasSetting(TWC.ZoomWeatherMap)">Conditional</animation>
                </
control
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
Thanks Nuka1195, I'll have to try this out. Is this documented anywhereHuh cause I didn't see it in any of the documentation that I found.
Reply
#7
I found some documentation on multiimage control here - http://wiki.xbmc.org/?title=MultiImage_Control . Unfortunately it doesn't seem to be available Huh
Code:
self.img = self.getControl(1)
RuntimeError: Unknown control type for python

Or am I doing something wrong?
Reply
#8
You don't need access to it. Just set property for the imagepath. This is what I used for the original weather plus script for animated apps.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#9
I must be missing something Huh This runs without any errors but no images are ever shown on screen.

Code:
<window>
    <controls>
        <control type="multiimage" id="1">
            <description>maps multiimage</description>
            <posx>0</posx>
            <posy>0</posy>
            <width>1280</width>
            <height>720</height>
            <imagepath>$INFO[Window.Property(MapsPath)]</imagepath>
            <timeperimage>1000</timeperimage>
            <pauseatend>3000</pauseatend>
            <fadetime>10</fadetime>
            <randomize>false</randomize>
            <loop>yes</loop>
            <aspectratio>keep</aspectratio>
            <aligny>center</aligny>
        </control>
    </controls>
</window>

Code:
image_path = 'C:\\temp_images\\Map_Doppler_Radar_600_Mile'
ACTION_PREVIOUS_MENU = (9, 10, 92, 216, 247, 257, 275, 61467, 61448)

class GUI(xbmcgui.WindowXMLDialog):
    def __init__( self, *args, **kwargs ):
        xbmcgui.WindowXMLDialog.__init__( self )
        self.path = kwargs.get( "path" )

    def onInit(self):
        # w = xbmcgui.Window(xbmcgui.getCurrentWindowId())
        # w.setProperty('MapsPath', self.path)
        self.setProperty('MapsPath', self.path)
        print 'Image Path: '+self.path
                    
    def onAction(self, action):
        # Same as normal python Windows.
        if action in ACTION_PREVIOUS_MENU:
            self.close()
        pass

    def onClick(self, controlID):
        """
            Notice: onClick not onControl
            Notice: it gives the ID of the control not the control object
        """
        pass

    def onFocus(self, controlID):
        pass
        
        
w = GUI('image_testing.xml', home, path=image_path)
w.doModal()
del w

Any ideas?
Reply
#10
there were some issues with setProperty that may have been fixed. i don't remember exactly the case, but i thought it had to do with setting a property on a dialog window actually being set on the main window below instead.

try switching your gui to a full window or make sure the posx and posy and width and height are inside your window.

you can also try putting a label on your dialog with <label>$INFO[Window.Property(MapsPath)]</label> as the label to make sure it's being set. maybe even a label with <label>$INFO[Window(id#).Property(MapsPath)]</label> where id# is the window below your dialog.

maybe try
PHP Code:
xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
w.setProperty('MapsPath'self.path

this may still be an issue with xbmc.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#11
I just tested. your code as written does not set the property on the dialog window or window.property does not work on dialogs? i need to test more, but there is a problem with xbmc.
PHP Code:
xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
w.setProperty('MapsPath'self.path

will work since yours is a dialog, wht self.setProperty() does not work, i don't know, but it should. maybe jfcaroll could look at it.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#12
self.setProperty() does not work on a full window either.
from what i can tell, self.setProperty() actually sets the property on the media lists and not the window, for windowXML windows.

so either that would need to change or you'll need to use the above example. or just use the weather window when setting and getting properties, that's what i did since its weather related.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#13
Thanks for your help! This seems to be working so far -
Code:
class GUI(xbmcgui.WindowXML):
    def __init__( self, *args, **kwargs ):
        xbmcgui.WindowXML.__init__( self )
        self.path = kwargs.get( "path" )

    def onInit(self):
        w = xbmcgui.Window(xbmcgui.getCurrentWindowId())
        w.setProperty('MapsPath', self.path)
Reply
#14
While the above seemed to work (on Windows) with Eden and Frodo b1 from a add-on script, when launched from a plugin or even executebuiltin(runScript) with Frodo, bad things would happen, xbmc crash soon after closing the window or something to that effect.

So I've gone back to using Dialog and adding an <id> element to the window. This works well on Windows but with Ubuntu it runs error free but nothing is ever shown on screen Confused .

Code:
class GUI(xbmcgui.WindowXMLDialog):
    def __init__( self, *args, **kwargs ):
        xbmcgui.WindowXMLDialog.__init__( self )
        self.path = kwargs.get( "path" )

    def onInit(self):
        w = xbmcgui.Window(13000)
        w.setProperty('MapsPath', self.path)
        print_window_info()

def print_window_info():
        print '########### Window Info ########################'
        print 'Window Dialog ID: %s' %xbmcgui.getCurrentWindowDialogId()
        print 'Window ID: %s' %xbmcgui.getCurrentWindowId()
        try:
            win = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
            print 'Window Property MapsPath: %s' %win.getProperty('MapsPath')
        except RuntimeError:
            pass
        print '################################################'


13:12:43 T:139766490199808  NOTICE: ########### Window Info ########################
13:12:43 T:139766490199808  NOTICE: Window Dialog ID: 13000
13:12:43 T:139766490199808  NOTICE: Window ID: 10025
13:12:43 T:139766490199808  NOTICE: Window Property MapsPath: /home/xbmc/.xbmc/userdata/addon_data/plugin.video.weather.channel/temp_images/Map_Doppler_Radar_300_Mile
13:12:43 T:139766490199808  NOTICE: ################################################

Any idea why it's not working with Ubuntu ??
Reply

Logout Mark Read Team Forum Stats Members Help
windowXML slide show0