Exemple #1
0
def get_applications():
    
    apps = []

    for entry in DesktopEntry.get_all():
        if isinstance(entry.mime_type, list) and 'image/png' in entry.mime_type:
            apps.append(entry)
            
    return apps
Exemple #2
0
    def fill_categories(self):

        self.desktop_entries = defaultdict(list)

        for desktop_entry in DesktopEntry.get_all():
            category = CATEGORIES.get(desktop_entry.recommended_category)
            if category:
                self.desktop_entries[category[0]].append(desktop_entry)

        for category in self.categories:
            entries = self.desktop_entries[category.id]
            entries.sort(key=lambda entry: entry.name.lower())

            category.single_columned = len(entries) <= self.single_column_max_items
            for entry in entries:
                category.add_item(entry)