From 7ce21d47bd7ac982a84bd1271ce259b7b7e0e59d Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 28 Feb 2007 15:41:00 -0500 Subject: [PATCH] Ensure video is realized before showing live video --- shell/intro/glive.py | 13 ++++++++++--- shell/intro/intro.py | 14 +++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/shell/intro/glive.py b/shell/intro/glive.py index b2126aa6..b573659d 100644 --- a/shell/intro/glive.py +++ b/shell/intro/glive.py @@ -148,14 +148,21 @@ class LiveVideoSlot(gtk.EventBox): gtk.EventBox.__init__(self) self.imagesink = None + self.playa = None + self._width = width + self._height = height + self.unset_flags(gtk.DOUBLE_BUFFERED) self.connect('focus-in-event', self.focus_in) self.connect('focus-out-event', self.focus_out) self.connect("button-press-event", self._button_press_event_cb) + self.connect("expose-event", self._expose_event_cb) - self.playa = Glive(self, width, height) - self.playa.connect('new-picture', self._new_picture_cb) - self.playa.connect('sink', self._new_sink_cb) + def _expose_event_cb(self, widget, event): + if not self.playa: + self.playa = Glive(self, self._width, self._height) + self.playa.connect('new-picture', self._new_picture_cb) + self.playa.connect('sink', self._new_sink_cb) def _new_picture_cb(self, playa, pixbuf): self.emit('pixbuf', pixbuf) diff --git a/shell/intro/intro.py b/shell/intro/intro.py index 327f0527..47d9b384 100644 --- a/shell/intro/intro.py +++ b/shell/intro/intro.py @@ -32,8 +32,8 @@ from sugar.graphics import iconbutton import colorpicker -_VIDEO_WIDTH = 320 -_VIDEO_HEIGHT = 240 +_VIDEO_WIDTH = 640 +_VIDEO_HEIGHT = 480 class IntroImage(gtk.EventBox): @@ -113,7 +113,7 @@ class VideoBox(hippo.CanvasBox, hippo.CanvasItem): self._video_widget = hippo.CanvasWidget() self._video_widget.props.widget = self._video self.append(self._video_widget) - self._video.play() + gobject.idle_add(self._video.play) self._img = IntroImage() self._img.set_size_request(_VIDEO_WIDTH, _VIDEO_HEIGHT) @@ -207,15 +207,15 @@ class IntroBox(hippo.CanvasBox, hippo.CanvasItem): self._video_box = VideoBox(xalign=hippo.ALIGNMENT_CENTER, yalign=hippo.ALIGNMENT_START, - padding_bottom=units.grid_to_pixels(1)) + padding_bottom=units.grid_to_pixels(0.5)) self.append(self._video_box) self._entry_box = EntryBox(xalign=hippo.ALIGNMENT_CENTER, - padding_bottom=units.grid_to_pixels(1)) + padding_bottom=units.grid_to_pixels(0.5)) self.append(self._entry_box) self._color_box = ColorBox(xalign=hippo.ALIGNMENT_CENTER, - padding_bottom=units.grid_to_pixels(1)) + padding_bottom=units.grid_to_pixels(0.5)) self.append(self._color_box) self._ok = iconbutton.IconButton(icon_name="theme:stock-forward", @@ -252,7 +252,7 @@ class IntroWindow(gtk.Window): self._intro_box.connect('ok', self._ok_cb) self._canvas.set_root(self._intro_box) self.add(self._canvas) - self._canvas.show() + self._canvas.show_all() def _ok_cb(self, widget, pixbuf, name, color): self.hide()