Logo Search packages:      
Sourcecode: zim version File versions  Download package

def zim::gui::pageview::TextBuffer::insert_image (   self,
  iter,
  file,
  src,
  attrib 
)

Insert an image linked to file 'file' but showing 'src' as link to
the user.

Definition at line 552 of file pageview.py.

00552                                                        :
            '''Insert an image linked to file 'file' but showing 'src' as link to
            the user.
            '''
            #~ If there is a property 'alt' in attrib we try to set a tooltip.
            #~ '''
            if isinstance(file, basestring):
                  file = File(file)
            try:
                  if 'width' in attrib or 'height' in attrib:
                        w = int(attrib.get('width', -1))
                        h = int(attrib.get('height', -1))
                        pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(file.path, w, h)
                  else:
                        pixbuf = gtk.gdk.pixbuf_new_from_file(file.path)
            except:
                  #~ logger.exception('Could not load image: %s', file)
                  logger.warn('No such image: %s', file)
                  widget = gtk.HBox() # Need *some* widget here...
                  pixbuf = widget.render_icon(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_DIALOG)
                  pixbuf = pixbuf.copy() # need unique instance to set zim_attrib

            pixbuf.zim_type = 'image'
            pixbuf.zim_attrib = attrib
            pixbuf.zim_attrib['src'] = src
            pixbuf.zim_attrib['_src_file'] = file
            self.insert_pixbuf(iter, pixbuf)

      def insert_image_at_cursor(self, file, src, **attrib):


Generated by  Doxygen 1.6.0   Back to index