On Oct 13, 11:24 am, "Edward K. Ream" <[email protected]> wrote:
> Leo is actually very close to Prezi:
>
> Leo's clone-marked command creates, in effect, a Prezi path.
>
> We only need upgrade Leo's body pane to show pictures, web sites and
> videos. This can be done with QImage, QWebView and Qt.VideoWidget.
> Some of this is already in place.
The following @button nodes allow me to watch movies in the body pane!
The only problem is that the act of creating the phonon.VideoPlayer
causes Leo to crash on exit. Presumably it's a bug in phonon :-)
To use, create an @movie node with the filename in the body. Hit the
load-video button. Hit the play/pause button to pause and resume.
Hit the stop button to stop the video and show the body pane. Works
with music too.
@button load-video
QQQQQ
import PyQt4.phonon as phonon
phonon = phonon.Phonon
top = c.frame.top # A DynamicWindow
sw = top.stackedWidget # QStackedWidget
def run(p):
tag = '@movie'
if not g.match_word(p.h,0,tag):
return g.es('Not an %s node' % (tag))
if p.b.strip():
fn = p.b.strip()
else:
fn = p.h[len(tag):].strip()
path = g.os_path_finalize_join(g.app.loadDir,fn)
if not g.os_path_exists(path):
return g.es('Not found: %s' % (fn))
if hasattr(top,'video_player'):
vp = top.video_player
else:
# This call creates a big problem later.
top.video_player = vp =
phonon.VideoPlayer(phonon.VideoCategory)
g.es('created',vp)
vw = vp.videoWidget()
vp.load(phonon.MediaSource(path))
sw.addWidget(vw)
sw.setCurrentWidget(vw)
sw.show()
vp.play()
run(p)
QQQQQ
@button play pause
QQQQQ
top = c.frame.top
sw = top.stackedWidget
if hasattr(top,'video_player'):
vp = top.video_player
vw = vp.videoWidget()
sw.setCurrentWidget(vw)
sw.show()
if vp.isPlaying():
vp.pause()
else:
vp.play()
QQQQQ
@button stop
QQQQQ
top = c.frame.top
sw = top.stackedWidget
if hasattr(top,'video_player'):
top.video_player.stop()
sw.setCurrentWidget(top.text_page)
sw.show()
QQQQQ
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.