def _addResourcesCb(self, unused):
     uris = None
     chooser = gtk.FileChooserDialog(title = "Choose location", action = gtk.FILE_CHOOSER_ACTION_OPEN,
                                     buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                                gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT))
     chooser.set_select_multiple(True)
     try:
         pw = PreviewWidget(self.instance.app)
         chooser.set_preview_widget(pw)
         chooser.set_use_preview_label(False)
         chooser.connect('update-preview', pw.add_preview_request)
     except AttributeError:
         print "We must set the pythonpath"
     if chooser.run() == gtk.RESPONSE_ACCEPT:
         uris = chooser.get_filenames()
     chooser.destroy()
     if uris:
         self.instance.addToResources(uris)
         for uri in uris:
             try:
                 pixbuf = gtk.gdk.pixbuf_new_from_file(uri)
                 pixbuf = pixbuf.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR)
                 self.model.append([get_name_from_uri(uri), pixbuf, uri])
             except glib.GError:
                 self.model.append([get_name_from_uri(uri), None, uri])
                 pass
 def addImagesToResources(self, uris):
     node = self.tree.find("resources")
     if node == None:
         node = Element("resources")
         self.tree.append(node)
     for uri in uris:
         newNode = Element("resource", attrib =
                           {"name" : get_name_from_uri(uri),
                            "path" : uri})
         node.append(newNode)