Show button available for all information fields | AUR: not showing all optional dependencies

This commit is contained in:
Vinicius Moreira
2019-09-26 12:59:08 -03:00
parent 9aa069f4be
commit b22bf2786d
3 changed files with 7 additions and 18 deletions

View File

@@ -7,10 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.6.1] ## [0.6.1]
### Improvements: ### Improvements:
- Better warning presentation when there are several messages - Better warning presentation when there are several messages
- "Show" button available for all information fields
### Fixes: ### Fixes:
- Error when retrieving suggestions - Error when retrieving suggestions
- snapd health check when snapd.service is available - snapd health check when snapd.service is available
- AUR: not showing all optional dependencies ( Info )
## [0.6.0] 2019-09-25 ## [0.6.0] 2019-09-25

View File

@@ -6,7 +6,7 @@ from bauh.api.abstract.handler import ProcessWatcher
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess, ProcessHandler from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess, ProcessHandler
RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]') RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]')
RE_OPTDEPS = re.compile(r'[\w\._\-]+\s*:')
def is_enabled() -> bool: def is_enabled() -> bool:
try: try:
@@ -43,7 +43,7 @@ def get_info(pkg_name) -> str:
def get_info_list(pkg_name: str) -> List[tuple]: def get_info_list(pkg_name: str) -> List[tuple]:
info = get_info(pkg_name) info = get_info(pkg_name)
if info: if info:
return re.findall(r'(\w+\s?\w+)\s+:\s+(.+(\n\s+.+)*)', info) return re.findall(r'(\w+\s?\w+)\s*:\s*(.+(\n\s+.+)*)', info)
def get_info_dict(pkg_name: str) -> dict: def get_info_dict(pkg_name: str) -> dict:
@@ -53,14 +53,13 @@ def get_info_dict(pkg_name: str) -> dict:
info_dict = {} info_dict = {}
for info_data in info_list: for info_data in info_list:
attr = info_data[0].lower().strip() attr = info_data[0].lower().strip()
info_dict[attr] = info_data[1] if '\n' not in info_data[1] else ' '.join( info_dict[attr] = info_data[1]
[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]: if attr == 'optional deps' and info_dict[attr]:
info_dict[attr] = RE_DEPS.findall(info_dict[attr]) info_dict[attr] = info_dict[attr].split('\n')
elif attr == 'depends on' and info_dict[attr]: elif attr == 'depends on' and info_dict[attr]:
info_dict[attr] = [d.strip() for d in info_dict[attr].split(' ') if d] info_dict[attr] = [d.strip() for d in info_dict[attr].split(' ') if d]

View File

@@ -3,7 +3,6 @@ from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \
QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar
from bauh.api.abstract.cache import MemoryCache from bauh.api.abstract.cache import MemoryCache
from bauh.commons.html import strip_html
IGNORED_ATTRS = {'name', '__app__'} IGNORED_ATTRS = {'name', '__app__'}
@@ -54,8 +53,6 @@ class InfoDialog(QDialog):
else: else:
val = str(app[attr]).strip() val = str(app[attr]).strip()
full_val = None
i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower())) i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower()))
if i18n_val: if i18n_val:
@@ -63,13 +60,6 @@ class InfoDialog(QDialog):
text = QLineEdit() text = QLineEdit()
text.setToolTip(val) text.setToolTip(val)
if len(val) > 80:
full_val = val
self.full_vals.append(full_val)
val = strip_html(val)
val = val[0:80] + '...'
text.setText(val) text.setText(val)
text.setCursorPosition(0) text.setCursorPosition(0)
text.setStyleSheet("width: 400px") text.setStyleSheet("width: 400px")
@@ -80,9 +70,7 @@ class InfoDialog(QDialog):
self.gbox_info_layout.addWidget(label, idx, 0) self.gbox_info_layout.addWidget(label, idx, 0)
self.gbox_info_layout.addWidget(text, idx, 1) self.gbox_info_layout.addWidget(text, idx, 1)
self._gen_show_button(idx, val)
if full_val is not None:
self._gen_show_button(idx, full_val)
self.adjustSize() self.adjustSize()