def update_model(self, filter=False, all=False): self.model.clear() mainwindow = self.get_toplevel().window if mainwindow: mainwindow.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) while gtk.events_pending(): gtk.main_iteration() for type in gio.content_types_get_registered(): if filter and filter != type.split('/')[0]: continue pixbuf = icon.get_from_mime_type(type) description = gio.content_type_get_description(type) app = gio.app_info_get_default_for_type(type, False) if app: appname = app.get_name() applogo = icon.get_from_app(app) elif all and not app: appname = _('None') applogo = None else: continue iter = self.model.append() self.model.set(iter, TYPE_MIME, type, TYPE_ICON, pixbuf, TYPE_DESCRIPTION, description, TYPE_APPICON, applogo, TYPE_APP, appname) if mainwindow: mainwindow.set_cursor(None)
def update_model(self, filter = False, all = False): self.model.clear() mainwindow = self.get_toplevel().window if mainwindow: mainwindow.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) for type in gio.content_types_get_registered(): while gtk.events_pending (): gtk.main_iteration () if filter and filter != type.split('/')[0]: continue pixbuf = mime_type_get_icon(type, 24) description = gio.content_type_get_description(type) app = gio.app_info_get_default_for_type(type, False) if app: appname = app.get_name() applogo = get_icon_with_app(app, 24) elif all and not app: appname = _('None') applogo = None else: continue iter = self.model.append() self.model.set(iter, TYPE_MIME, type, TYPE_ICON, pixbuf, TYPE_DESCRIPTION, description, TYPE_APPICON, applogo, TYPE_APP, appname) if mainwindow: mainwindow.set_cursor(None)
def run(self): if self.rough_type_lists.get(self.types): content_types = self.rough_type_lists.get(self.types) else: content_types = filter(lambda c: c.startswith(self.types) , gio.content_types_get_registered()) print len(content_types) if content_types: for content_type in content_types: if self.stop: break else: time.sleep(0.1) self.set_func(self.desktopapp, content_type) print "ThreadSet finish" self.stop_run()
def run(self): if self.rough_type_lists.get(self.types): content_types = self.rough_type_lists.get(self.types) else: content_types = filter(lambda c: c.startswith(self.types), gio.content_types_get_registered()) print len(content_types) if content_types: for content_type in content_types: if self.stop: break else: time.sleep(0.1) self.set_func(self.desktopapp, content_type) print "ThreadSet finish" self.stop_run()