parameters: (self, img_path, trailing_chars="")
docstring: Insert Image in Buffer
docstring_summary: Insert Image in Buffer
docstring_tokens: Insert Image in Buffer
function: def insert_image(self, img_path, trailing_chars=""):
          """Insert Image in Buffer"""
          try:
              self.dad.statusbar.push(self.dad.statusbar_context_id, _("Downloading") + " %s ..." % img_path)
              while gtk.events_pending(): gtk.main_iteration()
              url_desc = urllib2.urlopen(img_path, timeout=3)
              image_file = url_desc.read()
              pixbuf_loader = gtk.gdk.PixbufLoader()
              pixbuf_loader.write(image_file)
              pixbuf_loader.close()
              pixbuf = pixbuf_loader.get_pixbuf()
              self.dad.xml_handler.pixbuf_element_to_xml([self.chars_counter, pixbuf, cons.TAG_PROP_LEFT], self.nodes_list[-1], self.dom)
              self.chars_counter += 1
              self.dad.statusbar.pop(self.dad.statusbar_context_id)
              if trailing_chars: self.rich_text_serialize(trailing_chars)
          except:
              if os.path.isfile(os.path.join(self.local_dir, img_path)):
                  pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(self.local_dir, img_path))
                  self.dad.xml_handler.pixbuf_element_to_xml([self.chars_counter, pixbuf, cons.TAG_PROP_LEFT], self.nodes_list[-1], self.dom)
                  self.chars_counter += 1
              else: print "failed download of", img_path
              self.dad.statusbar.pop(self.dad.statusbar_context_id)
function_tokens: def insert_image ( self , img_path , trailing_chars = "" ) : try : self . dad . statusbar . push ( self . dad . statusbar_context_id , _ ( "Downloading" ) + " %s ..." % img_path ) while gtk . events_pending ( ) : gtk . main_iteration ( ) url_desc = urllib2 . urlopen ( img_path , timeout = 3 ) image_file = url_desc . read ( ) pixbuf_loader = gtk . gdk . PixbufLoader ( ) pixbuf_loader . write ( image_file ) pixbuf_loader . close ( ) pixbuf = pixbuf_loader . get_pixbuf ( ) self . dad . xml_handler . pixbuf_element_to_xml ( [ self . chars_counter , pixbuf , cons . TAG_PROP_LEFT ] , self . nodes_list [ - 1 ] , self . dom ) self . chars_counter += 1 self . dad . statusbar . pop ( self . dad . statusbar_context_id ) if trailing_chars : self . rich_text_serialize ( trailing_chars ) except : if os . path . isfile ( os . path . join ( self . local_dir , img_path ) ) : pixbuf = gtk . gdk . pixbuf_new_from_file ( os . path . join ( self . local_dir , img_path ) ) self . dad . xml_handler . pixbuf_element_to_xml ( [ self . chars_counter , pixbuf , cons . TAG_PROP_LEFT ] , self . nodes_list [ - 1 ] , self . dom ) self . chars_counter += 1 else : print "failed download of" , img_path self . dad . statusbar . pop ( self . dad . statusbar_context_id )