- # loading the picture image and getting some useful
- # information to draw it in the widget's background
- try:
- img = gtk.gdk.pixbuf_new_from_file(self.image)
- except gobject.GError:
- msg = _("Couldn't recognize the image file format.")
- dialog = gtk.MessageDialog(self.window,
- gtk.DIALOG_MODAL,
- gtk.MESSAGE_ERROR,
- gtk.BUTTONS_CLOSE)
- dialog.set_markup(msg)
- dialog.run()
- dialog.destroy()
-
- self.draw.stop_emission('expose-event')
- return self.unload_project()
-
- pixels = img.get_pixels()
- rowstride = img.get_rowstride()
- width = img.get_width()
- height = img.get_height()
- gc = draw.style.black_gc
-
- # sets the correct size of the eventbox, to show the scrollbar
- # when needed.
- self.evtbox.set_size_request(width, height)
-
- # drawing the picture in the background of the drawing area,
- # this is really important.
- draw.window.draw_rgb_image(gc, 0, 0, width, height,
- 'normal', pixels, rowstride,
- 0, 0)
-
- # this call makes the ball being drown be shown correctly.