Fixed sub filtering and effecency gain

This commit is contained in:
itdominator 2023-09-27 17:21:03 -05:00
parent 8e2ae773b6
commit 4545e67432
1 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# Python imports # Python imports
import pickle import pickle
from os import listdir from os import listdir
from dataclasses import fields from dataclasses import fields, asdict
# Lib imports # Lib imports
from xdg.DesktopEntry import DesktopEntry from xdg.DesktopEntry import DesktopEntry
@ -21,7 +21,6 @@ class DdesktopFiles:
self._setup_signals() self._setup_signals()
self._subscribe_to_events() self._subscribe_to_events()
self.reload_desktop_entries() self.reload_desktop_entries()
self.create_groups_mapping()
def _setup_styling(self): def _setup_styling(self):
@ -86,13 +85,13 @@ class DdesktopFiles:
self.groups[group].append(entry) self.groups[group].append(entry)
def cross_append_groups(self): def cross_append_groups(self):
fields_data = fields(settings.filters) fields_data = asdict(settings.filters)
for field in fields_data: for field in fields_data:
title = field.name.title() title = field.title()
to_merge = [] to_merge = []
for group in field.default_factory(): for group in fields_data[field]:
to_merge += self.groups[group] to_merge += self.groups[group.title()]
sub_map = {} sub_map = {}
# NOTE: Will "hash" filters ("to_merge" var) first so that target self.groups[title] overrites with its own if any entry exists. # NOTE: Will "hash" filters ("to_merge" var) first so that target self.groups[title] overrites with its own if any entry exists.