Ensure video is realized before showing live video

This commit is contained in:
Dan Williams 2007-02-28 15:41:00 -05:00
parent 748275ca00
commit 7ce21d47bd
2 changed files with 17 additions and 10 deletions

View File

@ -148,12 +148,19 @@ class LiveVideoSlot(gtk.EventBox):
gtk.EventBox.__init__(self) gtk.EventBox.__init__(self)
self.imagesink = None self.imagesink = None
self.playa = None
self._width = width
self._height = height
self.unset_flags(gtk.DOUBLE_BUFFERED) self.unset_flags(gtk.DOUBLE_BUFFERED)
self.connect('focus-in-event', self.focus_in) self.connect('focus-in-event', self.focus_in)
self.connect('focus-out-event', self.focus_out) self.connect('focus-out-event', self.focus_out)
self.connect("button-press-event", self._button_press_event_cb) self.connect("button-press-event", self._button_press_event_cb)
self.connect("expose-event", self._expose_event_cb)
self.playa = Glive(self, width, height) 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('new-picture', self._new_picture_cb)
self.playa.connect('sink', self._new_sink_cb) self.playa.connect('sink', self._new_sink_cb)

View File

@ -32,8 +32,8 @@ from sugar.graphics import iconbutton
import colorpicker import colorpicker
_VIDEO_WIDTH = 320 _VIDEO_WIDTH = 640
_VIDEO_HEIGHT = 240 _VIDEO_HEIGHT = 480
class IntroImage(gtk.EventBox): class IntroImage(gtk.EventBox):
@ -113,7 +113,7 @@ class VideoBox(hippo.CanvasBox, hippo.CanvasItem):
self._video_widget = hippo.CanvasWidget() self._video_widget = hippo.CanvasWidget()
self._video_widget.props.widget = self._video self._video_widget.props.widget = self._video
self.append(self._video_widget) self.append(self._video_widget)
self._video.play() gobject.idle_add(self._video.play)
self._img = IntroImage() self._img = IntroImage()
self._img.set_size_request(_VIDEO_WIDTH, _VIDEO_HEIGHT) 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, self._video_box = VideoBox(xalign=hippo.ALIGNMENT_CENTER,
yalign=hippo.ALIGNMENT_START, 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.append(self._video_box)
self._entry_box = EntryBox(xalign=hippo.ALIGNMENT_CENTER, 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.append(self._entry_box)
self._color_box = ColorBox(xalign=hippo.ALIGNMENT_CENTER, 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.append(self._color_box)
self._ok = iconbutton.IconButton(icon_name="theme:stock-forward", 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._intro_box.connect('ok', self._ok_cb)
self._canvas.set_root(self._intro_box) self._canvas.set_root(self._intro_box)
self.add(self._canvas) self.add(self._canvas)
self._canvas.show() self._canvas.show_all()
def _ok_cb(self, widget, pixbuf, name, color): def _ok_cb(self, widget, pixbuf, name, color):
self.hide() self.hide()