mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 09:54:14 +02:00
rendering 'info' list fields | better AUR 'optional deps' presentation
This commit is contained in:
@@ -3,6 +3,8 @@ from typing import List, Set
|
|||||||
|
|
||||||
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess
|
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess
|
||||||
|
|
||||||
|
RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]')
|
||||||
|
|
||||||
|
|
||||||
def is_enabled() -> bool:
|
def is_enabled() -> bool:
|
||||||
try:
|
try:
|
||||||
@@ -48,12 +50,15 @@ def get_info_dict(pkg_name: str) -> dict:
|
|||||||
if info_list:
|
if info_list:
|
||||||
info_dict = {}
|
info_dict = {}
|
||||||
for info_data in info_list:
|
for info_data in info_list:
|
||||||
attr = info_data[0].lower()
|
attr = info_data[0].lower().strip()
|
||||||
info_dict[attr] = info_data[1] if '\n' not in info_data[1] else ' '.join([l.strip() for l in info_data[1].split('\n')])
|
info_dict[attr] = info_data[1] if '\n' not in info_data[1] else ' '.join([l.strip() for l in info_data[1].split('\n')])
|
||||||
|
|
||||||
if info_dict[attr] == 'None':
|
if info_dict[attr] == 'None':
|
||||||
info_dict[attr] = None
|
info_dict[attr] = None
|
||||||
|
|
||||||
|
if attr == 'optional deps' and info_dict[attr]:
|
||||||
|
info_dict[attr] = RE_DEPS.findall(info_dict[attr])
|
||||||
|
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ class InfoDialog(QDialog):
|
|||||||
for idx, attr in enumerate(sorted(app.keys())):
|
for idx, attr in enumerate(sorted(app.keys())):
|
||||||
if attr not in IGNORED_ATTRS and app[attr]:
|
if attr not in IGNORED_ATTRS and app[attr]:
|
||||||
i18n_key = app['__app__'].model.get_type() + '.info.' + attr.lower()
|
i18n_key = app['__app__'].model.get_type() + '.info.' + attr.lower()
|
||||||
val = str(app[attr]).strip()
|
|
||||||
|
if isinstance(app[attr], list):
|
||||||
|
val = '\n'.join([str(e) for e in app[attr]])
|
||||||
|
else:
|
||||||
|
val = str(app[attr]).strip()
|
||||||
|
|
||||||
full_val = None
|
full_val = None
|
||||||
|
|
||||||
i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower()))
|
i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower()))
|
||||||
|
|||||||
Reference in New Issue
Block a user