def on_treeview_row_activated(self, treeview, path, column): (model, iter) = treeview.get_selection().get_selected() filename = model.get(iter, 1)[0] application = gnomevfs.mime_get_default_application( gnomevfs.get_mime_type(gnomevfs.make_uri_from_input(filename))) if application: subprocess.Popen(str.split(application[2]) + [filename])
def __action_invoked(self, notification, action): """Called when buttons in the notification is pressed.""" if action == "file": uri = gnomevfs.make_uri_from_input_with_dirs(self.download.file, 2) gnomevfs.url_show(uri) elif action == "folder": uri = gnomevfs.make_uri_from_input(self.download.path) gnomevfs.url_show(uri) notification.close()
def get_icon (self): #try thumnailer first icon_factory = gnome.ui.ThumbnailFactory(gnome.ui.THUMBNAIL_SIZE_NORMAL) mtime = os.path.getmtime(self.path) uri = gnomevfs.make_uri_from_input(self.path) thumb = icon_factory.lookup (uri, mtime) if thumb: return gtk.gdk.pixbuf_new_from_file (thumb) thumb = icon_factory.generate_thumbnail (uri, self.info.get_content_type()) if thumb: icon_factory.save_thumbnail (thumb, uri, mtime) return thumb #fallback get the themed icon return gtk.icon_theme_get_default().choose_icon (self.info.get_icon().get_property ("names"), 48, gtk.ICON_LOOKUP_USE_BUILTIN).load_icon ()
def get_icon(self): #try thumnailer first icon_factory = gnome.ui.ThumbnailFactory( gnome.ui.THUMBNAIL_SIZE_NORMAL) mtime = os.path.getmtime(self.path) uri = gnomevfs.make_uri_from_input(self.path) thumb = icon_factory.lookup(uri, mtime) if thumb: return gtk.gdk.pixbuf_new_from_file(thumb) thumb = icon_factory.generate_thumbnail(uri, self.info.get_content_type()) if thumb: icon_factory.save_thumbnail(thumb, uri, mtime) return thumb #fallback get the themed icon return gtk.icon_theme_get_default().choose_icon( self.info.get_icon().get_property("names"), 48, gtk.ICON_LOOKUP_USE_BUILTIN).load_icon()
def on_treeview_row_activated (self, treeview, path, column): (model, iter) = treeview.get_selection ().get_selected () filename = model.get (iter, 1)[0] application = gnomevfs.mime_get_default_application (gnomevfs.get_mime_type(gnomevfs.make_uri_from_input(filename))) if application: subprocess.Popen (str.split (application[2]) + [filename])
def on_current_file_button_clicked (self, widget): application = gnomevfs.mime_get_default_application (gnomevfs.get_mime_type(gnomevfs.make_uri_from_input(self.filename))) if application: subprocess.Popen (str.split (application[2]) + [self.filename])
def get_mime_type (self): return gnomevfs.get_mime_type(gnomevfs.make_uri_from_input(self.path))
def __open_folder_imi_activate(self, imagemenuitem): """Opens the folder containing the download.""" downloads = gui.get_selected_values(self.downloads_treeview) if downloads: uri = gnomevfs.make_uri_from_input(downloads[0].path) gnome.ui.url_show_on_screen(uri, imagemenuitem.get_screen())
def on_current_file_button_clicked(self, widget): application = gnomevfs.mime_get_default_application( gnomevfs.get_mime_type(gnomevfs.make_uri_from_input( self.filename))) if application: subprocess.Popen(str.split(application[2]) + [self.filename])
def get_mime_type(self): return gnomevfs.get_mime_type(gnomevfs.make_uri_from_input(self.path))