Add a default picture, so that we don't force people to find one.
Implementation is ugly but the cleanest I could come with :(
This commit is contained in:
parent
655e4018f2
commit
8ddaa516b3
@ -1,4 +1,7 @@
|
|||||||
confdir = $(pkgdatadir)
|
confdir = $(pkgdatadir)
|
||||||
conf_DATA = kbdconfig
|
conf_DATA = kbdconfig
|
||||||
|
|
||||||
EXTRA_DIST = $(conf_DATA)
|
imagedir = $(pkgdatadir)
|
||||||
|
image_DATA = default-picture.png
|
||||||
|
|
||||||
|
EXTRA_DIST = $(conf_DATA) $(image_DATA)
|
||||||
|
BIN
shell/data/default-picture.png
Normal file
BIN
shell/data/default-picture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -63,6 +63,7 @@ class IntroFallbackVideo(gtk.EventBox):
|
|||||||
self._image = gtk.Image()
|
self._image = gtk.Image()
|
||||||
self._image.set_from_stock(gtk.STOCK_OPEN, -1)
|
self._image.set_from_stock(gtk.STOCK_OPEN, -1)
|
||||||
self.add(self._image)
|
self.add(self._image)
|
||||||
|
self._image.show()
|
||||||
self.connect('button-press-event', self._button_press_event_cb)
|
self.connect('button-press-event', self._button_press_event_cb)
|
||||||
|
|
||||||
def play(self):
|
def play(self):
|
||||||
@ -80,12 +81,15 @@ class IntroFallbackVideo(gtk.EventBox):
|
|||||||
resp = chooser.run()
|
resp = chooser.run()
|
||||||
if resp == gtk.RESPONSE_ACCEPT:
|
if resp == gtk.RESPONSE_ACCEPT:
|
||||||
fname = chooser.get_filename()
|
fname = chooser.get_filename()
|
||||||
pixbuf = gtk.gdk.pixbuf_new_from_file(fname)
|
self.load_image(fname)
|
||||||
self.emit('pixbuf', pixbuf)
|
|
||||||
chooser.hide()
|
chooser.hide()
|
||||||
chooser.destroy()
|
chooser.destroy()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def load_image(self, path):
|
||||||
|
pixbuf = gtk.gdk.pixbuf_new_from_file(path)
|
||||||
|
self.emit('pixbuf', pixbuf)
|
||||||
|
|
||||||
class VideoBox(hippo.CanvasBox, hippo.CanvasItem):
|
class VideoBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||||
__gtype_name__ = "SugarVideoBox"
|
__gtype_name__ = "SugarVideoBox"
|
||||||
|
|
||||||
@ -138,6 +142,10 @@ class VideoBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
self._img_widget = hippo.CanvasWidget()
|
self._img_widget = hippo.CanvasWidget()
|
||||||
self._img_widget.props.widget = self._img
|
self._img_widget.props.widget = self._img
|
||||||
|
|
||||||
|
if not has_webcam:
|
||||||
|
path = os.path.join(env.get_data_dir(),'default-picture.png')
|
||||||
|
self._video.load_image(path)
|
||||||
|
|
||||||
def _clear_image_cb(self, widget, event):
|
def _clear_image_cb(self, widget, event):
|
||||||
del self._pixbuf
|
del self._pixbuf
|
||||||
self._pixbuf = None
|
self._pixbuf = None
|
||||||
|
Loading…
Reference in New Issue
Block a user