forked from CastroFidel/winehelper
added a filter for unnecessary components
This commit is contained in:
@@ -617,12 +617,33 @@ class WinetricksManagerDialog(QDialog):
|
||||
self._log(f"--- Предупреждение: не удалось прочитать {log_path}: {e} ---")
|
||||
return installed_verbs
|
||||
|
||||
def _parse_winetricks_list_output(self, output, installed_verbs, list_widget):
|
||||
def _parse_winetricks_list_output(self, output, installed_verbs, list_widget, category):
|
||||
"""Парсит вывод 'winetricks list' и заполняет QListWidget."""
|
||||
# Regex, который обрабатывает строки как с префиксом статуса '[ ]', так и без него.
|
||||
# 1. `(?:\[(.)]\s+)?` - опциональная группа для статуса (напр. '[x]').
|
||||
# 2. `([^\s]+)` - имя компонента (без пробелов).
|
||||
# 3. `(.*)` - оставшаяся часть строки (описание).
|
||||
|
||||
# Определяем шаблоны для фильтрации на основе категории
|
||||
dlls_blacklist_pattern = None
|
||||
fonts_blacklist_pattern = None
|
||||
settings_blacklist_pattern = None
|
||||
|
||||
if category == 'dlls':
|
||||
# Исключаем d3d*, directx9, dont_use, dxvk*, vkd3d*, galliumnine, faudio*, Foundation
|
||||
dlls_blacklist_pattern = re.compile(
|
||||
r'^(d3d|directx9|dont_use|dxvk|vkd3d|galliumnine|faudio|foundation)', re.IGNORECASE
|
||||
)
|
||||
elif category == 'fonts':
|
||||
fonts_blacklist_pattern = re.compile(
|
||||
r'^(dont_use)', re.IGNORECASE
|
||||
)
|
||||
elif category == 'settings':
|
||||
# Исключаем vista*, alldlls, autostart_*, bad*, good*, win*, videomemory*, vd=*, isolate_home
|
||||
settings_blacklist_pattern = re.compile(
|
||||
r'^(vista|alldlls|autostart_|bad|good|win|videomemory|vd=|isolate_home)', re.IGNORECASE
|
||||
)
|
||||
|
||||
line_re = re.compile(r"^\s*(?:\[(.)]\s+)?([^\s]+)\s*(.*)")
|
||||
found_items = False
|
||||
|
||||
@@ -643,6 +664,14 @@ class WinetricksManagerDialog(QDialog):
|
||||
if '/' in name or '\\' in name or name.lower() in ('executing', 'using', 'warning:') or name.endswith(':'):
|
||||
continue
|
||||
|
||||
# Применяем фильтры для черных списков
|
||||
if dlls_blacklist_pattern and dlls_blacklist_pattern.search(name):
|
||||
continue
|
||||
if fonts_blacklist_pattern and fonts_blacklist_pattern.search(name):
|
||||
continue
|
||||
if settings_blacklist_pattern and settings_blacklist_pattern.search(name):
|
||||
continue
|
||||
|
||||
is_checked = name in installed_verbs
|
||||
item_text = f"{name.ljust(27)}{description.strip()}"
|
||||
item = QListWidgetItem(item_text)
|
||||
@@ -681,7 +710,7 @@ class WinetricksManagerDialog(QDialog):
|
||||
self._log("--------------------------------------------------", "red")
|
||||
else:
|
||||
installed_verbs = self._parse_winetricks_log()
|
||||
found_items = self._parse_winetricks_list_output(output, installed_verbs, list_widget)
|
||||
found_items = self._parse_winetricks_list_output(output, installed_verbs, list_widget, category)
|
||||
|
||||
if from_cache is None: # Только если мы не читали из кэша
|
||||
# Сохраняем успешный результат в кэш
|
||||
|
Reference in New Issue
Block a user