# Python version of David Faure's <faure@kde.org> dcop presentation automation script for kpresenter
#
# Simon Hausmann <hausmann@kde.org>
from time import sleep
from dcop import *

app = DCOPApplication( "kpresenter" )

doc = app.KoApplicationIface.getDocuments()[0]
view = doc.firstView()

startAction = view.action( "screen_start" )

print "Starting Presentation %s" % doc.url()

startAction.activate()

sleep( 5 )

act = view.action( "screen_next" )
while startAction.enabled() == 0:
	sleep( 10 )
	if startAction.enabled() == 0:
	  act.activate()
	
print "Presentation finished."
