From b22bf2786d2656adc7cdd576ca707dd3412eda75 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 26 Sep 2019 12:59:08 -0300 Subject: [PATCH] Show button available for all information fields | AUR: not showing all optional dependencies --- CHANGELOG.md | 2 ++ bauh/gems/arch/pacman.py | 9 ++++----- bauh/view/qt/info.py | 14 +------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 270f610f..2cb619db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.6.1] ### Improvements: - Better warning presentation when there are several messages +- "Show" button available for all information fields ### Fixes: - Error when retrieving suggestions - snapd health check when snapd.service is available +- AUR: not showing all optional dependencies ( Info ) ## [0.6.0] 2019-09-25 diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index d2c85d27..a08c51b4 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -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 RE_DEPS = re.compile(r'[\w\-_]+:[\s\w_\-\.]+\s+\[\w+\]') - +RE_OPTDEPS = re.compile(r'[\w\._\-]+\s*:') def is_enabled() -> bool: try: @@ -43,7 +43,7 @@ def get_info(pkg_name) -> str: def get_info_list(pkg_name: str) -> List[tuple]: info = get_info(pkg_name) 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: @@ -53,14 +53,13 @@ def get_info_dict(pkg_name: str) -> dict: info_dict = {} for info_data in info_list: 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 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]) + info_dict[attr] = info_dict[attr].split('\n') elif attr == 'depends on' and info_dict[attr]: info_dict[attr] = [d.strip() for d in info_dict[attr].split(' ') if d] diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index f4cdf3ea..54f1d923 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -3,7 +3,6 @@ from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QDialog, QVBoxLayout, QGroupBox, \ QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar from bauh.api.abstract.cache import MemoryCache -from bauh.commons.html import strip_html IGNORED_ATTRS = {'name', '__app__'} @@ -54,8 +53,6 @@ class InfoDialog(QDialog): else: val = str(app[attr]).strip() - full_val = None - i18n_val = locale_keys.get('{}.{}'.format(i18n_key, val.lower())) if i18n_val: @@ -63,13 +60,6 @@ class InfoDialog(QDialog): text = QLineEdit() 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.setCursorPosition(0) text.setStyleSheet("width: 400px") @@ -80,9 +70,7 @@ class InfoDialog(QDialog): self.gbox_info_layout.addWidget(label, idx, 0) self.gbox_info_layout.addWidget(text, idx, 1) - - if full_val is not None: - self._gen_show_button(idx, full_val) + self._gen_show_button(idx, val) self.adjustSize()