From b59cb347c4bbc1eaf8a0fe90142dcacc26d09f3b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 13:09:50 -0300 Subject: [PATCH 01/38] [improvement] Not breaking the application when a i18n (translation) key was not found --- CHANGELOG.md | 4 ++ CONTRIBUTING.md | 8 ++++ README.md | 10 +++-- bauh/__init__.py | 2 +- bauh/api/abstract/context.py | 6 +-- bauh/app.py | 11 ++++-- bauh/gems/arch/confirmation.py | 6 +-- bauh/gems/arch/message.py | 7 ++-- bauh/view/core/downloader.py | 3 +- bauh/view/core/gems.py | 9 +++-- bauh/view/qt/about.py | 17 +++++---- bauh/view/qt/apps_table.py | 11 +++--- bauh/view/qt/confirmation.py | 9 +++-- bauh/view/qt/dialog.py | 7 ++-- bauh/view/qt/gem_selector.py | 3 +- bauh/view/qt/history.py | 3 +- bauh/view/qt/info.py | 3 +- bauh/view/qt/root.py | 3 +- bauh/view/qt/screenshots.py | 3 +- bauh/view/qt/styles.py | 3 +- bauh/view/qt/systray.py | 3 +- bauh/view/qt/thread.py | 35 +++++++++--------- bauh/view/qt/window.py | 13 ++++--- bauh/view/util/translation.py | 67 ++++++++++++++++++++++++++++++++++ bauh/view/util/util.py | 37 ------------------- 25 files changed, 175 insertions(+), 108 deletions(-) create mode 100644 bauh/view/util/translation.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a5d77ab..a90a5c77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.7.3] +### Improvements +- Not breaking the application when a i18n (translation) key was not found + ## [0.7.2] 2019-11-01 ### Improvements - Snap diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 178c7035..83c87a6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,3 +20,11 @@ The way to go here is to ask yourself if the improvement would be useful for mor * Explain why you think these changes could be useful * If it fixes a bug, be sure to link to the issue itself. * Follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) code style to keep the code consistent. + +# Adding a new translation +* To add a new translation, you will have to create a file in each directory listed below named as the first two letters in the ISO format (e.g: for 'english' would be 'en'): +- **bauh/view/resources/locale** +- **bauh/gems/appimage/resources/locale** +- **bauh/gems/arch/resources/locale** +- **bauh/gems/flatpak/resources/locale** +- **bauh/gems/snap/resources/locale** diff --git a/README.md b/README.md index b85589e5..84a97bd1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ It has a **tray mode** (see **Settings** below) that attaches the application ic This project has an official Twitter account ( **@bauh4linux** ) so people can stay on top of its news. +To contribute with this project, have a look at [CONTRIBUTING.md](https://github.com/vinifmor/bauh/blob/master/CONTRIBUTING.md) + ![management panel](https://raw.githubusercontent.com/vinifmor/bauh/master/pictures/panel.png) @@ -65,13 +67,13 @@ If you do not want to clone / download this repository, go to your **Home** fold In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). ### Gems ( package technology support ) -#### Flatpak ( flatpak gem ) +#### Flatpak ( flatpak ) - The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history -#### Snap ( snap gem ) +#### Snap ( snap ) - The user is able to search, install, uninstall, refresh, launch and downgrade applications -#### AUR ( arch gem ) +#### AUR ( arch ) - It is **not enabled by default** - The user is able to search, install, uninstall, downgrade, launch and retrieve the packages history - It handles conflicts, and missing / optional packages installations ( including from your distro mirrors ) @@ -90,7 +92,7 @@ will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings - Arch package memory-indexer running every 20 minutes. This memory index is used when AUR Api cannot handle the amount of results found for a given search. It can be disabled via the environment variable **BAUH_ARCH_AUR_INDEX_UPDATER=0**. - If some of your installed packages are not categorized, send an e-mail to **bauh4linux@gmail.com** informing their names and categories in the following format: ```name=category1[,category2,category3,...]``` -#### AppImage ( appimage gem ) +#### AppImage ( appimage ) - The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history - Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** ) - Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section. diff --git a/bauh/__init__.py b/bauh/__init__.py index 85695271..932ff985 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.7.2' +__version__ = '0.7.3' __app_name__ = 'bauh' import os diff --git a/bauh/api/abstract/context.py b/bauh/api/abstract/context.py index 056998f5..0cd3d6dc 100644 --- a/bauh/api/abstract/context.py +++ b/bauh/api/abstract/context.py @@ -1,16 +1,16 @@ import logging -import platform import sys from bauh.api.abstract.cache import MemoryCacheFactory from bauh.api.abstract.disk import DiskCacheLoaderFactory from bauh.api.abstract.download import FileDownloader from bauh.api.http import HttpClient +from bauh.view.util.translation import I18n class ApplicationContext: - def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: dict, + def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClient, app_root_dir: str, i18n: I18n, cache_factory: MemoryCacheFactory, disk_loader_factory: DiskCacheLoaderFactory, logger: logging.Logger, file_downloader: FileDownloader, distro: str): """ @@ -18,7 +18,7 @@ def __init__(self, disk_cache: bool, download_icons: bool, http_client: HttpClie :param download_icons: if packages icons should be downloaded :param http_client: a shared instance of http client :param app_root_dir: GUI root dir - :param i18n: the i18n dictionary keys + :param i18n: the translation keys :param cache_factory: :param disk_loader_factory: :param logger: a logger instance diff --git a/bauh/app.py b/bauh/app.py index 4a332791..89140feb 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -12,9 +12,12 @@ from bauh.view.core.downloader import AdaptableFileDownloader from bauh.view.qt.systray import TrayIcon from bauh.view.qt.window import ManageWindow -from bauh.view.util import util, logs, resource +from bauh.view.util import util, logs, resource, translation from bauh.view.util.cache import DefaultMemoryCacheFactory, CacheCleaner from bauh.view.util.disk import DefaultDiskCacheLoaderFactory +from bauh.view.util.translation import I18n + +DEFAULT_I18N_KEY = 'en' def main(): @@ -25,7 +28,9 @@ def main(): logger = logs.new_logger(__app_name__, bool(args.logs)) app_args.validate(args, logger) - i18n_key, i18n = util.get_locale_keys(args.locale) + i18n_key, current_i18n = translation.get_locale_keys(args.locale) + default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {} + i18n = I18n(current_i18n, default_i18n) cache_cleaner = CacheCleaner() cache_factory = DefaultMemoryCacheFactory(expiration_time=args.cache_exp, cleaner=cache_cleaner) @@ -57,7 +62,7 @@ def main(): if app.style().objectName().lower() not in {'fusion', 'breeze'}: app.setStyle('Fusion') - managers = gems.load_managers(context=context, locale=i18n_key, config=user_config) + managers = gems.load_managers(context=context, locale=i18n_key, config=user_config, default_locale=DEFAULT_I18N_KEY) manager = GenericSoftwareManager(managers, context=context, app_args=args) manager.prepare() diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index d47765a3..dd114388 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -2,11 +2,11 @@ from bauh.api.abstract.handler import ProcessWatcher from bauh.api.abstract.view import MultipleSelectComponent, InputOption - from bauh.commons.html import bold +from bauh.view.util.translation import I18n -def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: dict) -> Set[str]: +def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: I18n) -> Set[str]: opts = [InputOption('{}{} ( {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', d['mirror'].upper()), p) for p, d in pkg_mirrors.items()] view_opts = MultipleSelectComponent(label='', options=opts, @@ -21,7 +21,7 @@ def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatch return {o.value for o in view_opts.values} -def request_install_missing_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: dict) -> bool: +def request_install_missing_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: I18n) -> bool: deps_str = ''.join(['
- {} ( {} )'.format(d, m.upper()) for d, m in pkg_mirrors.items()]) msg = '

{}

'.format(i18n['arch.missing_deps.body'].format(bold(pkgname)) + ':
' + deps_str) msg += i18n['ask.continue'] diff --git a/bauh/gems/arch/message.py b/bauh/gems/arch/message.py index df02103b..320cf23b 100644 --- a/bauh/gems/arch/message.py +++ b/bauh/gems/arch/message.py @@ -1,21 +1,22 @@ from bauh.api.abstract.handler import ProcessWatcher from bauh.api.abstract.view import MessageType from bauh.commons.html import bold +from bauh.view.util.translation import I18n -def show_dep_not_installed(watcher: ProcessWatcher, pkgname: str, depname: str, i18n: dict): +def show_dep_not_installed(watcher: ProcessWatcher, pkgname: str, depname: str, i18n: I18n): watcher.show_message(title=i18n['error'], body=i18n['arch.install.dependency.install.error'].format(bold(depname), bold(pkgname)), type_=MessageType.ERROR) -def show_dep_not_found(depname: str, i18n: dict, watcher: ProcessWatcher): +def show_dep_not_found(depname: str, i18n: I18n, watcher: ProcessWatcher): watcher.show_message(title=i18n['arch.install.dep_not_found.title'], body=i18n['arch.install.dep_not_found.body'].format(bold(depname)), type_=MessageType.ERROR) -def show_optdep_not_installed(depname: str, watcher: ProcessWatcher, i18n: dict): +def show_optdep_not_installed(depname: str, watcher: ProcessWatcher, i18n: I18n): watcher.show_message(title=i18n['error'], body=i18n['arch.install.optdep.error'].format(bold(depname)), type_=MessageType.ERROR) diff --git a/bauh/view/core/downloader.py b/bauh/view/core/downloader.py index 960fc3ab..d29231fb 100644 --- a/bauh/view/core/downloader.py +++ b/bauh/view/core/downloader.py @@ -8,11 +8,12 @@ from bauh.api.http import HttpClient from bauh.commons.html import bold from bauh.commons.system import run_cmd, new_subprocess, ProcessHandler, SystemProcess, SimpleProcess +from bauh.view.util.translation import I18n class AdaptableFileDownloader(FileDownloader): - def __init__(self, logger: logging.Logger, multithread_enabled: bool, i18n: dict, http_client: HttpClient): + def __init__(self, logger: logging.Logger, multithread_enabled: bool, i18n: I18n, http_client: HttpClient): self.logger = logger self.multithread_enabled = multithread_enabled self.i18n = i18n diff --git a/bauh/view/core/gems.py b/bauh/view/core/gems.py index bfd140d4..c9756759 100644 --- a/bauh/view/core/gems.py +++ b/bauh/view/core/gems.py @@ -6,7 +6,7 @@ from bauh import ROOT_DIR from bauh.api.abstract.controller import SoftwareManager, ApplicationContext from bauh.view.core.config import Configuration -from bauh.view.util import util +from bauh.view.util import util, translation def find_manager(member): @@ -20,7 +20,7 @@ def find_manager(member): return manager_found -def load_managers(locale: str, context: ApplicationContext, config: Configuration) -> List[SoftwareManager]: +def load_managers(locale: str, context: ApplicationContext, config: Configuration, default_locale: str) -> List[SoftwareManager]: managers = [] for f in os.scandir(ROOT_DIR + '/gems'): @@ -37,7 +37,10 @@ def load_managers(locale: str, context: ApplicationContext, config: Configuratio locale_path = '{}/resources/locale'.format(f.path) if os.path.exists(locale_path): - context.i18n.update(util.get_locale_keys(locale, locale_path)[1]) + context.i18n.current.update(translation.get_locale_keys(locale, locale_path)[1]) + + if default_locale and context.i18n.default: + context.i18n.default.update(translation.get_locale_keys(default_locale, locale_path)[1]) man = manager_class(context=context) diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py index 7f3971a3..39065f0f 100644 --- a/bauh/view/qt/about.py +++ b/bauh/view/qt/about.py @@ -1,11 +1,12 @@ from glob import glob from PyQt5.QtCore import Qt -from PyQt5.QtGui import QPixmap, QIcon +from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QVBoxLayout, QDialog, QLabel, QWidget, QHBoxLayout from bauh import __version__, __app_name__, ROOT_DIR from bauh.view.util import resource +from bauh.view.util.translation import I18n PROJECT_URL = 'https://github.com/vinifmor/' + __app_name__ LICENSE_URL = 'https://raw.githubusercontent.com/vinifmor/{}/master/LICENSE'.format(__app_name__) @@ -13,9 +14,9 @@ class AboutDialog(QDialog): - def __init__(self, locale_keys: dict): + def __init__(self, i18n: I18n): super(AboutDialog, self).__init__() - self.setWindowTitle(locale_keys['tray.action.about']) + self.setWindowTitle(i18n['tray.action.about']) layout = QVBoxLayout() self.setLayout(layout) @@ -33,7 +34,7 @@ def __init__(self, locale_keys: dict): line_desc = QLabel(self) line_desc.setStyleSheet('font-size: 12px; font-weight: bold;') - line_desc.setText(locale_keys['about.info.desc']) + line_desc.setText(i18n['about.info.desc']) line_desc.setAlignment(Qt.AlignCenter) line_desc.setMinimumWidth(400) layout.addWidget(line_desc) @@ -55,21 +56,21 @@ def __init__(self, locale_keys: dict): layout.addWidget(gems_widget) layout.addWidget(QLabel('')) - label_version = QLabel(locale_keys['version'].lower() + ' ' + __version__) + label_version = QLabel(i18n['version'].lower() + ' ' + __version__) label_version.setStyleSheet('QLabel { font-size: 11px; font-weight: bold }') label_version.setAlignment(Qt.AlignCenter) layout.addWidget(label_version) label_more_info = QLabel() label_more_info.setStyleSheet('font-size: 11px;') - label_more_info.setText(locale_keys['about.info.link'] + ": {url}".format(url=PROJECT_URL)) + label_more_info.setText(i18n['about.info.link'] + ": {url}".format(url=PROJECT_URL)) label_more_info.setOpenExternalLinks(True) label_more_info.setAlignment(Qt.AlignCenter) layout.addWidget(label_more_info) label_license = QLabel() label_license.setStyleSheet('font-size: 11px;') - label_license.setText("{}".format(LICENSE_URL, locale_keys['about.info.license'])) + label_license.setText("{}".format(LICENSE_URL, i18n['about.info.license'])) label_license.setOpenExternalLinks(True) label_license.setAlignment(Qt.AlignCenter) layout.addWidget(label_license) @@ -78,7 +79,7 @@ def __init__(self, locale_keys: dict): label_rate = QLabel() label_rate.setStyleSheet('font-size: 11px; font-weight: bold;') - label_rate.setText(locale_keys['about.info.rate'] + ' :)') + label_rate.setText(i18n['about.info.rate'] + ' :)') label_rate.setOpenExternalLinks(True) label_rate.setAlignment(Qt.AlignCenter) layout.addWidget(label_rate) diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index c9ea76c4..040fab21 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -15,6 +15,7 @@ from bauh.view.qt.components import IconButton from bauh.view.qt.view_model import PackageView, PackageViewStatus from bauh.view.util import resource +from bauh.view.util.translation import I18n INSTALL_BT_STYLE = 'background: {back}; color: white; font-size: 10px; font-weight: bold' @@ -25,7 +26,7 @@ class UpdateToggleButton(QWidget): - def __init__(self, app_view: PackageView, root: QWidget, i18n: dict, checked: bool = True, clickable: bool = True): + def __init__(self, app_view: PackageView, root: QWidget, i18n: I18n, checked: bool = True, clickable: bool = True): super(UpdateToggleButton, self).__init__() self.app_view = app_view @@ -113,7 +114,7 @@ def downgrade(): if dialog.ask_confirmation( title=self.i18n['manage_window.apps_table.row.actions.downgrade'], body=self._parag(self.i18n['manage_window.apps_table.row.actions.downgrade.popup.body'].format(self._bold(str(pkg)))), - locale_keys=self.i18n): + i18n=self.i18n): self.window.downgrade(pkg) action_downgrade.triggered.connect(downgrade) @@ -131,7 +132,7 @@ def custom_action(): if dialog.ask_confirmation( title=self.i18n[action.i18_label_key], body=self._parag('{} {} ?'.format(self.i18n[action.i18_label_key], self._bold(str(pkg)))), - locale_keys=self.i18n): + i18n=self.i18n): self.window.execute_custom_action(pkg, action) item.triggered.connect(custom_action) @@ -162,7 +163,7 @@ def fill_async_data(self): def _uninstall_app(self, app_v: PackageView): if dialog.ask_confirmation(title=self.i18n['manage_window.apps_table.row.actions.uninstall.popup.title'], body=self._parag(self.i18n['manage_window.apps_table.row.actions.uninstall.popup.body'].format(self._bold(str(app_v)))), - locale_keys=self.i18n): + i18n=self.i18n): self.window.uninstall_app(app_v) def _bold(self, text: str) -> str: @@ -176,7 +177,7 @@ def _install_app(self, pkgv: PackageView): if dialog.ask_confirmation( title=self.i18n['manage_window.apps_table.row.actions.install.popup.title'], body=self._parag(self.i18n['manage_window.apps_table.row.actions.install.popup.body'].format(self._bold(str(pkgv)))), - locale_keys=self.i18n): + i18n=self.i18n): self.window.install(pkgv) diff --git a/bauh/view/qt/confirmation.py b/bauh/view/qt/confirmation.py index 53980ccb..ceeee6ab 100644 --- a/bauh/view/qt/confirmation.py +++ b/bauh/view/qt/confirmation.py @@ -1,22 +1,23 @@ from typing import List from PyQt5.QtWidgets import QMessageBox, QVBoxLayout, QLabel, QWidget + from bauh.api.abstract.view import ViewComponent, SingleSelectComponent, MultipleSelectComponent from bauh.view.qt import css - from bauh.view.qt.components import MultipleSelectQt, new_single_select +from bauh.view.util.translation import I18n class ConfirmationDialog(QMessageBox): - def __init__(self, title: str, body: str, locale_keys: dict, components: List[ViewComponent] = None, confirmation_label: str = None, deny_label: str = None): + def __init__(self, title: str, body: str, i18n: I18n, components: List[ViewComponent] = None, confirmation_label: str = None, deny_label: str = None): super(ConfirmationDialog, self).__init__() self.setWindowTitle(title) self.setStyleSheet('QLabel { margin-right: 25px; }') - self.bt_yes = self.addButton(locale_keys['popup.button.yes'] if not confirmation_label else confirmation_label.capitalize(), QMessageBox.YesRole) + self.bt_yes = self.addButton(i18n['popup.button.yes'] if not confirmation_label else confirmation_label.capitalize(), QMessageBox.YesRole) self.bt_yes.setStyleSheet(css.OK_BUTTON) - self.addButton(locale_keys['popup.button.no'] if not deny_label else deny_label.capitalize(), QMessageBox.NoRole) + self.addButton(i18n['popup.button.no'] if not deny_label else deny_label.capitalize(), QMessageBox.NoRole) if body: if not components: diff --git a/bauh/view/qt/dialog.py b/bauh/view/qt/dialog.py index ddf40304..2dbc1a08 100644 --- a/bauh/view/qt/dialog.py +++ b/bauh/view/qt/dialog.py @@ -6,6 +6,7 @@ from bauh.view.util import resource from bauh.view.qt import css +from bauh.view.util.translation import I18n MSG_TYPE_MAP = { MessageType.ERROR: QMessageBox.Critical, @@ -26,7 +27,7 @@ def show_message(title: str, body: str, type_: MessageType, icon: QIcon = QIcon( popup.exec_() -def ask_confirmation(title: str, body: str, locale_keys: dict, icon: QIcon = QIcon(resource.get_path('img/logo.svg')), widgets: List[QWidget] = None): +def ask_confirmation(title: str, body: str, i18n: I18n, icon: QIcon = QIcon(resource.get_path('img/logo.svg')), widgets: List[QWidget] = None): diag = QMessageBox() diag.setIcon(QMessageBox.Question) diag.setWindowTitle(title) @@ -42,10 +43,10 @@ def ask_confirmation(title: str, body: str, locale_keys: dict, icon: QIcon = QIc diag.layout().addWidget(wbody, 0, 1) - bt_yes = diag.addButton(locale_keys['popup.button.yes'], QMessageBox.YesRole) + bt_yes = diag.addButton(i18n['popup.button.yes'], QMessageBox.YesRole) bt_yes.setStyleSheet(css.OK_BUTTON) - diag.addButton(locale_keys['popup.button.no'], QMessageBox.NoRole) + diag.addButton(i18n['popup.button.no'], QMessageBox.NoRole) if icon: diag.setWindowIcon(icon) diff --git a/bauh/view/qt/gem_selector.py b/bauh/view/qt/gem_selector.py index be810f7f..2a2a4644 100644 --- a/bauh/view/qt/gem_selector.py +++ b/bauh/view/qt/gem_selector.py @@ -9,11 +9,12 @@ from bauh.view.util import resource from bauh.view.qt import qt_utils, css from bauh.view.qt.components import MultipleSelectQt, CheckboxQt, new_spacer +from bauh.view.util.translation import I18n class GemSelectorPanel(QWidget): - def __init__(self, window: QWidget, manager: GenericSoftwareManager, i18n: dict, config: Configuration, show_panel_after_restart: bool = False): + def __init__(self, window: QWidget, manager: GenericSoftwareManager, i18n: I18n, config: Configuration, show_panel_after_restart: bool = False): super(GemSelectorPanel, self).__init__() self.window = window self.manager = manager diff --git a/bauh/view/qt/history.py b/bauh/view/qt/history.py index 78fe283c..2498f2cc 100644 --- a/bauh/view/qt/history.py +++ b/bauh/view/qt/history.py @@ -7,11 +7,12 @@ from bauh.api.abstract.cache import MemoryCache from bauh.api.abstract.model import PackageHistory +from bauh.view.util.translation import I18n class HistoryDialog(QDialog): - def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: dict): + def __init__(self, history: PackageHistory, icon_cache: MemoryCache, i18n: I18n): super(HistoryDialog, self).__init__() self.setWindowFlags(self.windowFlags() | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint) diff --git a/bauh/view/qt/info.py b/bauh/view/qt/info.py index b9bbb11c..1a19011a 100644 --- a/bauh/view/qt/info.py +++ b/bauh/view/qt/info.py @@ -4,13 +4,14 @@ QLineEdit, QLabel, QGridLayout, QPushButton, QPlainTextEdit, QToolBar from bauh.api.abstract.cache import MemoryCache +from bauh.view.util.translation import I18n IGNORED_ATTRS = {'name', '__app__'} class InfoDialog(QDialog): - def __init__(self, app: dict, icon_cache: MemoryCache, i18n: dict, screen_size: QSize()): + def __init__(self, app: dict, icon_cache: MemoryCache, i18n: I18n, screen_size: QSize()): super(InfoDialog, self).__init__() self.setWindowTitle(str(app['__app__'])) self.screen_size = screen_size diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index d4f16cb0..3638c816 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -7,13 +7,14 @@ from bauh.commons.system import new_subprocess from bauh.view.qt.dialog import show_message from bauh.view.util import resource +from bauh.view.util.translation import I18n def is_root(): return os.getuid() == 0 -def ask_root_password(i18n: dict): +def ask_root_password(i18n: I18n): diag = QInputDialog() diag.setStyleSheet("""QLineEdit { border-radius: 5px; font-size: 16px }""") diag.setInputMode(QInputDialog.TextInput) diff --git a/bauh/view/qt/screenshots.py b/bauh/view/qt/screenshots.py index 56bd13fc..f61712d3 100644 --- a/bauh/view/qt/screenshots.py +++ b/bauh/view/qt/screenshots.py @@ -12,6 +12,7 @@ from bauh.view.qt.components import new_spacer from bauh.view.qt.thread import AnimateProgress from bauh.view.qt.view_model import PackageView +from bauh.view.util.translation import I18n class ScreenshotsDialog(QDialog): @@ -19,7 +20,7 @@ class ScreenshotsDialog(QDialog): MAX_HEIGHT = 600 MAX_WIDTH = 800 - def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: MemoryCache, i18n: dict, screenshots: List[QPixmap], logger: logging.Logger): + def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: MemoryCache, i18n: I18n, screenshots: List[QPixmap], logger: logging.Logger): super(ScreenshotsDialog, self).__init__() self.setWindowTitle(str(pkg)) self.screenshots = screenshots diff --git a/bauh/view/qt/styles.py b/bauh/view/qt/styles.py index 9636b163..20e00313 100644 --- a/bauh/view/qt/styles.py +++ b/bauh/view/qt/styles.py @@ -5,11 +5,12 @@ from bauh.view.core import config from bauh.view.util import util from bauh.view.qt import dialog +from bauh.view.util.translation import I18n class StylesComboBox(QComboBox): - def __init__(self, parent: QWidget, i18n: dict, show_panel_after_restart: bool): + def __init__(self, parent: QWidget, i18n: I18n, show_panel_after_restart: bool): super(StylesComboBox, self).__init__(parent=parent) self.app = QApplication.instance() self.styles = [] diff --git a/bauh/view/qt/systray.py b/bauh/view/qt/systray.py index cb168f8f..201936c8 100755 --- a/bauh/view/qt/systray.py +++ b/bauh/view/qt/systray.py @@ -14,6 +14,7 @@ from bauh.view.util import util, resource from bauh.view.qt.about import AboutDialog from bauh.view.qt.window import ManageWindow +from bauh.view.util.translation import I18n class UpdateCheck(QThread): @@ -35,7 +36,7 @@ def run(self): class TrayIcon(QSystemTrayIcon): - def __init__(self, i18n: dict, manager: SoftwareManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True): + def __init__(self, i18n: I18n, manager: SoftwareManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True): super(TrayIcon, self).__init__() self.i18n = i18n self.manager = manager diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index f3be47e0..eacc72dc 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -12,9 +12,9 @@ from bauh.api.abstract.model import PackageStatus, SoftwarePackage, PackageAction from bauh.api.abstract.view import InputViewComponent, MessageType from bauh.api.exception import NoInternetException -from bauh.api.http import HttpClient from bauh.view.qt import commons from bauh.view.qt.view_model import PackageView +from bauh.view.util.translation import I18n RE_VERSION_IN_NAME = re.compile(r'\s+version\s+[\w\.]+\s*$') @@ -76,12 +76,12 @@ def should_stop(self): class UpdateSelectedApps(AsyncAction): - def __init__(self, manager: SoftwareManager, locale_keys: dict, apps_to_update: List[PackageView] = None): + def __init__(self, manager: SoftwareManager, i18n: I18n, apps_to_update: List[PackageView] = None): super(UpdateSelectedApps, self).__init__() self.apps_to_update = apps_to_update self.manager = manager self.root_password = None - self.locale_keys = locale_keys + self.i18n = i18n def run(self): @@ -93,7 +93,7 @@ def run(self): name = app.model.name if not RE_VERSION_IN_NAME.findall(app.model.name) else app.model.name.split('version')[0].strip() - self.change_status('{} {} {}...'.format(self.locale_keys['manage_window.status.upgrading'], name, app.model.version)) + self.change_status('{} {} {}...'.format(self.i18n['manage_window.status.upgrading'], name, app.model.version)) success = bool(self.manager.update(app.model, self.root_password, self)) self.change_substatus('') @@ -168,11 +168,11 @@ def run(self): class DowngradeApp(AsyncAction): - def __init__(self, manager: SoftwareManager, locale_keys: dict, app: PackageView = None): + def __init__(self, manager: SoftwareManager, i18n: I18n, app: PackageView = None): super(DowngradeApp, self).__init__() self.manager = manager self.app = app - self.locale_keys = locale_keys + self.i18n = i18n self.root_password = None def run(self): @@ -182,7 +182,7 @@ def run(self): success = self.manager.downgrade(self.app.model, self.root_password, self) except (requests.exceptions.ConnectionError, NoInternetException) as e: success = False - self.print(self.locale_keys['internet.required']) + self.print(self.i18n['internet.required']) finally: self.notify_finished({'app': self.app, 'success': success}) self.app = None @@ -206,18 +206,18 @@ def run(self): class GetAppHistory(AsyncAction): - def __init__(self, manager: SoftwareManager, locale_keys: dict, app: PackageView = None): + def __init__(self, manager: SoftwareManager, i18n: I18n, app: PackageView = None): super(GetAppHistory, self).__init__() self.app = app self.manager = manager - self.locale_keys = locale_keys + self.i18n = i18n def run(self): if self.app: try: self.notify_finished({'history': self.manager.get_history(self.app.model)}) except (requests.exceptions.ConnectionError, NoInternetException) as e: - self.notify_finished({'error': self.locale_keys['internet.required']}) + self.notify_finished({'error': self.i18n['internet.required']}) finally: self.app = None @@ -246,13 +246,13 @@ def run(self): class InstallPackage(AsyncAction): - def __init__(self, manager: SoftwareManager, disk_cache: bool, icon_cache: MemoryCache, locale_keys: dict, pkg: PackageView = None): + def __init__(self, manager: SoftwareManager, disk_cache: bool, icon_cache: MemoryCache, i18n: I18n, pkg: PackageView = None): super(InstallPackage, self).__init__() self.pkg = pkg self.manager = manager self.icon_cache = icon_cache self.disk_cache = disk_cache - self.locale_keys = locale_keys + self.i18n = i18n self.root_password = None def run(self): @@ -272,7 +272,7 @@ def run(self): only_icon=False) except (requests.exceptions.ConnectionError, NoInternetException): success = False - self.print(self.locale_keys['internet.required']) + self.print(self.i18n['internet.required']) finally: self.signal_finished.emit({'success': success, 'pkg': self.pkg}) self.pkg = None @@ -403,9 +403,9 @@ class ListWarnings(QThread): signal_warnings = pyqtSignal(list) - def __init__(self, man: SoftwareManager, locale_keys: dict): + def __init__(self, man: SoftwareManager, i18n: I18n): super(QThread, self).__init__() - self.locale_keys = locale_keys + self.i18n = i18n self.man = man def run(self): @@ -464,12 +464,13 @@ def run(self): class CustomAction(AsyncAction): - def __init__(self, manager: SoftwareManager, custom_action: PackageAction = None, pkg: PackageView = None, root_password: str = None): + def __init__(self, manager: SoftwareManager, i18n: I18n, custom_action: PackageAction = None, pkg: PackageView = None, root_password: str = None): super(CustomAction, self).__init__() self.manager = manager self.pkg = pkg self.custom_action = custom_action self.root_password = root_password + self.i18n = i18n def run(self): success = True @@ -481,7 +482,7 @@ def run(self): watcher=self) except (requests.exceptions.ConnectionError, NoInternetException): success = False - self.signal_output.emit(self.locale_keys['internet.required']) + self.signal_output.emit(self.i18n['internet.required']) self.notify_finished({'success': success, 'pkg': self.pkg}) self.pkg = None diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 16da819d..334816a2 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -36,6 +36,7 @@ from bauh.view.qt.view_model import PackageView from bauh.view.qt.view_utils import load_icon from bauh.view.util import util, resource +from bauh.view.util.translation import I18n DARK_ORANGE = '#FF4500' @@ -50,7 +51,7 @@ class ManageWindow(QWidget): signal_user_res = pyqtSignal(bool) signal_table_update = pyqtSignal() - def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager, disk_cache: bool, + def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager, disk_cache: bool, download_icons: bool, screen_size, suggestions: bool, display_limit: int, config: Configuration, context: ApplicationContext, notifications: bool, http_client: HttpClient, logger: logging.Logger, tray_icon=None): @@ -231,7 +232,7 @@ def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager self.thread_downgrade = self._bind_async_action(DowngradeApp(self.manager, self.i18n), finished_call=self._finish_downgrade) self.thread_suggestions = self._bind_async_action(FindSuggestions(man=self.manager), finished_call=self._finish_search, only_finished=True) self.thread_run_app = self._bind_async_action(LaunchApp(self.manager), finished_call=self._finish_run_app, only_finished=False) - self.thread_custom_action = self._bind_async_action(CustomAction(manager=self.manager), finished_call=self._finish_custom_action) + self.thread_custom_action = self._bind_async_action(CustomAction(manager=self.manager, i18n=self.i18n), finished_call=self._finish_custom_action) self.thread_screenshots = self._bind_async_action(GetScreenshots(self.manager), finished_call=self._finish_get_screenshots) self.thread_apply_filters = ApplyFilters() @@ -239,7 +240,7 @@ def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager self.thread_apply_filters.signal_table.connect(self._update_table_and_upgrades) self.signal_table_update.connect(self.thread_apply_filters.stop_waiting) - self.thread_install = InstallPackage(manager=self.manager, disk_cache=self.disk_cache, icon_cache=self.icon_cache, locale_keys=self.i18n) + self.thread_install = InstallPackage(manager=self.manager, disk_cache=self.disk_cache, icon_cache=self.icon_cache, i18n=self.i18n) self._bind_async_action(self.thread_install, finished_call=self._finish_install) self.thread_animate_progress = AnimateProgress() @@ -289,7 +290,7 @@ def __init__(self, i18n: dict, icon_cache: MemoryCache, manager: SoftwareManager self.dialog_about = None self.first_refresh = suggestions - self.thread_warnings = ListWarnings(man=manager, locale_keys=i18n) + self.thread_warnings = ListWarnings(man=manager, i18n=i18n) self.thread_warnings.signal_warnings.connect(self._show_warnings) def set_tray_icon(self, tray_icon): @@ -349,7 +350,7 @@ def _ask_confirmation(self, msg: dict): self.thread_animate_progress.pause() diag = ConfirmationDialog(title=msg['title'], body=msg['body'], - locale_keys=self.i18n, + i18n=self.i18n, components=msg['components'], confirmation_label=msg['confirmation_label'], deny_label=msg['deny_label']) @@ -792,7 +793,7 @@ def update_selected(self): if to_update and dialog.ask_confirmation(title=self.i18n['manage_window.upgrade_all.popup.title'], body=self.i18n['manage_window.upgrade_all.popup.body'], - locale_keys=self.i18n, + i18n=self.i18n, widgets=[UpdateToggleButton(None, self, self.i18n, clickable=False)]): pwd = None diff --git a/bauh/view/util/translation.py b/bauh/view/util/translation.py new file mode 100644 index 00000000..ae3a349d --- /dev/null +++ b/bauh/view/util/translation.py @@ -0,0 +1,67 @@ +import glob +import locale +from typing import Tuple + +from bauh.view.util import resource + + +class I18n(dict): + + def __init__(self, current_locale: dict, default_locale: dict): + super(I18n, self).__init__() + self.current = current_locale + self.default = default_locale + + def __getitem__(self, item): + try: + return self.current.__getitem__(item) + except KeyError: + if self.default: + return self.default.__getitem__(item) + else: + raise + + def get(self, *args, **kwargs): + res = self.current.get(args[0]) + + if res is None: + if self.default: + return self.default.get(*args, **kwargs) + else: + return self.current.get(*args, **kwargs) + + return res + + +def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale')) -> Tuple[str, dict]: + + locale_path = None + + if key is None: + current_locale = locale.getdefaultlocale() + else: + current_locale = [key.strip().lower()] + + if current_locale: + current_locale = current_locale[0] + + for locale_file in glob.glob(locale_dir + '/*'): + name = locale_file.split('/')[-1] + + if current_locale == name or current_locale.startswith(name + '_'): + locale_path = locale_file + break + + if not locale_path: + return key, {} + + with open(locale_path, 'r') as f: + locale_keys = f.readlines() + + locale_obj = {} + for line in locale_keys: + if line: + keyval = line.strip().split('=') + locale_obj[keyval[0].strip()] = keyval[1].strip() + + return locale_path.split('/')[-1], locale_obj diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index f4f3efc7..c4ffb795 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -1,9 +1,6 @@ -import glob -import locale import os import subprocess import sys -from typing import Tuple from PyQt5.QtCore import QCoreApplication @@ -12,40 +9,6 @@ from bauh.view.util import resource -def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale')) -> Tuple[str, dict]: - - locale_path = None - - if key is None: - current_locale = locale.getdefaultlocale() - else: - current_locale = [key.strip().lower()] - - if current_locale: - current_locale = current_locale[0] - - for locale_file in glob.glob(locale_dir + '/*'): - name = locale_file.split('/')[-1] - - if current_locale == name or current_locale.startswith(name + '_'): - locale_path = locale_file - break - - if not locale_path: - locale_path = resource.get_path('locale/en') - - with open(locale_path, 'r') as f: - locale_keys = f.readlines() - - locale_obj = {} - for line in locale_keys: - if line: - keyval = line.strip().split('=') - locale_obj[keyval[0].strip()] = keyval[1].strip() - - return locale_path.split('/')[-1], locale_obj - - def notify_user(msg: str, icon_path: str = resource.get_path('img/logo.svg')): os.system("notify-send -a {} {} '{}'".format(__app_name__, "-i {}".format(icon_path) if icon_path else '', msg)) From 3bd493e22560679191becf4d26d0d761b140c7a8 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 13:42:32 -0300 Subject: [PATCH 02/38] [improvement] Adding all english i18n keys to help people with the application translation --- CHANGELOG.md | 1 + bauh/gems/arch/resources/locale/en | 34 ++++++++++++++++++++++++++- bauh/gems/flatpak/resources/locale/en | 23 +++++++++++++++++- bauh/gems/snap/resources/locale/en | 12 +++++++++- 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a90a5c77..e65a9dc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.7.3] ### Improvements - Not breaking the application when a i18n (translation) key was not found +- Adding all english (**en**) i18n keys to help people with the application translation ## [0.7.2] 2019-11-01 ### Improvements diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index 31816086..04f78d3d 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -62,4 +62,36 @@ arch.install.aur.unknown_key.body=To continue {} installation is necessary to tr arch.aur.install.unknown_key.status=Receiving public key {} arch.aur.install.unknown_key.receive_error=Could not receive public key {} arch.aur.install.validity_check.title=Integrity issues -arch.aur.install.validity_check.body=Some of the source-files needed for {} installation are not healthy. The installation will be cancelled to prevent damage to your system. \ No newline at end of file +arch.aur.install.validity_check.body=Some of the source-files needed for {} installation are not healthy. The installation will be cancelled to prevent damage to your system. +aur.info.architecture=architecture +aur.info.architecture.any=any +aur.info.build date=build date +aur.info.depends on=depends on +aur.info.description=description +aur.info.install date=install date +aur.info.install reason=install reason +aur.info.install reason.explicitly installed=explicitly installed +aur.info.install script=install script +aur.info.install script.no=no +aur.info.installed size=installed size +aur.info.licenses=licenses +aur.info.name=name +aur.info.optional deps=optional deps +aur.info.packager=packager +aur.info.packager.unknown packager=unknown +aur.info.url=url +aur.info.version=version +aur.info.arch=arch +aur.info.arch.any=any +aur.info.depends=depends +aur.info.pkgdesc=description +aur.info.pkgname=name +aur.info.pkgrel=release +aur.info.pkgver=version +aur.info.source=source +aur.info.optdepends=optionally depends +aur.info.license=license +aur.info.validpgpkeys=valid PGP keys +aur.info.options=options +aur.info.provides=provides +aur.info.conflicts with=conflicts with \ No newline at end of file diff --git a/bauh/gems/flatpak/resources/locale/en b/bauh/gems/flatpak/resources/locale/en index b0415238..e89558d8 100644 --- a/bauh/gems/flatpak/resources/locale/en +++ b/bauh/gems/flatpak/resources/locale/en @@ -17,4 +17,25 @@ flatpak.info.homepageurl=Home url flatpak.info.instoresincedate=added in flatpak.info.projectlicense=license flatpak.info.translateurl=translate url -flatpak.info.developername=developer \ No newline at end of file +flatpak.info.developername=developer +flatpak.info.arch=arch +flatpak.info.branch=branch +flatpak.info.collection=collection +flatpak.info.commit=commit +flatpak.info.date=date +flatpak.info.description=description +flatpak.info.id=id +flatpak.info.installation=installation +flatpak.info.installed=installed +flatpak.info.license=license +flatpak.info.name=name +flatpak.info.origin=origin +flatpak.info.parent=parent +flatpak.info.ref=ref +flatpak.info.runtime=runtime +flatpak.info.sdk=sdk +flatpak.info.subject=subject +flatpak.info.type=type +flatpak.info.version=version +flatpak.history.date=date +flatpak.history.commit=commit \ No newline at end of file diff --git a/bauh/gems/snap/resources/locale/en b/bauh/gems/snap/resources/locale/en index 36f39134..2155e858 100644 --- a/bauh/gems/snap/resources/locale/en +++ b/bauh/gems/snap/resources/locale/en @@ -5,4 +5,14 @@ snap.notifications.api.unavailable=It seems the {} API is unavailable at the mom snap.action.refresh.status=Refreshing snap.action.refresh.label=Refresh snap.install.available_channels.title=Available channels -snap.install.available_channels.body=There is no {} channel available for {}. But there are these below ( select one if you want to continue ) \ No newline at end of file +snap.install.available_channels.body=There is no {} channel available for {}. But there are these below ( select one if you want to continue ) +snap.info.commands=commands +snap.info.contact=contact +snap.info.description=description +snap.info.license=license +snap.info.revision=revision +snap.info.tracking=tracking +snap.info.installed=installed +snap.info.publisher=publisher +snap.info.version=version +snap.info.size=size \ No newline at end of file From 3f982fe9b0555f48bfede7c77b82225ac3181209 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 14:59:05 -0300 Subject: [PATCH 03/38] [aur dist] more i18n for desktop entries --- aur/bauh.desktop | 16 ++++++++++++---- aur/bauh_tray.desktop | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/aur/bauh.desktop b/aur/bauh.desktop index d4cabde6..d32e39ed 100644 --- a/aur/bauh.desktop +++ b/aur/bauh.desktop @@ -1,9 +1,17 @@ [Desktop Entry] Type=Application -Name=bauh +Name=Applications manager ( bauh ) +Name[pt]=Gerenciador de aplicativos ( bauh ) +Name[es]=Administrador de aplicaciones ( bauh ) +Name[ca]=Gestor d aplicacions ( bauh ) +Name[it]=Gestore delle applicazioni ( bauh ) +Name[de]=Anwendungsmanager ( bauh ) Categories=System; -Comment=Manage your Flatpak / Snap / AppImage / AUR applications -Comment[pt]=Gerencie seus aplicativos Flatpak / Snap / AppImage / AUR -Comment[es]=Administre sus aplicaciones Flatpak / Snap / AppImage / AUR +Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) +Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap ) +Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap ) +Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap ) +Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap ) +Comment[ca]=Instal lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) Exec=/usr/bin/bauh Icon=bauh \ No newline at end of file diff --git a/aur/bauh_tray.desktop b/aur/bauh_tray.desktop index 3b7abd19..596c4f1c 100644 --- a/aur/bauh_tray.desktop +++ b/aur/bauh_tray.desktop @@ -1,11 +1,17 @@ [Desktop Entry] Type=Application -Name=bauh ( tray ) -Name[pt]=bauh ( bandeja ) -Name[es]=bauh ( bandeja ) +Name=Applications manager ( bauh - tray ) +Name[pt]=Gerenciador de aplicativos ( bauh - bandeja ) +Name[es]=Administrador de aplicaciones ( bauh - bandeja ) +Name[ca]=Gestor d aplicacions ( bauh - safata ) +Name[it]=Gestore delle applicazioni ( bauh - vassoio ) +Name[de]=Anwendungsmanager ( bauh - Tablett ) Categories=System; -Comment=Manage your Flatpak / Snap / AppImage / AUR applications -Comment[pt]=Gerencie seus aplicativos Flatpak / Snap / AppImage / AUR -Comment[es]=Administre sus aplicaciones Flatpak / Snap / AppImage / AUR +Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) +Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap ) +Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap ) +Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap ) +Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap ) +Comment[ca]=Instal lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) Exec=/usr/bin/bauh --tray=1 Icon=bauh \ No newline at end of file From 7e06bacd17ad4c437092cf0a46e28b256f942dde Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 15:07:26 -0300 Subject: [PATCH 04/38] [aur dist] more i18n for desktop entries --- aur/bauh_tray.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aur/bauh_tray.desktop b/aur/bauh_tray.desktop index 596c4f1c..8d1964b3 100644 --- a/aur/bauh_tray.desktop +++ b/aur/bauh_tray.desktop @@ -5,7 +5,7 @@ Name[pt]=Gerenciador de aplicativos ( bauh - bandeja ) Name[es]=Administrador de aplicaciones ( bauh - bandeja ) Name[ca]=Gestor d aplicacions ( bauh - safata ) Name[it]=Gestore delle applicazioni ( bauh - vassoio ) -Name[de]=Anwendungsmanager ( bauh - Tablett ) +Name[de]=Anwendungsmanager ( bauh - tablett ) Categories=System; Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap ) From 8f3cc69e5d4a26f2b10d0ac14261e5de709ac272 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 16:03:56 -0300 Subject: [PATCH 05/38] [improvements][appimage] AppImage updater daemon replaced by a default Python thread to reduce memory usage --- CHANGELOG.md | 4 +++- README.md | 2 +- bauh/gems/appimage/controller.py | 13 ++++++------- bauh/gems/appimage/db.py | 18 ------------------ bauh/gems/appimage/worker.py | 18 ++++++++++-------- 5 files changed, 20 insertions(+), 35 deletions(-) delete mode 100644 bauh/gems/appimage/db.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e65a9dc6..fd38bc2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.7.3] +## [0.7.3] 2019- ### Improvements - Not breaking the application when a i18n (translation) key was not found - Adding all english (**en**) i18n keys to help people with the application translation +- AppImage: + - AppImage updater daemon replaced by a default Python thread to reduce memory usage ## [0.7.2] 2019-11-01 ### Improvements diff --git a/README.md b/README.md index 84a97bd1..f02b4cdd 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings - Installed applications are store at **~/.local/share/bauh/appimage/installed** - Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications** - Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db** -- Databases updater daemon running every 20 minutes. It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**. +- Databases updater daemon running every 20 minutes ( the interval in SECONDS can be changed with the environment variable **BAUH_APPIMAGE_DB_UPDATER_TIME** ). It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**. - All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application. diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 1f5ab7f9..77aef8f1 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -7,6 +7,7 @@ import traceback from datetime import datetime from pathlib import Path +from threading import Lock from typing import Set, Type, List from bauh.api.abstract.context import ApplicationContext @@ -18,7 +19,7 @@ from bauh.api.constants import HOME_PATH from bauh.commons.html import bold from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess -from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions, db +from bauh.gems.appimage import query, INSTALLATION_PATH, suggestions from bauh.gems.appimage.model import AppImage from bauh.gems.appimage.worker import DatabaseUpdater @@ -43,18 +44,19 @@ def __init__(self, context: ApplicationContext): self.http_client = context.http_client self.logger = context.logger self.file_downloader = context.file_downloader - self.dbs_updater = DatabaseUpdater(http_client=context.http_client, logger=context.logger) + self.db_locks = {DB_APPS_PATH: Lock(), DB_RELEASES_PATH: Lock()} + self.dbs_updater = DatabaseUpdater(http_client=context.http_client, logger=context.logger, db_locks=self.db_locks) def _get_db_connection(self, db_path: str) -> sqlite3.Connection: if os.path.exists(db_path): - db.acquire_lock(db_path) + self.db_locks[db_path].acquire() return sqlite3.connect(db_path) else: self.logger.warning("Could not get a database connection. File '{}' not found".format(db_path)) def _close_connection(self, db_path: str, con: sqlite3.Connection): con.close() - db.release_lock(db_path) + self.db_locks[db_path].release() def _gen_app_key(self, app: AppImage): return '{}{}'.format(app.name.lower(), app.github.lower() if app.github else '') @@ -380,9 +382,6 @@ def requires_root(self, action: str, pkg: AppImage): return False def prepare(self): - for path in (DB_APPS_PATH, DB_RELEASES_PATH): - db.release_lock(path) - self.dbs_updater.start() def list_updates(self, internet_available: bool) -> List[PackageUpdate]: diff --git a/bauh/gems/appimage/db.py b/bauh/gems/appimage/db.py deleted file mode 100644 index d4b81cfe..00000000 --- a/bauh/gems/appimage/db.py +++ /dev/null @@ -1,18 +0,0 @@ -import os -import time - - -def acquire_lock(db_path: str): - lock_path = db_path + '.lock' - while True: - if not os.path.exists(lock_path): - open(lock_path, 'a').close() - break - else: - time.sleep(0.0001) - - -def release_lock(db_path: str): - lock_path = db_path + '.lock' - if os.path.exists(lock_path): - os.remove(lock_path) diff --git a/bauh/gems/appimage/worker.py b/bauh/gems/appimage/worker.py index e9449cbe..1dbb108f 100644 --- a/bauh/gems/appimage/worker.py +++ b/bauh/gems/appimage/worker.py @@ -4,27 +4,27 @@ import tarfile import time import traceback -from multiprocessing import Process from pathlib import Path from threading import Thread import requests from bauh.api.http import HttpClient -from bauh.gems.appimage import LOCAL_PATH, db +from bauh.gems.appimage import LOCAL_PATH -class DatabaseUpdater(Thread if bool(int(os.getenv('BAUH_DEBUG', 0))) else Process): +class DatabaseUpdater(Thread): URL_DB = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/dbs.tar.gz' COMPRESS_FILE_PATH = LOCAL_PATH + '/db.tar.gz' - def __init__(self, http_client: HttpClient, logger: logging.Logger): + def __init__(self, http_client: HttpClient, logger: logging.Logger, db_locks: dict): super(DatabaseUpdater, self).__init__(daemon=True) self.http_client = http_client self.logger = logger self.enabled = bool(int(os.getenv('BAUH_APPIMAGE_DB_UPDATER', 1))) - self.sleep = 60 * 20 + self.db_locks = db_locks + self.sleep = int(os.getenv('BAUH_APPIMAGE_DB_UPDATER_TIME', 60 * 20)) def _download_databases(self): self.logger.info('Retrieving AppImage databases') @@ -44,9 +44,11 @@ def _download_databases(self): if old_db_files: self.logger.info('Deleting old database files') for f in old_db_files: - db.acquire_lock(f) - os.remove(f) - db.release_lock(f) + self.db_locks[f].acquire() + try: + os.remove(f) + finally: + self.db_locks[f].release() self.logger.info('Old database files deleted') From 0d97b67b4579e44ef24517d843da16242e4b9d5d Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 16:12:14 -0300 Subject: [PATCH 06/38] [aur dist] fix catalan symbol --- aur/bauh.desktop | 2 +- aur/bauh_tray.desktop | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aur/bauh.desktop b/aur/bauh.desktop index d32e39ed..cdf0cc9b 100644 --- a/aur/bauh.desktop +++ b/aur/bauh.desktop @@ -12,6 +12,6 @@ Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap ) Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap ) Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap ) Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap ) -Comment[ca]=Instal lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) +Comment[ca]=Instal·lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) Exec=/usr/bin/bauh Icon=bauh \ No newline at end of file diff --git a/aur/bauh_tray.desktop b/aur/bauh_tray.desktop index 8d1964b3..088eb2aa 100644 --- a/aur/bauh_tray.desktop +++ b/aur/bauh_tray.desktop @@ -12,6 +12,6 @@ Comment[pt]=Instale e remova aplicativos ( AppImage, AUR, Flatpak, Snap ) Comment[es]=Instalar y eliminar aplicaciones ( AppImage, AUR, Flatpak, Snap ) Comment[it]=Installa e rimuovi applicazioni ( AppImage, AUR, Flatpak, Snap ) Comment[de]=Anwendungen installieren und entfernen ( AppImage, AUR, Flatpak, Snap ) -Comment[ca]=Instal lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) +Comment[ca]=Instal·lar i eliminar aplicacions ( AppImage, AUR, Flatpak, Snap ) Exec=/usr/bin/bauh --tray=1 Icon=bauh \ No newline at end of file From d79433a8d1680404c8bbf7535296a714a44298b8 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 17:06:22 -0300 Subject: [PATCH 07/38] [fix][flatpak] Ignoring no related updates --- CHANGELOG.md | 6 +++++- bauh/gems/flatpak/flatpak.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd38bc2b..bc4d1541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Improvements - Not breaking the application when a i18n (translation) key was not found - Adding all english (**en**) i18n keys to help people with the application translation -- AppImage: +- AppImage - AppImage updater daemon replaced by a default Python thread to reduce memory usage +### Fixes +- Flatpak + - Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed ) + ## [0.7.2] 2019-11-01 ### Improvements - Snap diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py index 328adb78..c5c7f494 100755 --- a/bauh/gems/flatpak/flatpak.py +++ b/bauh/gems/flatpak/flatpak.py @@ -144,7 +144,7 @@ def update(app_ref: str): :param app_ref: :return: """ - return new_subprocess([BASE_CMD, 'update', '-y', app_ref]) + return new_subprocess([BASE_CMD, 'update', '--no-related', '-y', app_ref]) def uninstall(app_ref: str): @@ -158,7 +158,7 @@ def uninstall(app_ref: str): def list_updates_as_str(version: str): if version < '1.2': - return run_cmd('{} update'.format(BASE_CMD), ignore_return_code=True) + return run_cmd('{} update --no-related'.format(BASE_CMD), ignore_return_code=True) else: updates = new_subprocess([BASE_CMD, 'update']).stdout From 79c59e8725bb185350aec2b49b4d75bce4327476 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 25 Nov 2019 17:29:55 -0300 Subject: [PATCH 08/38] [fix][flatpak] downgrade: ignoring no related updates --- bauh/gems/flatpak/flatpak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py index c5c7f494..10791db4 100755 --- a/bauh/gems/flatpak/flatpak.py +++ b/bauh/gems/flatpak/flatpak.py @@ -175,7 +175,7 @@ def list_updates_as_str(version: str): def downgrade(app_ref: str, commit: str, root_password: str) -> subprocess.Popen: - return new_root_subprocess([BASE_CMD, 'update', '--commit={}'.format(commit), app_ref, '-y'], root_password) + return new_root_subprocess([BASE_CMD, 'update', '--no-related', '--commit={}'.format(commit), app_ref, '-y'], root_password) def get_app_commits(app_ref: str, origin: str) -> List[str]: From fa6079dc75f89ea48b1d16ba0076cef470b62c5b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:24:57 -0300 Subject: [PATCH 09/38] [improvement][flatpak][snap] caching suggestions --- CHANGELOG.md | 3 +++ bauh/gems/flatpak/controller.py | 15 +++++++++++---- bauh/gems/snap/controller.py | 18 +++++++++++++----- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc4d1541..c9802496 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Adding all english (**en**) i18n keys to help people with the application translation - AppImage - AppImage updater daemon replaced by a default Python thread to reduce memory usage +- Caching Snap and Flatpak suggestions (https://github.com/vinifmor/bauh/issues/23) +- i18n: + - Italian contributions by [albanobattistella](https://github.com/albanobattistella) ### Fixes - Flatpak diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 2f6a688b..2227ae7a 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -29,6 +29,7 @@ def __init__(self, context: ApplicationContext): context.disk_loader_factory.map(FlatpakApplication, self.api_cache) self.enabled = True self.http_client = context.http_client + self.suggestions_cache = context.cache_factory.new() def get_managed_types(self) -> Set["type"]: return {FlatpakApplication} @@ -264,12 +265,18 @@ def list_suggestions(self, limit: int) -> List[PackageSuggestion]: sugs.sort(key=lambda t: t[1].value, reverse=True) for sug in sugs: - if limit <= 0 or len(res) < limit: - app_json = flatpak.search(cli_version, sug[0], app_id=True) + cached_sug = self.suggestions_cache.get(sug[0]) + + if cached_sug: + res.append(cached_sug) + else: + app_json = flatpak.search(cli_version, sug[0], app_id=True) - if app_json: - res.append(PackageSuggestion(self._map_to_model(app_json[0], False, None), sug[1])) + if app_json: + model = PackageSuggestion(self._map_to_model(app_json[0], False, None), sug[1]) + self.suggestions_cache.add(sug[0], model) + res.append(model) else: break diff --git a/bauh/gems/snap/controller.py b/bauh/gems/snap/controller.py index 24a5f42e..cc4a5ae3 100644 --- a/bauh/gems/snap/controller.py +++ b/bauh/gems/snap/controller.py @@ -35,6 +35,7 @@ def __init__(self, context: ApplicationContext): self.categories = {} self.categories_downloader = CategoriesDownloader('snap', self.http_client, self.logger, self, context.disk_cache, URL_CATEGORIES_FILE, SNAP_CACHE_PATH, CATEGORIES_FILE_PATH) + self.suggestions_cache = context.cache_factory.new() def map_json(self, app_json: dict, installed: bool, disk_loader: DiskCacheLoader, internet: bool = True) -> SnapApplication: app = SnapApplication(publisher=app_json.get('publisher'), @@ -222,7 +223,9 @@ def _fill_suggestion(self, pkg_name: str, priority: SuggestionPriority, out: Lis pkg['rev'] = pkg['revision'] pkg['name'] = pkg_name - out.append(PackageSuggestion(self.map_json(pkg, installed=False, disk_loader=None), priority)) + sug = PackageSuggestion(self.map_json(pkg, installed=False, disk_loader=None), priority) + self.suggestions_cache.add(pkg_name, sug) + out.append(sug) else: self.logger.warning("Could not retrieve suggestion '{}'".format(pkg_name)) @@ -239,10 +242,15 @@ def list_suggestions(self, limit: int) -> List[PackageSuggestion]: for sug in sugs: if limit <= 0 or len(res) < limit: - t = Thread(target=self._fill_suggestion, args=(sug[0], sug[1], res)) - t.start() - threads.append(t) - time.sleep(0.001) # to avoid being blocked + cached_sug = self.suggestions_cache.get(sug[0]) + + if cached_sug: + res.append(cached_sug) + else: + t = Thread(target=self._fill_suggestion, args=(sug[0], sug[1], res)) + t.start() + threads.append(t) + time.sleep(0.001) # to avoid being blocked else: break From e8d03ff1bb20580271504cc26a3308aa52629660 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:26:16 -0300 Subject: [PATCH 10/38] [CHANGELOG] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9802496..a8acd124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Adding all english (**en**) i18n keys to help people with the application translation - AppImage - AppImage updater daemon replaced by a default Python thread to reduce memory usage -- Caching Snap and Flatpak suggestions (https://github.com/vinifmor/bauh/issues/23) +- Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - Italian contributions by [albanobattistella](https://github.com/albanobattistella) From b8a4ecf63a38f5aebaeccb9ced40c123225e9b35 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:33:41 -0300 Subject: [PATCH 11/38] [README] --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f02b4cdd..cd4f42f9 100644 --- a/README.md +++ b/README.md @@ -53,15 +53,15 @@ It may require **sudo**, but prefer the **Manual installation** described below ### Manual installation: -If you prefer a manual and isolated installation, type the following commands within the cloned project folder: +If you prefer a manual and isolated installation, open your favorite terminal application and type the following commands: ``` -python3 -m venv env ( creates a virtualenv in a folder called **env** ) -env/bin/pip install . ( installs the application code inside the **env** ) -env/bin/bauh ( launches the application ) +python3 -m venv bauh_env ( creates a virtualenv in a folder called **bauh_env** ) +bauh_env/bin/pip install bauh ( installs bauh in the isolated environment ) +bauh_env/bin/bauh ( launches bauh ) ``` -If you do not want to clone / download this repository, go to your **Home** folder and execute the commands above, but replace the second by ```env/bin/pip install bauh```. +P.S: if you want to launch it attached to your system tray, replace the last command by: ```bauh_env/bin/bauh --tray=1``` ### Autostart In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). From 79bf5c2f9ef5b42f1edcee81b35482507f6aba51 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:50:56 -0300 Subject: [PATCH 12/38] [README] improving the Manual Installation section --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd4f42f9..a5a4637a 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ As [**bauh**](https://aur.archlinux.org/packages/bauh) package. There is also a It may require **sudo**, but prefer the **Manual installation** described below to not mess up with your system libraries. -### Manual installation: -If you prefer a manual and isolated installation, open your favorite terminal application and type the following commands: +### Manual installation +- If you prefer a manual and isolated installation, open your favorite terminal application and type the following commands: ``` python3 -m venv bauh_env ( creates a virtualenv in a folder called **bauh_env** ) @@ -63,6 +63,27 @@ bauh_env/bin/bauh ( launches bauh ) P.S: if you want to launch it attached to your system tray, replace the last command by: ```bauh_env/bin/bauh --tray=1``` +- To update it to latest version: +``` +bauh_env/bin/pip install bauh --upgrade +``` + +- To uninstall it, just remove the **bauh_env** folder. + +- To create a shortcut ( desktop entry ) in your system menu, create a file called **bauh.desktop** in **~/.local/share/applications** with the following content ( I assume in this example you created the isolated environment in your home folder using Python 3.7 ): +``` +[Desktop Entry] +Type=Application +Name=bauh +Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) +Exec=/home/$USER/bauh_env/bin/bauh +Icon=/home/$USER/bauh_env/lib/python3.7/site-packages/bauh/view/resources/img/logo.svg +``` + +If you want a shortcut to the tray, put the **--tray=1** in the end of the **Exec** line ( e.g: Exec=/home/$USER/bauh_env/bin/bauh --tray=1 ) + +P.S: If the shortcut is not working, try to replace the **$USER** var by your user name. + ### Autostart In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). From e9878a946ac8c8f2e1b941293d6f7da8d36ea35a Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:54:07 -0300 Subject: [PATCH 13/38] [README] --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a5a4637a..ad1691d8 100644 --- a/README.md +++ b/README.md @@ -60,17 +60,17 @@ python3 -m venv bauh_env ( creates a virtualenv in a folder called **bauh_env** bauh_env/bin/pip install bauh ( installs bauh in the isolated environment ) bauh_env/bin/bauh ( launches bauh ) ``` - -P.S: if you want to launch it attached to your system tray, replace the last command by: ```bauh_env/bin/bauh --tray=1``` + - P.S: if you want to launch it attached to your system tray, replace the last command by: ```bauh_env/bin/bauh --tray=1``` - To update it to latest version: ``` bauh_env/bin/pip install bauh --upgrade ``` -- To uninstall it, just remove the **bauh_env** folder. +- To uninstall it: + - Just remove the **bauh_env** folder -- To create a shortcut ( desktop entry ) in your system menu, create a file called **bauh.desktop** in **~/.local/share/applications** with the following content ( I assume in this example you created the isolated environment in your home folder using Python 3.7 ): +- To create a shortcut ( desktop entry ) for bauh in your system menu: create a file called **bauh.desktop** in **~/.local/share/applications** with the following content ( I assume in this example you created the isolated environment in your home folder using Python 3.7 ): ``` [Desktop Entry] Type=Application @@ -79,10 +79,8 @@ Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) Exec=/home/$USER/bauh_env/bin/bauh Icon=/home/$USER/bauh_env/lib/python3.7/site-packages/bauh/view/resources/img/logo.svg ``` - -If you want a shortcut to the tray, put the **--tray=1** in the end of the **Exec** line ( e.g: Exec=/home/$USER/bauh_env/bin/bauh --tray=1 ) - -P.S: If the shortcut is not working, try to replace the **$USER** var by your user name. + - If you want a shortcut to the tray, put the **--tray=1** in the end of the **Exec** line ( e.g: **Exec=/home/$USER/bauh_env/bin/bauh --tray=1** ) + - P.S: If the shortcut is not working, try to replace the **$USER** var by your user name. ### Autostart In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). From 5c7d0f69da30949f3f28897c58df5f5c83d768bb Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 12:59:31 -0300 Subject: [PATCH 14/38] [README] --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ad1691d8..2ddb18e1 100644 --- a/README.md +++ b/README.md @@ -59,18 +59,19 @@ It may require **sudo**, but prefer the **Manual installation** described below python3 -m venv bauh_env ( creates a virtualenv in a folder called **bauh_env** ) bauh_env/bin/pip install bauh ( installs bauh in the isolated environment ) bauh_env/bin/bauh ( launches bauh ) + +# P.S: if you want to launch it attached to your system tray, replace the last command by: bauh_env/bin/bauh --tray=1 ``` - - P.S: if you want to launch it attached to your system tray, replace the last command by: ```bauh_env/bin/bauh --tray=1``` -- To update it to latest version: +- To update you isolated bauh to latest version: ``` bauh_env/bin/pip install bauh --upgrade ``` -- To uninstall it: - - Just remove the **bauh_env** folder +- To uninstall it just remove the **bauh_env** folder -- To create a shortcut ( desktop entry ) for bauh in your system menu: create a file called **bauh.desktop** in **~/.local/share/applications** with the following content ( I assume in this example you created the isolated environment in your home folder using Python 3.7 ): +- To create a shortcut ( desktop entry ) for it in your system menu ( assuming you created the isolated environment in your home folder using Python 3.7 ): + - Create a file called **bauh.desktop** in **~/.local/share/applications** with the following content ``` [Desktop Entry] Type=Application @@ -79,8 +80,9 @@ Comment=Install and remove applications ( AppImage, AUR, Flatpak, Snap ) Exec=/home/$USER/bauh_env/bin/bauh Icon=/home/$USER/bauh_env/lib/python3.7/site-packages/bauh/view/resources/img/logo.svg ``` - - If you want a shortcut to the tray, put the **--tray=1** in the end of the **Exec** line ( e.g: **Exec=/home/$USER/bauh_env/bin/bauh --tray=1** ) - - P.S: If the shortcut is not working, try to replace the **$USER** var by your user name. + +- If you want a shortcut to the tray, put the **--tray=1** parameter in the end of the **Exec** line of the example above ( e.g: **Exec=/home/$USER/bauh_env/bin/bauh --tray=1** ) +- P.S: If the shortcut is not working, try to replace the **$USER** var by your user name. ### Autostart In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). From e2b86680ec8805d0245c1b9927f2cc3cae20adf7 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 13:02:07 -0300 Subject: [PATCH 15/38] [README] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ddb18e1..1062cafe 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ To contribute with this project, have a look at [CONTRIBUTING.md](https://github ![management panel](https://raw.githubusercontent.com/vinifmor/bauh/master/pictures/panel.png) -### Developed with: +### Developed with - Python3 and Qt5. ### Requirements @@ -63,7 +63,7 @@ bauh_env/bin/bauh ( launches bauh ) # P.S: if you want to launch it attached to your system tray, replace the last command by: bauh_env/bin/bauh --tray=1 ``` -- To update you isolated bauh to latest version: +- To update your isolated bauh to the latest version: ``` bauh_env/bin/pip install bauh --upgrade ``` From 1ca4a32a6cbdbd3800722557ed31f262cfc9b506 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 13:13:21 -0300 Subject: [PATCH 16/38] [CHANGELOG] catalna i18n --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8acd124..76221146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AppImage updater daemon replaced by a default Python thread to reduce memory usage - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - - Italian contributions by [albanobattistella](https://github.com/albanobattistella) - + - Catalan contributions by [fitojb](https://github.com/fitojb) + - Italian contributions by [albanobattistella](https://github.com/albanobattistella) + ### Fixes - Flatpak - Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed ) From 67e7d49abed75d8ef3c339246aa1e7e21a85090e Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 13:22:31 -0300 Subject: [PATCH 17/38] [CONTRIBUTING] --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 83c87a6a..277c492c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ The way to go here is to ask yourself if the improvement would be useful for mor * Follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) code style to keep the code consistent. # Adding a new translation -* To add a new translation, you will have to create a file in each directory listed below named as the first two letters in the ISO format (e.g: for 'english' would be 'en'): +* To add a new translation, you will have to create a file in each directory listed below named as the first two letters of the language in the ISO format (e.g: for 'english' would be 'en'): - **bauh/view/resources/locale** - **bauh/gems/appimage/resources/locale** - **bauh/gems/arch/resources/locale** From bed3db69e667cb54ce06dbca0188ba418dc54e1a Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 17:31:44 -0300 Subject: [PATCH 18/38] [fix][aur] Removing repeated 'prepare' step that was delaying the build and preventing some packages to install --- CHANGELOG.md | 2 ++ bauh/gems/arch/controller.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76221146..a1b1563d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixes - Flatpak - Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed ) +- AUR + - Removing repeated **prepare** step that was delaying the build and preventing some packages to install (e.g: xdman ) ## [0.7.2] 2019-11-01 ### Improvements diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 62e826f5..c89a2328 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -435,7 +435,7 @@ def _make_pkg(self, pkgname: str, maintainer: str, root_password: str, handler: # building main package handler.watcher.change_substatus(self.i18n['arch.building.package'].format(bold(pkgname))) - pkgbuilt, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcsmf'], cwd=project_dir)) + pkgbuilt, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcsmf', '--noprepare'], cwd=project_dir)) self._update_progress(handler.watcher, 65, change_progress) if pkgbuilt: From 7720d4d3e31d44f94c4406e6b44e25ac5fa4962f Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 19:09:00 -0300 Subject: [PATCH 19/38] [ui][aur] improved Required / Optional confirmation dialogs --- CHANGELOG.md | 5 ++++ bauh/api/abstract/view.py | 3 ++- bauh/gems/arch/confirmation.py | 32 ++++++++++++++++++++---- bauh/gems/arch/resources/img/mirror.png | Bin 0 -> 6591 bytes bauh/view/qt/components.py | 8 ++++++ 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100755 bauh/gems/arch/resources/img/mirror.png diff --git a/CHANGELOG.md b/CHANGELOG.md index a1b1563d..6d5ef2f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed ) - AUR - Removing repeated **prepare** step that was delaying the build and preventing some packages to install (e.g: xdman ) + +### UI +- AUR + - Textual dependencies replaced by read-only checkboxes on Required Dependencies confirmation dialog + - Optional Dependencies installation dialog now has a type icon beside the dependency name ## [0.7.2] 2019-11-01 ### Improvements diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py index 3caf1dc1..3cf6103c 100644 --- a/bauh/api/abstract/view.py +++ b/bauh/api/abstract/view.py @@ -28,7 +28,7 @@ class InputOption: Represents a select component option. """ - def __init__(self, label: str, value: object, tooltip: str = None, icon_path: str = None): + def __init__(self, label: str, value: object, tooltip: str = None, icon_path: str = None, read_only: bool = False): """ :param label: the string that will be shown to the user :param value: the option value (not shown) @@ -45,6 +45,7 @@ def __init__(self, label: str, value: object, tooltip: str = None, icon_path: st self.value = value self.tooltip = tooltip self.icon_path = icon_path + self.read_only = read_only def __hash__(self): return hash(self.label) + hash(self.value) diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index dd114388..d88653b7 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -2,15 +2,28 @@ from bauh.api.abstract.handler import ProcessWatcher from bauh.api.abstract.view import MultipleSelectComponent, InputOption +from bauh.commons import resource from bauh.commons.html import bold +from bauh.gems.arch import ROOT_DIR from bauh.view.util.translation import I18n +def _get_mirror_icon(mirror: str): + return resource.get_path('img/{}.png'.format('arch' if mirror == 'aur' else 'mirror'), ROOT_DIR) + + def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: I18n) -> Set[str]: - opts = [InputOption('{}{} ( {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', d['mirror'].upper()), p) for p, d in pkg_mirrors.items()] + opts = [] + + for p, d in pkg_mirrors.items(): + op = InputOption('{}{} ( {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', d['mirror'].upper()), p) + op.icon_path = _get_mirror_icon(d['mirror']) + opts.append(op) + view_opts = MultipleSelectComponent(label='', options=opts, default_options=None) + install = watcher.request_confirmation(title=i18n['arch.install.optdeps.request.title'], body='

{}

'.format(i18n['arch.install.optdeps.request.body'].format(bold(pkgname)) + ':'), components=[view_opts], @@ -22,8 +35,17 @@ def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatch def request_install_missing_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: I18n) -> bool: - deps_str = ''.join(['
- {} ( {} )'.format(d, m.upper()) for d, m in pkg_mirrors.items()]) - msg = '

{}

'.format(i18n['arch.missing_deps.body'].format(bold(pkgname)) + ':
' + deps_str) - msg += i18n['ask.continue'] + msg = '

{}

'.format(i18n['arch.missing_deps.body'].format(bold(pkgname)) + ':') + + opts = [] + for p, m in pkg_mirrors.items(): + op = InputOption('{} ( {} )'.format(p, m), p) + op.read_only = True + op.icon_path = _get_mirror_icon(m) + opts.append(op) + + comps = [ + MultipleSelectComponent(label='', options=opts, default_options=set(opts)) + ] - return watcher.request_confirmation(i18n['arch.missing_deps.title'], msg) + return watcher.request_confirmation(i18n['arch.missing_deps.title'], msg, comps, confirmation_label=i18n['continue'].capitalize()) diff --git a/bauh/gems/arch/resources/img/mirror.png b/bauh/gems/arch/resources/img/mirror.png new file mode 100755 index 0000000000000000000000000000000000000000..b4d85c0d16dbf08e2c182cb278fd685baa057e4d GIT binary patch literal 6591 zcmV;w89?TVP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*tcI3K_g#U9Dy#&s~ayXvTJLu*27nE#QxrW>K zowlp2Or??{fj}TY$n5|5?_>UppOmXLF_oHI&X%9pV)LCB)jmJZ(b;(aK5srgb3dOq zpC5Qm1&-l)oA-Nt=Y0D5LW%GB@$-38<~vS(2YNsF7%=G0o)_z#@>G$@#R{C*9&VSz7|Lkg)?2kV`+V8A-&VE+c zV>Xy8zl-`<%6-L!19OJ^wajnff8uqyzm4B&yPbG#vD9Jg;7xNLiys%=a@`%b?{T`x z6rDt$s=U~78$gu$rrfcTP0=pg0 z5F@!SY=!IRV3Xm}XrFj-WxWGnBJQ1-j0BbJ(%spU%vIx*vGJC6oMO zmOh4%aZdHRH{U7lUh9*8PD3v^B840Zt|4@AR*WfT;;jOqZc<1wrIb@iHMP`p$T6p! zbIIbVUP6f_m0U`xrIlVojWyL=ORcrl-h2ztSTZfQ(rRn1cW&BaXROZkofE^4Fycrf zk230Lqfg*7<4iNpGV5%!FTcWq0?f**th(Cj+ijq<<4!y8vg>ZUAFy`9i6@^5r#7m+~=$6P+aa43GKf@OY620JN9SY;`euc}_mF z%?A@g^2{>HIm^jocrb3~({Z1^`|{i${bsQ4zxA8{o#%{P_y6HJBiH@lxnKSE8?UW? z={8&kDGISE3>gSNF4(pE+Lf1nIj(W+$d$4B+P(NR(j2qbI&5q3=!EW!cP-+rvhwKr zoSMq&5kH@qcuP7vx#>9Lvc;t`i#U&Ix4lansc`iS`C_Vj04E)wazt8 zH8Fl#XU>3D*)7%+cfEHi?GP~~xYq*vH4_=~+tGZTSOZr~k2SPzrnx|L-deX7-CV0~ zD#zvv7I#;$9XREzH_W=9o`EaTP7n>OvrF{#gc*t(+hx$ma`Aebjlc_jjREoc4D*Mq zfKDx%Q*2lsFluH!?34!!(wf5LvuC~tn{O-eGqt6GM{soq-;sWP@6)Qx*>Kgk2DbIA zC11sg{Z9`#Ark!hY=?6Jx<_+oXC@JQ%Z6)<9X0imJhO;(7k$eejo5aRn&1+Q*X!De zN#qc0?a&Uhf?8%T%pw@x{`9WqMVK!ivYD*i){v1H&#|ZLerOf>122zZ__ZxYT?zbT2$gQ}!g8#4z z!>wRZs5WU8SHMCnTlsx&OH7t@ee}U9^6ll7hgCqA-M*h{j-XX;!0qu^4>ZN!5#{F* z3MKG0*F%w^=h69;ZXAYh+%3VMA&60_Xpd7_R>$7*1dVCl!CeD>U6mdhT1 zr`_KHlg)#VX1+^3XaSeftpVzv;Tm3W=8k+Qf=gKsy9 zQi3>taA^FE134Oi0GGv^4OkMs5WAJ_kAiI6xon>w$nHz7+@d&{JIpS2tVrKxkZ+=a zTC!Mx(I6F9@g-z(8Gpu?0R}2BE9@?-46udeGFf(XG&smcU_>fN$eN+*CF|G^n5pF= z$O}3*+A$lZby3hEzri+^{BpQkKBlJeu%agHiQYM(Ma{TX5VFt&1bhN!IKS`FpNK_l zhyXQhd_y&0F3e{ABmPD?QEM&(yp{$ZR=$SrItoA(4k5Bns>UTUI|cxU&iR{gaORtF z$v8t&A%(usIdBbvg8VpJ{+$nhv^aZi$mY=rjqGGFj5`HjBMUDwnsT%Y9pf7}EZQd^x`$x*oR7KM5!8rZ@6B0`nuk@$ZN9Mm?hRW|ZGZ z*bhuTkce|wjJ*NA+q;<3r4U-cxXe%(s&DSocg%(F1Kt<9`ck}^>@RX+$UINvCDJ>x z=8ZfQp!A>u4-YPJSkI-wD_83gV$D0g{TK}q7QW?PV}F$wj6s}@Kg1bvb!vIiY=J>u?>d>LyG%5GQ3O_tWJgiT9V*ucv;Wx)vX zkYdweMQ$e4KfD-h2C!9teb7H25$FR#!02UIxjX_G^j50RdZ<((-4c33=`}JiMozh) z8GlQ(5yketa10N!&(+=T)!pM^0VyV=`A}w;uea!t6jS{1V#kW7P1e>F+U-OBv(Qff zsl2!ldI03G3+!qy6HC+i$lE@zyUp*^_b#8g=T88*5 zH~yMp4~u&L)R9!nkA#vABGL*a`3%kgcU!F_2+G$t#H-{ML}LpnPYMVHmJ`Czb4LOt zWV8h-tVQY?gtSWfIFD(gP2!sz|G=25{!mE${b+81MXftxCVe8Q*Cv5%k9RToRFNxU z!$`{TNZeVfwB`2%Z*GRqqy$oCN24Je8B!M$OQ^qmhTBF&t){Z3??bSpL1Qc*MLaY%1 zJsreJzC0A>&bSb&W6F}~Zc{&@3aA+%MM9kVq+tyTH@A$HawL^=$^9mZKI*$jlQ7`+ zlYJoY$@DgJ57e_UVIdx>ee$5K_`e615N~ppH%(5~xEvv_%oHkn1}{$Tv1p zX@w!F)*YaX;BQI<$QOZ$Q&21kIlELvB1CQ-wU{dzu%I*p!p0$8>s$EA@c+cMe>gfg zc2}4w+}#>C-`yJjv0Jn9tzwDQ^rkBnsi&tWn2|>;j_NePvu)vh7YyWqR2XG$?M6)P zMC@AvhONDF5@Uo!sN^s@r7|HwiAwTKP!Wk&MX(CDZ3diyG(>s{wg?uoSzcX5QSFd7 z|F{L1iLR~Gyf_k=j481FAPCK;B6Jk+laZt?@NS+Nfj}gp=QiLGlqj?%8u2etLZvi@ zB}RxYY=f+6U>M^hNķL0yJ3!q>XUWR@*96dF5BokO&KytXz*agU0$ z%Cb>n-Gwi?(vrD}ML_-6U__B3kd;po6hkR$Gt~n+;4F#(Vrz#tx4Ng6B{xEe%9W~0 zTBlAW9!c^Jkgc{c72h;JeHD_We&a?FF}D+$Z(&`+-FLV^i3sgLl)n7VZz9cA=*F83 z8Q4b)O?&Hn;#Cm9m$Hr>Gd;}teoC1&53IVK%IQJc?vvbm0ogX{p+O6!Q|G1e6z4uZ z8$i!z)2jZUbj;GnO4?6N81RM)G9%eY2I4vdruHGie3i8}6e0!H$S%WL$d^2}1raNe zo~h;R-8@Jt_D3}o&G`|yq>GzhS!Z`tLB%D1`TwRJ#H*kNuTjDPHSKu|tW<b28FX%f}o55eKWlKXtt@${@B`8l`Zw3 z_a@#bhGuNe@d?w<))eg`FRI0^FJsOeG<9Y+(o@5|L5$?dK@id!Eo)R82gl+zsD(^R z#Luq1e#BkJaACjswWxWZ5P|BKbi&594Qgu*-i}lp&7sPLXGy=@YoLVAnS4`lJT(T{ zB^AUxltuZ27f5HmDY<}aOH%G?8FZ~R{k|#AJ2f{mo<_ z**Wg=FZXHk3o=mIqhv>>t?6MyZ5(%9;{D|tHCd=D4^`+=FBF}J{~P+(Bkd?{ma-_C zC{HGs4FOE`9VPo)Wl`a7Nf88OmW6MLVo(NrUYh=?l_Q?g&Q*I-_9@S9u+vUfe>zN5 z`Bb=YCca+HCvvv*evIVX(C#K})YdY#c=}mppWpYhZa=4Nbj;@-;m7VW4$O{qaR7HL zM(V&&-BZ)FSh3lF>Ju6xA6p*!_4%^%7CWQzprSA+(qp3@r&=m1h2pY#H-r2lPlOKp zXy1{t4gKxJta$4Isn!1fkbL&cpN|-vfQO*8@j$kCgcf)b8C$df8AXCCQbvzK?pb$U z73mu1leV08q05sFh{{BsBAlV!ZUncSw8aJsMu}x&4r-^g2TGFCL`zOh4Ji?gBYnU; z4kJxF+?13D0mn?W_Z)!&7hFT)p^h2~JOAqPU-$4BwrmXx`P=0njjc`WGpTP`>pQH6 zi%45bjTLP@^aE&Hf{H_gMTtBzUxK=lgO6^^bj8fR()E&G!cR*ZN%CEiuwn{CZG}w1 zKCC})O8~N1{qmFnA?gx6JC(q3!nPop%Tc+58vp`+sBDNFa+C8oM7uHVX^xKTwu|h~ zEU%3(C?ln?D4c4cj2tK%yVM9LR1nA&U3W0Jx@W)*ZlVzLD0>am_tSW~BH2SL2b~VV zLP8(bo)IxNq+iDV*wEz0U;CMQkcn!TqR6XTclVC6-S6JfK6meEDmt$`d^V`wovLS_ z>SLG6o2NypkWyRs?w0@5Tl}fDNW$sQzQ4nlcenNAl^2z(xzo$h=XjqTxVxEzha^FP zopI#HW+rSX<_zje-f>1zS29ZmFp&1h7{%gNH4tu#+&?YykCvppo4?uz`(sNIRr{Z8 z7X0q0flv{kloDEvx{ro1=}(=y`ZR>QI(3LO=!~Rb^FWah%kyZ_2>e>jpEsNrsx5Gb zrvZGQ7MSU20N=(pdE(tJlqt+`w>^UzP4;P+wA<%+JI*1infwCi?fAY3dK$jK;r30; zn)NnL#utQM04YU21P}4R+-f1}5d^E^D%{Q@32MDHh+%U7VP*VFH|v*bMM4`%<(|G4 zWxM)X_3dl*x34wa`>4h3BKT$j_na)5>3uJUcilCjrkKbFEX81iRFJHBmY zgpOAiH1ZFymGMzfwSO|X`RfG=QQtlm)m2x0t;+k)P$$Wll0`+8WJuvuKKg~F{C$%= zFLl3fQ03bIr_7Rox)K3>K$eKr%S$vlldW@Za?Tj z?EAQfkNxv$kBisaIMt&QM@j$3&Z+sOrSo=-6q-(*3`ln6ch~gT`KPX@`F?_;0oJYW z6G3_yA^G(6EP}lc1ijYD?rE?nEX}vLRH5_N{#q=++CE&O3G?EX>4Tx0C=2zkv&MmKpe$iTcs)$1uGPB$WWauh>AFB6^c+H)C#RS zm|Xe=O&XFE7e~Rh;NZt%)xpJCR|i)?5c~jfadlF3krMxx6k5c1aNLh~_a1le0DryA zRI_6oP&La)CE`LRyD9`<(TxE55y7CuOnpuilkgm0_we!cF2=LG&;2=im7K`{pFljz zbi*RvAfDc|bk6(4VOEqB;&b9LgDyz?$aUG}H_ioz{X8>lq*L?6VPc`s#&R38qM;H` z5l0nOqkMnHWrgz=XSG~q&3p0}hH~1nGy0}1FmMa>thv24_i_3F zq^Yaq4RCM>j20++-Q(R|?Y;ebrrF;Q9tU!TV73n#00006VoOIv0Qdj}00sA^mWKcU z010qNS#tmY4c7nw4c7reD4Tcy000McNliru;|T*07$o7J(dz&J0?0{3K~zY`t(Hwl zR8bVifA7O_#*ffaG>}o#$?>CcYBEYp4T=%9Rf~)XDimpv1QI4h`$@<`7cEL^k>SD$ zN*6*<3m1J@p*YSaC{z@h5LC)C8(VbeIivI5X!u{vJN0g zaAWF2G$%_yOTgpp2^Y%i$ZrC7qmcvD!c3EwdTT+aE zw+K!YQHr;X{=QREk0Qkpr>G>F;!$Lo3^kelnQmktb0hc zB(N&v<+;U_nNwn=szDZ)NEhveZj$270H}(h)pfk8a@A2A%Yj=KH#91W;*xON_v>1h z=N3_ENi%X#Du-SF4Y=m0!yFe6z@OkM&&J>KWb6$q!Jrn=6{leoCRI;UVM(JZuSENP z{dt0>v8Mp+vY4r|l>$(fZKuv>WpH6KDvvB0*9NpX>oBQn{)eY0wDrrWwdz?|`o(4E zalL&m%c3hr;B;y(hjI!cWZzeQXzP{WZ*84yHt}->l*q0V!l*1-ZUinmYmlXX^)fp@ z$B=&n|Kg&i_bq;9$p4Pn`8iZY=5UUU!HNsf91Ka~qG>T-+U?-_u``TKf8o)@F!#Ut z4D0ZGS`nV2qd2m1@V3&Eno?71w3BA3?L>^3)_d5&~(#|UQD9SZ6NOqpK8%YW+Tx3AL)uc xGQ%Qqi9x002ovPDHLkV1iUnz##wt literal 0 HcmV?d00001 diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 7175d8a7..c2cdf05b 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -15,6 +15,10 @@ def __init__(self, model: InputOption, model_parent: SingleSelectComponent): self.model_parent = model_parent self.toggled.connect(self._set_checked) + if self.model.read_only: + self.setAttribute(Qt.WA_TransparentForMouseEvents) + self.setFocusPolicy(Qt.NoFocus) + def _set_checked(self, checked: bool): if checked: self.model_parent.value = self.model @@ -34,6 +38,10 @@ def __init__(self, model: InputOption, model_parent: MultipleSelectComponent, ca if model.icon_path: self.setIcon(QIcon(model.icon_path)) + if model.read_only: + self.setAttribute(Qt.WA_TransparentForMouseEvents) + self.setFocusPolicy(Qt.NoFocus) + def _set_checked(self, state): checked = state == 2 From d88d3043317c073b5abcfacd22e53c8640f9a1b4 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Tue, 26 Nov 2019 19:29:10 -0300 Subject: [PATCH 20/38] [ui][aur] improved Required / Optional confirmation dialogs --- bauh/gems/arch/confirmation.py | 10 ++++------ bauh/view/resources/locale/ca | 1 + bauh/view/resources/locale/en | 3 ++- bauh/view/resources/locale/es | 1 + bauh/view/resources/locale/it | 1 + bauh/view/resources/locale/pt | 3 ++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py index d88653b7..b1526e23 100644 --- a/bauh/gems/arch/confirmation.py +++ b/bauh/gems/arch/confirmation.py @@ -16,7 +16,7 @@ def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatch opts = [] for p, d in pkg_mirrors.items(): - op = InputOption('{}{} ( {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', d['mirror'].upper()), p) + op = InputOption('{}{} ( {}: {} )'.format(p, ': ' + d['desc'] if d['desc'] else '', i18n['mirror'], d['mirror'].upper()), p) op.icon_path = _get_mirror_icon(d['mirror']) opts.append(op) @@ -39,13 +39,11 @@ def request_install_missing_deps(pkgname: str, pkg_mirrors: dict, watcher: Proce opts = [] for p, m in pkg_mirrors.items(): - op = InputOption('{} ( {} )'.format(p, m), p) + op = InputOption('{} ( {}: {} )'.format(p, i18n['mirror'], m.upper()), p) op.read_only = True op.icon_path = _get_mirror_icon(m) opts.append(op) - comps = [ - MultipleSelectComponent(label='', options=opts, default_options=set(opts)) - ] + comp = MultipleSelectComponent(label='', options=opts, default_options=set(opts)) - return watcher.request_confirmation(i18n['arch.missing_deps.title'], msg, comps, confirmation_label=i18n['continue'].capitalize()) + return watcher.request_confirmation(i18n['arch.missing_deps.title'], msg, [comp], confirmation_label=i18n['continue'].capitalize()) diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index 2e136c3e..fc24fef1 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -194,3 +194,4 @@ continue=continua stable=estable close=tanca publisher.verified=verificat +mirror=mirall \ No newline at end of file diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index b876f5f8..2ede48e0 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -148,4 +148,5 @@ screenshots.download.no_response=Image not found continue=continue stable=stable close=close -publisher.verified=verified \ No newline at end of file +publisher.verified=verified +mirror=mirror \ No newline at end of file diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index 323c8e16..a488cbda 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -193,3 +193,4 @@ continue=continuar stable=estable close=cerrar publisher.verified=verificado +mirror=espejo \ No newline at end of file diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index 984635c8..0197bd2b 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -149,3 +149,4 @@ continue=continua stable=stabile close=vicino publisher.verified=verificato +mirror=specchio \ No newline at end of file diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index b3f9a166..b7551325 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -195,4 +195,5 @@ screenshots.download.no_response=Imagem não encontrada continue=continuar stable=estável close=fechar -publisher.verified=verificado \ No newline at end of file +publisher.verified=verificado +mirror=espelho \ No newline at end of file From 7dda304c7af253a430f4dc5277d227e80d3280cb Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 10:53:08 -0300 Subject: [PATCH 21/38] [CHANGELOG] german i18n --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d5ef2f1..fbdc3233 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - Catalan contributions by [fitojb](https://github.com/fitojb) + - German contributions by [JonasLoos](https://github.com/JonasLoos) - Italian contributions by [albanobattistella](https://github.com/albanobattistella) ### Fixes From 374c6971969ea44b4a48495a1ec6eecdf660c75d Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 11:33:13 -0300 Subject: [PATCH 22/38] [improvement][aur] generating the optimized makepkg.conf at ~/.config/bauh/arch and using it as a build parameter --- CHANGELOG.md | 3 +++ bauh/gems/arch/__init__.py | 4 +++- bauh/gems/arch/controller.py | 2 +- bauh/gems/arch/makepkg.py | 23 ++++++++++++++++++++++- bauh/gems/arch/worker.py | 27 +++++++++++++-------------- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbdc3233..d717e95c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Adding all english (**en**) i18n keys to help people with the application translation - AppImage - AppImage updater daemon replaced by a default Python thread to reduce memory usage +- AUR + - The optimized **makepkg.conf** file is now generated at **~/.config/bauh/arch/makepkg.conf** and passed as a parameter during package builds to not provoke the auto-merge of **/etc/makepkg.conf** and the old generated **~/.makepkg.conf**. + (P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools) - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - Catalan contributions by [fitojb](https://github.com/fitojb) diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py index 5bd71924..3111c128 100644 --- a/bauh/gems/arch/__init__.py +++ b/bauh/gems/arch/__init__.py @@ -1,6 +1,6 @@ import os -from bauh.api.constants import CACHE_PATH +from bauh.api.constants import CACHE_PATH, HOME_PATH ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) BUILD_DIR = '/tmp/bauh/aur' @@ -8,3 +8,5 @@ CATEGORIES_CACHE_DIR = ARCH_CACHE_PATH + '/categories' CATEGORIES_FILE_PATH = CATEGORIES_CACHE_DIR + '/aur.txt' URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/aur/categories.txt' +CONFIG_DIR = '{}/.config/bauh/arch'.format(HOME_PATH) +CUSTOM_MAKEPKG_PATH = '{}/makepkg.conf'.format(CONFIG_DIR) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index c89a2328..0d77fb9c 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -435,7 +435,7 @@ def _make_pkg(self, pkgname: str, maintainer: str, root_password: str, handler: # building main package handler.watcher.change_substatus(self.i18n['arch.building.package'].format(bold(pkgname))) - pkgbuilt, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcsmf', '--noprepare'], cwd=project_dir)) + pkgbuilt, output = makepkg.make(project_dir, handler) self._update_progress(handler.watcher, 65, change_progress) if pkgbuilt: diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py index 3a72b002..a59206dd 100644 --- a/bauh/gems/arch/makepkg.py +++ b/bauh/gems/arch/makepkg.py @@ -1,6 +1,9 @@ +import os import re +from typing import Tuple from bauh.commons.system import SimpleProcess, ProcessHandler +from bauh.gems.arch import CUSTOM_MAKEPKG_PATH RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n') RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)') @@ -8,7 +11,14 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: res = {} - success, output = handler.handle_simple(SimpleProcess(['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild'], cwd=pkgdir)) + + cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild'] + + if os.path.exists(CUSTOM_MAKEPKG_PATH): + handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) + cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + + success, output = handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir)) if 'Missing dependencies' in output: res['missing_deps'] = RE_DEPS_PATTERN.findall(output) @@ -22,3 +32,14 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: res['validity_check'] = True return res + + +def make(pkgdir: str, handler: ProcessHandler) -> Tuple[bool, str]: + cmd = ['makepkg', '-ALcsmf', '--noprepare'] + + if os.path.exists(CUSTOM_MAKEPKG_PATH): + handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) + cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + + return handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir)) + diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index b7f9245f..3923e08e 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -4,20 +4,19 @@ import time from math import ceil from multiprocessing import Process +from pathlib import Path from threading import Thread import requests from bauh.api.abstract.context import ApplicationContext from bauh.api.abstract.controller import SoftwareManager -from bauh.api.constants import HOME_PATH -from bauh.gems.arch import pacman, disk +from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_PATH, CONFIG_DIR URL_INDEX = 'https://aur.archlinux.org/packages.gz' URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&arg={}' GLOBAL_MAKEPKG = '/etc/makepkg.conf' -USER_MAKEPKG = '{}/.makepkg.conf'.format(HOME_PATH) RE_MAKE_FLAGS = re.compile(r'#?\s*MAKEFLAGS\s*=\s*.+\s*') RE_COMPRESS_XZ = re.compile(r'#?\s*COMPRESSXZ\s*=\s*.+') @@ -89,13 +88,15 @@ def run(self): self.logger.error('Could not determine the number of processors. Aborting...') ncpus = None - if os.path.exists(GLOBAL_MAKEPKG) and not os.path.exists(USER_MAKEPKG): + if os.path.exists(GLOBAL_MAKEPKG): self.logger.info("Verifying if it is possible to optimize Arch packages compilation") with open(GLOBAL_MAKEPKG) as f: global_makepkg = f.read() - user_makepkg, optimizations = None, [] + Path(CONFIG_DIR).mkdir(parents=True, exist_ok=True) + + custom_makepkg, optimizations = None, [] if ncpus: makeflags = RE_MAKE_FLAGS.findall(global_makepkg) @@ -104,20 +105,20 @@ def run(self): not_commented = [f for f in makeflags if not f.startswith('#')] if not not_commented: - user_makepkg = RE_MAKE_FLAGS.sub('', global_makepkg) + custom_makepkg = RE_MAKE_FLAGS.sub('', global_makepkg) optimizations.append('MAKEFLAGS="-j$(nproc)"') else: self.logger.warning("It seems '{}' compilation flags are already customized".format(GLOBAL_MAKEPKG)) else: optimizations.append('MAKEFLAGS="-j$(nproc)"') - compress_xz = RE_COMPRESS_XZ.findall(user_makepkg if user_makepkg else global_makepkg) + compress_xz = RE_COMPRESS_XZ.findall(custom_makepkg if custom_makepkg else global_makepkg) if compress_xz: not_eligible = [f for f in compress_xz if not f.startswith('#') and '--threads' in f] if not not_eligible: - user_makepkg = RE_COMPRESS_XZ.sub('', global_makepkg) + custom_makepkg = RE_COMPRESS_XZ.sub('', global_makepkg) optimizations.append('COMPRESSXZ=(xz -c -z - --threads=0)') else: self.logger.warning("It seems '{}' COMPRESSXZ is already customized".format(GLOBAL_MAKEPKG)) @@ -126,11 +127,9 @@ def run(self): if optimizations: generated_by = '# \n' - user_makepkg = generated_by + user_makepkg + '\n' + generated_by + '\n'.join(optimizations) + '\n' + custom_makepkg = generated_by + custom_makepkg + '\n' + generated_by + '\n'.join(optimizations) + '\n' - with open(USER_MAKEPKG, 'w+') as f: - f.write(user_makepkg) + with open(CUSTOM_MAKEPKG_PATH, 'w+') as f: + f.write(custom_makepkg) - self.logger.info("A custom optimized 'makepkg.conf' was generated at '{}'".format(HOME_PATH)) - else: - self.logger.warning("A custom 'makepkg.conf' is already defined at '{}'".format(HOME_PATH)) + self.logger.info("A custom optimized 'makepkg.conf' was generated at '{}'".format(CUSTOM_MAKEPKG_PATH)) From 55e871151e1c411b77a75772786bb00c20cc2f63 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 11:37:54 -0300 Subject: [PATCH 23/38] [CHANGELOG] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d717e95c..19e89166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AppImage updater daemon replaced by a default Python thread to reduce memory usage - AUR - The optimized **makepkg.conf** file is now generated at **~/.config/bauh/arch/makepkg.conf** and passed as a parameter during package builds to not provoke the auto-merge of **/etc/makepkg.conf** and the old generated **~/.makepkg.conf**. - (P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools) + (P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools). Behavior discussed in [#30](https://github.com/vinifmor/bauh/issues/30). - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - Catalan contributions by [fitojb](https://github.com/fitojb) From 7dda7eaa18e6628b9c93e2d1b010c420c9255a43 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 12:55:08 -0300 Subject: [PATCH 24/38] [aur] enabled by default --- CHANGELOG.md | 4 +++- README.md | 31 +++++++++++++++--------------- bauh/gems/arch/controller.py | 2 +- bauh/gems/arch/resources/locale/ca | 1 + bauh/gems/arch/resources/locale/de | 1 + bauh/gems/arch/resources/locale/en | 3 ++- bauh/gems/arch/resources/locale/es | 1 + bauh/gems/arch/resources/locale/it | 1 + bauh/gems/arch/resources/locale/pt | 1 + bauh/gems/arch/suggestions.py | 4 +++- bauh/gems/arch/worker.py | 2 +- bauh/view/qt/apps_table.py | 10 +++++++++- 12 files changed, 39 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e89166..f394ff33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.7.3] 2019- +## [0.7.3] 2019-11 ### Improvements - Not breaking the application when a i18n (translation) key was not found - Adding all english (**en**) i18n keys to help people with the application translation @@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AUR - The optimized **makepkg.conf** file is now generated at **~/.config/bauh/arch/makepkg.conf** and passed as a parameter during package builds to not provoke the auto-merge of **/etc/makepkg.conf** and the old generated **~/.makepkg.conf**. (P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools). Behavior discussed in [#30](https://github.com/vinifmor/bauh/issues/30). + - Now AUR packages are enabled by default, but a warning is displayed in the installation dialog + - New package suggestions - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) - i18n: - Catalan contributions by [fitojb](https://github.com/fitojb) diff --git a/README.md b/README.md index 1062cafe..d2654fb5 100644 --- a/README.md +++ b/README.md @@ -94,37 +94,36 @@ In order to autostart the application, use your Desktop Environment settings to #### Snap ( snap ) - The user is able to search, install, uninstall, refresh, launch and downgrade applications +#### AppImage ( appimage ) +- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history +- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** ) +- Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section. +- Installed applications are store at **~/.local/share/bauh/appimage/installed** +- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications** +- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db** +- Databases updater daemon running every 20 minutes ( the interval in SECONDS can be changed with the environment variable **BAUH_APPIMAGE_DB_UPDATER_TIME** ). It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**. +- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt + +Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application. + #### AUR ( arch ) -- It is **not enabled by default** - The user is able to search, install, uninstall, downgrade, launch and retrieve the packages history - It handles conflicts, and missing / optional packages installations ( including from your distro mirrors ) - If [**aria2**](https://github.com/aria2/aria2) is installed on your system and multi-threaded downloads are enabled ( see **BAUH_DOWNLOAD_MULTITHREAD** ), the source packages will be pre-downloaded faster ( it does **NOT** modify your **pacman** settings ). - Automatically makes simple package compilation improvements: - a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf** and **~/.makepkg.conf** does not exist, - then a copy of **/etc/makepkg.conf** will be generated at **~/.makepkg.conf** defining MAKEFLAGS to work with + a) if **MAKEFLAGS** is not set in **/etc/makepkg.conf**, + then a copy of **/etc/makepkg.conf** will be generated at **~/.config/bauh/arch/makepkg.conf** defining MAKEFLAGS to work with the number of your machine processors (**-j${nproc}**). b) same as previous, but related to **COMPRESSXZ** definition ( if '--threads=0' is not defined ) Obs: this feature can be disabled through the environment variable **BAUH_ARCH_OPTIMIZE=0** - ( For more information about these optimizations, check: https://wiki.archlinux.org/index.php/Makepkg ) + ( For more information about these optimizations, have a look at [Makepkg](https://wiki.archlinux.org/index.php/Makepkg) - Arch package memory-indexer running every 20 minutes. This memory index is used when AUR Api cannot handle the amount of results found for a given search. It can be disabled via the environment variable **BAUH_ARCH_AUR_INDEX_UPDATER=0**. - If some of your installed packages are not categorized, send an e-mail to **bauh4linux@gmail.com** informing their names and categories in the following format: ```name=category1[,category2,category3,...]``` -#### AppImage ( appimage ) -- The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history -- Supported sources: [AppImageHub](https://appimage.github.io) ( **applications with no releases published to GitHub are currently not available** ) -- Faster downloads if **aria2c** is installed. Same behavior described in the **AUR support** section. -- Installed applications are store at **~/.local/share/bauh/appimage/installed** -- Desktop entries ( menu shortcuts ) of the installed applications are stored at **~/.local/share/applications** -- Downloaded database files are stored at **~/.local/share/bauh/appimage** as **apps.db** and **releases.db** -- Databases updater daemon running every 20 minutes ( the interval in SECONDS can be changed with the environment variable **BAUH_APPIMAGE_DB_UPDATER_TIME** ). It can be disabled via the environment variable **BAUH_APPIMAGE_DB_UPDATER=0**. -- All supported application names can be found at: https://github.com/vinifmor/bauh-files/blob/master/appimage/apps.txt - -Obs: There are some crashes when **AppImageLauncher** is installed. It is advisable to uninstall it and reboot the system before trying to install an AppImage application. - ### General settings You can change some application settings via environment variables or arguments (type ```bauh --help``` to get more information). diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 0d77fb9c..af5531df 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -747,7 +747,7 @@ def list_suggestions(self, limit: int) -> List[PackageSuggestion]: return res def is_default_enabled(self) -> bool: - return False + return True def launch(self, pkg: ArchPackage): if pkg.command: diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca index 3f912e7e..dd47dff2 100644 --- a/bauh/gems/arch/resources/locale/ca +++ b/bauh/gems/arch/resources/locale/ca @@ -1,5 +1,6 @@ gem.arch.label=AUR gem.arch.info=Els paquets AUR són mantinguts per una comunitat d’usuaris independent. No hi ha cap garantia que funcionin o que no danyin el vostre sistema. +gem.aur.install.warning=Els paquets AUR són mantinguts per una comunitat d’usuaris independent. No hi ha cap garantia que funcionin o que no danyin el vostre sistema. aur.info.architecture=arquitectura aur.info.architecture.any=qualsevol aur.info.build date=data de compilació diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de index c4b3bce3..647ff73f 100644 --- a/bauh/gems/arch/resources/locale/de +++ b/bauh/gems/arch/resources/locale/de @@ -1,5 +1,6 @@ gem.arch.label=AUR gem.arch.info=AUR Pakete werden von einer unabhängigen Nutzergemeinschaft geflegt. Es keine Garantie das sie funktionieren oder kein Schaden verursachen. +gem.aur.install.warning=AUR Pakete werden von einer unabhängigen Nutzergemeinschaft geflegt. Es keine Garantie das sie funktionieren oder kein Schaden verursachen. arch.install.conflict.popup.title=Konflikt entdeckt arch.install.conflict.popup.body=Die Anwendungen {} können nicht gleichzeitig installiert sein. Du musst eine deinstallieren um die andere zu installieren. Fortfahren? arch.missing_deps.title=Fehlende Abhängigkeiten diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index 04f78d3d..4c2b35e9 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -1,5 +1,6 @@ gem.arch.label=AUR -gem.arch.info=AUR packages are maintained by an independent user community. There is no warranty that they will work or not harm you system. +gem.arch.info=AUR packages are maintained by an independent user community. There is no warranty that they will work or not harm your system. +gem.aur.install.warning=AUR packages are maintained by an independent user community. There is no warranty that they will work or not harm your system. arch.install.conflict.popup.title=Conflict detected arch.install.conflict.popup.body=The applications {} are in conflict. You must uninstall one to install the other. Continue ? arch.missing_deps.title=Missing dependencies diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es index d8a54105..ef7c3183 100644 --- a/bauh/gems/arch/resources/locale/es +++ b/bauh/gems/arch/resources/locale/es @@ -1,5 +1,6 @@ gem.arch.label=AUR gem.arch.info=Los paquetes AUR son mantenidos por una comunidad de usuarios independiente. No hay garantía de que funcionen o que no dañen su sistema. +gem.aur.install.warning=Los paquetes AUR son mantenidos por una comunidad de usuarios independiente. No hay garantía de que funcionen o que no dañen su sistema. aur.info.architecture=arquitectura aur.info.architecture.any=cualquier aur.info.build date=fecha de construcción diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it index 4b0e5bc0..cb2b7e5a 100644 --- a/bauh/gems/arch/resources/locale/it +++ b/bauh/gems/arch/resources/locale/it @@ -1,5 +1,6 @@ gem.arch.label=AUR gem.arch.info=I pacchetti AUR sono gestiti da una comunità di utenti indipendenti. Non esiste alcuna garanzia che funzionino o non danneggino il sistema. +gem.aur.install.warning=I pacchetti AUR sono gestiti da una comunità di utenti indipendenti. Non esiste alcuna garanzia che funzionino o non danneggino il sistema. arch.install.conflict.popup.title=Conflitto rilevato arch.install.conflict.popup.body=Le applicazioni {} sono in conflitto. È necessario disinstallarne una per installare l'altra. Continua ? arch.missing_deps.title=Dipendenze mancanti diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt index a5d82578..4aaeb383 100644 --- a/bauh/gems/arch/resources/locale/pt +++ b/bauh/gems/arch/resources/locale/pt @@ -1,5 +1,6 @@ gem.arch.label=AUR gem.arch.info=Pacotes do AUR são mantidos por uma comunidade de usuários independente. Não há garantia que funcionarão ou que não prejudicarão o seus sistema. +gem.aur.install.warning=Pacotes do AUR são mantidos por uma comunidade de usuários independente. Não há garantia que funcionarão ou que não prejudicarão o seus sistema. aur.info.architecture=arquitetura aur.info.architecture.any=qualquer aur.info.build date=data de construção diff --git a/bauh/gems/arch/suggestions.py b/bauh/gems/arch/suggestions.py index 393e6b63..5bb2517b 100644 --- a/bauh/gems/arch/suggestions.py +++ b/bauh/gems/arch/suggestions.py @@ -1,3 +1,5 @@ from bauh.api.abstract.model import SuggestionPriority -ALL = {'google-chrome': SuggestionPriority.HIGH} +ALL = {'google-chrome': SuggestionPriority.HIGH, + 'lutris-git': SuggestionPriority.LOW, + 'xdman': SuggestionPriority.LOW} diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index 3923e08e..58078d31 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -83,7 +83,7 @@ def run(self): self.logger.info("Arch packages compilation optimization is disabled. Aborting...") else: try: - ncpus = ceil(os.cpu_count() * 1.5) + ncpus = os.cpu_count() except: self.logger.error('Could not determine the number of processors. Aborting...') ncpus = None diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py index 040fab21..b9f29056 100644 --- a/bauh/view/qt/apps_table.py +++ b/bauh/view/qt/apps_table.py @@ -174,9 +174,16 @@ def _parag(self, text: str) -> str: def _install_app(self, pkgv: PackageView): + body = self.i18n['manage_window.apps_table.row.actions.install.popup.body'].format(self._bold(str(pkgv))) + + warning = self.i18n.get('gem.{}.install.warning'.format(pkgv.model.get_type().lower())) + + if warning: + body += '

{}'.format('
'.join(('{}.'.format(phrase) for phrase in warning.split('.') if phrase))) + if dialog.ask_confirmation( title=self.i18n['manage_window.apps_table.row.actions.install.popup.title'], - body=self._parag(self.i18n['manage_window.apps_table.row.actions.install.popup.body'].format(self._bold(str(pkgv)))), + body=self._parag(body), i18n=self.i18n): self.window.install(pkgv) @@ -267,6 +274,7 @@ def uninstall(): elif pkg.model.can_be_installed(): def install(): self._install_app(pkg) + item = self._gen_row_button(self.i18n['install'].capitalize(), INSTALL_BT_STYLE.format(back='#088A08'), install) else: item = None From 5e7c4a1b060df5e35123b786afda143e950355e3 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 13:22:01 -0300 Subject: [PATCH 25/38] [feature] new parameter --clean to remove configuration and cache files --- CHANGELOG.md | 5 ++++- README.md | 3 +++ bauh/api/constants.py | 1 + bauh/app.py | 5 +++++ bauh/app_args.py | 1 + bauh/view/util/util.py | 11 +++++++++++ 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f394ff33..94d6e02e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - i18n: - Catalan contributions by [fitojb](https://github.com/fitojb) - German contributions by [JonasLoos](https://github.com/JonasLoos) - - Italian contributions by [albanobattistella](https://github.com/albanobattistella) + - Italian contributions by [albanobattistella](https://github.com/albanobattistella) + +### Features +- New command line argument to clean the configuration and cache files: `--clean` ### Fixes - Flatpak diff --git a/README.md b/README.md index d2654fb5..3f151152 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,9 @@ Icon=/home/$USER/bauh_env/lib/python3.7/site-packages/bauh/view/resources/img/lo ### Autostart In order to autostart the application, use your Desktop Environment settings to register it as a startup application / script (**bauh --tray=1**). +### Uninstallation +Before uninstalling bauh via your package manager, consider executing `bauh --clean` to remove configuration and cache files stored in your **HOME** folder. + ### Gems ( package technology support ) #### Flatpak ( flatpak ) - The user is able to search, install, uninstall, downgrade, launch and retrieve the applications history diff --git a/bauh/api/constants.py b/bauh/api/constants.py index e216d7f2..2eceab3a 100644 --- a/bauh/api/constants.py +++ b/bauh/api/constants.py @@ -2,3 +2,4 @@ HOME_PATH = Path.home() CACHE_PATH = '{}/.cache/bauh'.format(HOME_PATH) +CONFIG_PATH = '{}/.config/bauh'.format(HOME_PATH) diff --git a/bauh/app.py b/bauh/app.py index 89140feb..25a5ce61 100755 --- a/bauh/app.py +++ b/bauh/app.py @@ -25,9 +25,14 @@ def main(): os.environ['PYTHONUNBUFFERED'] = '1' args = app_args.read() + logger = logs.new_logger(__app_name__, bool(args.logs)) app_args.validate(args, logger) + if args.clean: + util.clean_app_files() + exit(0) + i18n_key, current_i18n = translation.get_locale_keys(args.locale) default_i18n = translation.get_locale_keys(DEFAULT_I18N_KEY)[1] if i18n_key != DEFAULT_I18N_KEY else {} i18n = I18n(current_i18n, default_i18n) diff --git a/bauh/app_args.py b/bauh/app_args.py index ee7ab010..8e551f1c 100644 --- a/bauh/app_args.py +++ b/bauh/app_args.py @@ -36,6 +36,7 @@ def read() -> Namespace: parser.add_argument('--logs', action="store", default=int(os.getenv('BAUH_LOGS', 0)), choices=[0, 1], type=int, help='If the application logs should be displayed. Default: %(default)s') parser.add_argument('--show-panel', action="store_true", help='Shows the management panel after the app icon is attached to the tray.') parser.add_argument('-dmt', '--download-mthread', action="store", default=os.getenv('BAUH_DOWNLOAD_MULTITHREAD', 1), choices=[0, 1], type=int, help='If installation files should be downloaded using multi-threads (only possible if aria2c is installed). Not all gems support this feature. Check README.md. Default: %(default)s') + parser.add_argument('--clean', action="store_true", help='Removes all configuration and cache files') return parser.parse_args() diff --git a/bauh/view/util/util.py b/bauh/view/util/util.py index c4ffb795..a6ed4374 100644 --- a/bauh/view/util/util.py +++ b/bauh/view/util/util.py @@ -1,10 +1,12 @@ import os +import shutil import subprocess import sys from PyQt5.QtCore import QCoreApplication from bauh import __app_name__ +from bauh.api.constants import CACHE_PATH, CONFIG_PATH from bauh.commons.system import run_cmd from bauh.view.util import resource @@ -36,3 +38,12 @@ def get_distro(): return 'ubuntu' return 'unknown' + + +def clean_app_files(): + print('[bauh] Cleaning configuration and cache files') + for path in (CACHE_PATH, CONFIG_PATH): + print('[bauh] Deleting directory {}'.format(path)) + if os.path.exists(path): + shutil.rmtree(path) + print('[bauh] Cleaning finished') From 1b92207fa35d1721011818a970483cf0471e60aa Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 14:46:54 -0300 Subject: [PATCH 26/38] [about] how to get help --- bauh/view/qt/about.py | 16 ++++++++++++++++ bauh/view/resources/locale/ca | 2 ++ bauh/view/resources/locale/en | 2 ++ bauh/view/resources/locale/es | 2 ++ bauh/view/resources/locale/it | 2 ++ bauh/view/resources/locale/pt | 2 ++ 6 files changed, 26 insertions(+) diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py index 39065f0f..1cfbdc2e 100644 --- a/bauh/view/qt/about.py +++ b/bauh/view/qt/about.py @@ -86,6 +86,22 @@ def __init__(self, i18n: I18n): layout.addWidget(QLabel('')) + label_trouble_question = QLabel() + label_trouble_question.setStyleSheet('font-size: 10px;') + label_trouble_question.setText(i18n['about.info.trouble.question']) + label_trouble_question.setOpenExternalLinks(True) + label_trouble_question.setAlignment(Qt.AlignCenter) + layout.addWidget(label_trouble_question) + + label_trouble_body = QLabel() + label_trouble_body.setStyleSheet('font-size: 10px;') + label_trouble_body.setText(i18n['about.info.trouble.body']) + label_trouble_body.setOpenExternalLinks(True) + label_trouble_body.setAlignment(Qt.AlignCenter) + layout.addWidget(label_trouble_body) + + layout.addWidget(QLabel('')) + self.adjustSize() self.setFixedSize(self.size()) diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index fc24fef1..e421ca28 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -62,6 +62,8 @@ about.info.desc=Interfície gràfica per a gestionar les vostres aplicacions per about.info.link=Trobareu més informació a about.info.license=Llicència lliure about.info.rate=Us agrada aquesta eina? Poseu-li una estrella al GitHub perquè el projecte sigui més fort +about.info.trouble.question=Té algun problema al usar-la? +about.info.trouble.body=Penseu en obrir un issue en GitHub perquè l’equip de desenvolupament us pugui ajudar yes=sí no=no version.updated=actualitzada diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index 2ede48e0..e5e481d9 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -62,6 +62,8 @@ about.info.desc=Graphical interface for managing your Linux applications about.info.link=More information at about.info.license=Free license about.info.rate=Like this tool ? Give it a star on GitHub to strengthen the project +about.info.trouble.question=Any trouble while using it ? +about.info.trouble.body=Consider opening a GitHub issue so the development team can help you yes=yes no=no version.updated=updated diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index a488cbda..55e406a4 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -62,6 +62,8 @@ about.info.desc=Interfaz grafica para administración de aplicaciones para Linux about.info.link=Mas información en about.info.license=Licencia gratuita about.info.rate=¿Le gusta esta herramienta? Dele una estrella en GitHub para fortalecer el proyecto +about.info.trouble.question=¿Algún problema al usarla? +about.info.trouble.body=Considere abrir una issue en GitHub para que el equipo de desarrollo pueda ayudarlo yes=sí no=no version.updated=actualizada diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index 0197bd2b..bd71bc50 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -62,6 +62,8 @@ about.info.desc=Interfaccia grafica per la gestione delle tue applicazioni Linux about.info.link=Maggiori informazioni su about.info.license=Free license about.info.rate=Ti piace questo strumento? Dagli una stella su GitHub per rafforzare il progetto +about.info.trouble.question=Qualche problema durante l'utilizzo? +about.info.trouble.body=Valuta la possibilità di aprire un issue in GitHub in modo che il team di sviluppo possa aiutarti yes=si no=no version.updated=aggiornata diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index b7551325..7a0fba93 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -60,6 +60,8 @@ about.info.desc=Interface gráfica para gerenciamento de aplicativos Linux about.info.link=Mais informações em about.info.license=Licença gratuita about.info.rate=Gosta desta ferramenta ? Dê uma estrela a ela no GitHub para fortalecer o projeto +about.info.trouble.question=Problemas enquanto a utiliza ? +about.info.trouble.body=Considere abrir uma issue no GitHub para que o time de desenvolvimento possa ajudá-lo yes=sim no=não version.updated=atualizada From 8cd07aec2cf27fcdfeb4745396469441d8e3b8cc Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 27 Nov 2019 17:29:28 -0300 Subject: [PATCH 27/38] [about] minor changes --- bauh/view/qt/about.py | 54 +++++++++++++++++------------------ bauh/view/resources/locale/ca | 7 +++-- bauh/view/resources/locale/de | 5 +++- bauh/view/resources/locale/en | 7 +++-- bauh/view/resources/locale/es | 7 +++-- bauh/view/resources/locale/it | 7 +++-- bauh/view/resources/locale/pt | 7 +++-- 7 files changed, 51 insertions(+), 43 deletions(-) diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py index 1cfbdc2e..6d84eb16 100644 --- a/bauh/view/qt/about.py +++ b/bauh/view/qt/about.py @@ -20,7 +20,7 @@ def __init__(self, i18n: I18n): layout = QVBoxLayout() self.setLayout(layout) - label_logo = QLabel(self) + label_logo = QLabel() label_logo.setPixmap(QPixmap(resource.get_path('img/logo.svg'))) label_logo.setAlignment(Qt.AlignCenter) layout.addWidget(label_logo) @@ -30,11 +30,15 @@ def __init__(self, i18n: I18n): label_name.setAlignment(Qt.AlignCenter) layout.addWidget(label_name) + label_version = QLabel(i18n['version'].lower() + ' ' + __version__) + label_version.setStyleSheet('QLabel { font-size: 10px; font-weight: bold }') + label_version.setAlignment(Qt.AlignCenter) + layout.addWidget(label_version) + layout.addWidget(QLabel('')) - line_desc = QLabel(self) + line_desc = QLabel(i18n['about.info.desc']) line_desc.setStyleSheet('font-size: 12px; font-weight: bold;') - line_desc.setText(i18n['about.info.desc']) line_desc.setAlignment(Qt.AlignCenter) line_desc.setMinimumWidth(400) layout.addWidget(line_desc) @@ -56,14 +60,9 @@ def __init__(self, i18n: I18n): layout.addWidget(gems_widget) layout.addWidget(QLabel('')) - label_version = QLabel(i18n['version'].lower() + ' ' + __version__) - label_version.setStyleSheet('QLabel { font-size: 11px; font-weight: bold }') - label_version.setAlignment(Qt.AlignCenter) - layout.addWidget(label_version) - label_more_info = QLabel() label_more_info.setStyleSheet('font-size: 11px;') - label_more_info.setText(i18n['about.info.link'] + ": {url}".format(url=PROJECT_URL)) + label_more_info.setText(i18n['about.info.link'] + " {url}".format(url=PROJECT_URL)) label_more_info.setOpenExternalLinks(True) label_more_info.setAlignment(Qt.AlignCenter) layout.addWidget(label_more_info) @@ -77,28 +76,29 @@ def __init__(self, i18n: I18n): layout.addWidget(QLabel('')) - label_rate = QLabel() - label_rate.setStyleSheet('font-size: 11px; font-weight: bold;') - label_rate.setText(i18n['about.info.rate'] + ' :)') - label_rate.setOpenExternalLinks(True) - label_rate.setAlignment(Qt.AlignCenter) - layout.addWidget(label_rate) + label_trouble_question = QLabel(i18n['about.info.trouble.question']) + label_trouble_question.setStyleSheet('font-size: 10px; font-weight: bold') + label_trouble_question.setAlignment(Qt.AlignCenter) + + layout.addWidget(label_trouble_question) + + label_trouble_answer = QLabel(i18n['about.info.trouble.answer']) + label_trouble_answer.setStyleSheet('font-size: 10px;') + label_trouble_answer.setAlignment(Qt.AlignCenter) + + layout.addWidget(label_trouble_answer) layout.addWidget(QLabel('')) - label_trouble_question = QLabel() - label_trouble_question.setStyleSheet('font-size: 10px;') - label_trouble_question.setText(i18n['about.info.trouble.question']) - label_trouble_question.setOpenExternalLinks(True) - label_trouble_question.setAlignment(Qt.AlignCenter) - layout.addWidget(label_trouble_question) + label_rate_question = QLabel(i18n['about.info.rate.question']) + label_rate_question.setStyleSheet('font-size: 10px; font-weight: bold;') + label_rate_question.setAlignment(Qt.AlignCenter) + layout.addWidget(label_rate_question) - label_trouble_body = QLabel() - label_trouble_body.setStyleSheet('font-size: 10px;') - label_trouble_body.setText(i18n['about.info.trouble.body']) - label_trouble_body.setOpenExternalLinks(True) - label_trouble_body.setAlignment(Qt.AlignCenter) - layout.addWidget(label_trouble_body) + label_rate_answer = QLabel(i18n['about.info.rate.answer']) + label_rate_answer.setStyleSheet('font-size: 10px;') + label_rate_answer.setAlignment(Qt.AlignCenter) + layout.addWidget(label_rate_answer) layout.addWidget(QLabel('')) diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index e421ca28..7311677d 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -61,9 +61,10 @@ notification.downgrade.failed=Ha fallat la reversió about.info.desc=Interfície gràfica per a gestionar les vostres aplicacions per a Linux about.info.link=Trobareu més informació a about.info.license=Llicència lliure -about.info.rate=Us agrada aquesta eina? Poseu-li una estrella al GitHub perquè el projecte sigui més fort -about.info.trouble.question=Té algun problema al usar-la? -about.info.trouble.body=Penseu en obrir un issue en GitHub perquè l’equip de desenvolupament us pugui ajudar +about.info.rate.question=Us agrada aquesta eina? +about.info.rate.answer=Poseu-li una estrella al GitHub perquè el projecte sigui més fort +about.info.trouble.question=Problemes? +about.info.trouble.answer=Obriu un issue en GitHub perquè els desenvolupadors us puguin ajudar yes=sí no=no version.updated=actualitzada diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de index 289f507e..0d3ca596 100644 --- a/bauh/view/resources/locale/de +++ b/bauh/view/resources/locale/de @@ -61,7 +61,10 @@ notification.downgrade.failed=Downgrade fehlgeschlagen about.info.desc=Graphisches Interface um Linux Anwendungen zu verwalten about.info.link=Mehr Informationen unter about.info.license=Freie Lizenz -about.info.rate=Gefällt dir diese Anwendung? Gib ihr einen Stern auf GitHub um das Projekt zu unterstützen +about.info.rate.question=Gefällt dir diese Anwendung? +about.info.rate.answer=Gib ihr einen Stern auf GitHub um das Projekt zu unterstützen +about.info.trouble.question=Probleme? +about.info.trouble.answer=Öffnen Sie ein GitHub-issue, damit die Entwickler Ihnen helfen können yes=Ja no=Nein version.updated=updated diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index e5e481d9..b9b69a67 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -61,9 +61,10 @@ notification.downgrade.failed=Failed to downgrade about.info.desc=Graphical interface for managing your Linux applications about.info.link=More information at about.info.license=Free license -about.info.rate=Like this tool ? Give it a star on GitHub to strengthen the project -about.info.trouble.question=Any trouble while using it ? -about.info.trouble.body=Consider opening a GitHub issue so the development team can help you +about.info.rate.question=Like this tool ? +about.info.rate.answer=Give it a star on GitHub to strengthen the project +about.info.trouble.question=Any trouble ? +about.info.trouble.answer=Open a GitHub issue so the developers can help you yes=yes no=no version.updated=updated diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index 55e406a4..fb14d7d9 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -61,9 +61,10 @@ notification.downgrade.failed=Error al revertir la versión about.info.desc=Interfaz grafica para administración de aplicaciones para Linux about.info.link=Mas información en about.info.license=Licencia gratuita -about.info.rate=¿Le gusta esta herramienta? Dele una estrella en GitHub para fortalecer el proyecto -about.info.trouble.question=¿Algún problema al usarla? -about.info.trouble.body=Considere abrir una issue en GitHub para que el equipo de desarrollo pueda ayudarlo +about.info.rate.question=¿Le gusta esta herramienta? +about.info.rate.answer=Dele una estrella en GitHub para fortalecer el proyecto +about.info.trouble.question=¿Problemas? +about.info.trouble.answer=Abra un issue en GitHub para que los desarrolladores puedan ayudarlo yes=sí no=no version.updated=actualizada diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index bd71bc50..2dfdbe06 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -61,9 +61,10 @@ notification.downgrade.failed=Impossibile eseguire il downgrade about.info.desc=Interfaccia grafica per la gestione delle tue applicazioni Linux about.info.link=Maggiori informazioni su about.info.license=Free license -about.info.rate=Ti piace questo strumento? Dagli una stella su GitHub per rafforzare il progetto -about.info.trouble.question=Qualche problema durante l'utilizzo? -about.info.trouble.body=Valuta la possibilità di aprire un issue in GitHub in modo che il team di sviluppo possa aiutarti +about.info.rate.question=Ti piace questo strumento? +about.info.rate.answer=Dagli una stella su GitHub per rafforzare il progetto +about.info.trouble.question=Problemas? +about.info.trouble.answer=Apri un issue in GitHub in modo che gli sviluppatori possano aiutarti yes=si no=no version.updated=aggiornata diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index 7a0fba93..fa487ff5 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -59,9 +59,10 @@ notification.downgrade.failed=Erro ao reverter versão about.info.desc=Interface gráfica para gerenciamento de aplicativos Linux about.info.link=Mais informações em about.info.license=Licença gratuita -about.info.rate=Gosta desta ferramenta ? Dê uma estrela a ela no GitHub para fortalecer o projeto -about.info.trouble.question=Problemas enquanto a utiliza ? -about.info.trouble.body=Considere abrir uma issue no GitHub para que o time de desenvolvimento possa ajudá-lo +about.info.rate.question=Gosta desta ferramenta ? +about.info.rate.answer=Dê a ela uma estrela no GitHub para fortalecer o projeto +about.info.trouble.question=Problemas ? +about.info.trouble.answer=Abra uma issue no GitHub para que os desenvolvedores possam ajudá-lo yes=sim no=não version.updated=atualizada From 19d0126521c66ca4958d13207cd7fd9f82d739dd Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 16:01:41 -0300 Subject: [PATCH 28/38] [root dialog] input style improvement --- CHANGELOG.md | 1 + bauh/view/qt/root.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d6e02e..36e4e6a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Catalan contributions by [fitojb](https://github.com/fitojb) - German contributions by [JonasLoos](https://github.com/JonasLoos) - Italian contributions by [albanobattistella](https://github.com/albanobattistella) +- minor UI improvements ### Features - New command line argument to clean the configuration and cache files: `--clean` diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index 3638c816..c6d76719 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -16,12 +16,13 @@ def is_root(): def ask_root_password(i18n: I18n): diag = QInputDialog() - diag.setStyleSheet("""QLineEdit { border-radius: 5px; font-size: 16px }""") + diag.setStyleSheet("""QLineEdit { border-radius: 5px; font-size: 16px; border: 1px solid lightblue }""") diag.setInputMode(QInputDialog.TextInput) diag.setTextEchoMode(QLineEdit.Password) diag.setWindowIcon(QIcon(resource.get_path('img/lock.png'))) diag.setWindowTitle(i18n['popup.root.title']) diag.setLabelText('') + diag.setOkButtonText(i18n['continue'].capitalize()) diag.setCancelButtonText(i18n['popup.button.cancel']) diag.resize(400, 200) From 90c1d20be43c659d0ff97515702d2038b12a7303 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 16:14:15 -0300 Subject: [PATCH 29/38] [root dialog] improving i18n --- bauh/view/qt/root.py | 2 +- bauh/view/resources/locale/ca | 1 + bauh/view/resources/locale/de | 1 + bauh/view/resources/locale/en | 3 ++- bauh/view/resources/locale/es | 1 + bauh/view/resources/locale/it | 3 ++- bauh/view/resources/locale/pt | 1 + 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index c6d76719..81732a48 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -22,7 +22,7 @@ def ask_root_password(i18n: I18n): diag.setWindowIcon(QIcon(resource.get_path('img/lock.png'))) diag.setWindowTitle(i18n['popup.root.title']) diag.setLabelText('') - diag.setOkButtonText(i18n['continue'].capitalize()) + diag.setOkButtonText(i18n['popup.root.continue'].capitalize()) diag.setCancelButtonText(i18n['popup.button.cancel']) diag.resize(400, 200) diff --git a/bauh/view/resources/locale/ca b/bauh/view/resources/locale/ca index 7311677d..1cbb40fb 100644 --- a/bauh/view/resources/locale/ca +++ b/bauh/view/resources/locale/ca @@ -36,6 +36,7 @@ manage_window.bt.installed.text=instal·lada manage_window.bt.installed.tooltip=Feu clic aquí per a mostrar les aplicacions instal·lades manage_window.checkbox.show_details=Mostra detalls popup.root.title=Requireix la vostra contrasenya per a continuar +popup.root.continue=continuar popup.root.bad_password.title=Error popup.root.bad_password.body=La contrasenya és incorrecta popup.root.bad_password.last_try=S’han acabat els intents. S’ha cancel·lat l’operació. diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de index 0d3ca596..3f5b8db2 100644 --- a/bauh/view/resources/locale/de +++ b/bauh/view/resources/locale/de @@ -36,6 +36,7 @@ manage_window.bt.installed.text=installiert manage_window.bt.installed.tooltip=Hier klicken um die installierten Anwendungen anzuzeigen manage_window.checkbox.show_details=Details anzeigen popup.root.title=Zum Fortfahren wird das Passwort benötigt +popup.root.continue=fortfahren popup.root.bad_password.title=Fehler popup.root.bad_password.body=Falsches Passwort popup.root.bad_password.last_try=Zu viele Versuche. Aktion abgebrochen. diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en index b9b69a67..2c30f3f8 100644 --- a/bauh/view/resources/locale/en +++ b/bauh/view/resources/locale/en @@ -36,6 +36,7 @@ manage_window.bt.installed.text=installed manage_window.bt.installed.tooltip=Click here to show the installed applications manage_window.checkbox.show_details=Show details popup.root.title=Requires your password to continue +popup.root.continue=continue popup.root.bad_password.title=Error popup.root.bad_password.body=Wrong password popup.root.bad_password.last_try=Attempts finished. Action cancelled. @@ -152,4 +153,4 @@ continue=continue stable=stable close=close publisher.verified=verified -mirror=mirror \ No newline at end of file +mirror=mirror diff --git a/bauh/view/resources/locale/es b/bauh/view/resources/locale/es index fb14d7d9..1e9aa595 100644 --- a/bauh/view/resources/locale/es +++ b/bauh/view/resources/locale/es @@ -37,6 +37,7 @@ manage_window.bt.installed.text=instaladas manage_window.bt.installed.tooltip==Pulse aquí para mostrar las aplicaciones instaladas manage_window.checkbox.show_details=Mostrar detalles popup.root.title=Proporcione su contraseña para continuar +popup.root.continue=continuar popup.root.bad_password.title=Error popup.root.bad_password.body=Contraseña incorrecta popup.root.bad_password.last_try=Intentos finalizados. Acción cancelada. diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it index 2dfdbe06..54ef7ae0 100644 --- a/bauh/view/resources/locale/it +++ b/bauh/view/resources/locale/it @@ -35,7 +35,8 @@ manage_window.bt.upgrade.tooltip=Aggiorna tutte le applicazioni controllate manage_window.bt.installed.text=installato manage_window.bt.installed.tooltip=Clicca qui per mostrare le applicazioni installate manage_window.checkbox.show_details=Mostra dettagli -popup.root.title=Richiede la tua password per continuare +popup.root.title=Richiede la tua password per continuare +popup.root.continue=continuare popup.root.bad_password.title=Errore popup.root.bad_password.body=Password errata popup.root.bad_password.last_try=Tentativi conclusi. Azione annullata. diff --git a/bauh/view/resources/locale/pt b/bauh/view/resources/locale/pt index fa487ff5..67469bc6 100644 --- a/bauh/view/resources/locale/pt +++ b/bauh/view/resources/locale/pt @@ -37,6 +37,7 @@ manage_window.bt.installed.text=instalados manage_window.bt.installed.tooltip=Clique aqui para exibir os aplicativos instalados manage_window.checkbox.show_details=Mostrar detalhes popup.root.title=Requer sua senha para prosseguir +popup.root.continue=prosseguir popup.root.bad_password.title=Erro popup.root.bad_password.body=Senha incorreta popup.root.bad_password.last_try=Tentativas finalizadas. Ação cancelada. From 0b97582822e157537386db2eb1255fe9c2c3ab18 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 17:26:08 -0300 Subject: [PATCH 30/38] [search bar] border style --- bauh/view/qt/window.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index 334816a2..a64ce663 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -94,7 +94,15 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.toolbar_search.setContentsMargins(0, 0, 0, 0) label_pre_search = QLabel() - label_pre_search.setStyleSheet("background: white; border-top-left-radius: 5px; border-bottom-left-radius: 5px;") + label_pre_search.setStyleSheet(""" + background: white; + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; + border-left: 1px solid lightgrey; + border-top: 1px solid lightgrey; + border-bottom: 1px solid lightgrey; + """) + self.toolbar_search.addWidget(label_pre_search) self.input_search = QLineEdit() @@ -102,13 +110,31 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.input_search.setFrame(False) self.input_search.setPlaceholderText(self.i18n['window_manage.input_search.placeholder'] + "...") self.input_search.setToolTip(self.i18n['window_manage.input_search.tooltip']) - self.input_search.setStyleSheet("QLineEdit { background-color: white; color: gray; spacing: 0; height: 30px; font-size: 12px; width: 300px}") + self.input_search.setStyleSheet("""QLineEdit { + background-color: white; + color: black; + spacing: 0; + height: 30px; + font-size: 12px; + width: 300px; + border-bottom: 1px solid lightgrey; + border-top: 1px solid lightgrey; + } + """) self.input_search.returnPressed.connect(self.search) self.toolbar_search.addWidget(self.input_search) label_pos_search = QLabel() label_pos_search.setPixmap(QPixmap(resource.get_path('img/search.svg'))) - label_pos_search.setStyleSheet("background: white; padding-right: 10px; border-top-right-radius: 5px; border-bottom-right-radius: 5px;") + label_pos_search.setStyleSheet(""" + background: white; padding-right: 10px; + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; + border-right: 1px solid lightgrey; + border-top: 1px solid lightgrey; + border-bottom: 1px solid lightgrey; + """) + self.toolbar_search.addWidget(label_pos_search) self.ref_toolbar_search = self.toolbar_top.addWidget(self.toolbar_search) @@ -369,6 +395,7 @@ def _show_warnings(self, warnings: List[str]): def show(self): super(ManageWindow, self).show() + if not self.thread_warnings.isFinished(): self.thread_warnings.start() From 1db53bddf1048def6c7faec832c9540324ff0b0f Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 17:35:50 -0300 Subject: [PATCH 31/38] [root dialog] buttons style --- bauh/view/qt/root.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index 81732a48..d7d4702a 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -1,10 +1,11 @@ import os from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QInputDialog, QLineEdit +from PyQt5.QtWidgets import QInputDialog, QLineEdit, QDialogButtonBox, QPushButton from bauh.api.abstract.view import MessageType from bauh.commons.system import new_subprocess +from bauh.view.qt import css from bauh.view.qt.dialog import show_message from bauh.view.util import resource from bauh.view.util.translation import I18n @@ -23,9 +24,17 @@ def ask_root_password(i18n: I18n): diag.setWindowTitle(i18n['popup.root.title']) diag.setLabelText('') diag.setOkButtonText(i18n['popup.root.continue'].capitalize()) - diag.setCancelButtonText(i18n['popup.button.cancel']) + diag.setCancelButtonText(i18n['popup.button.cancel'].capitalize()) diag.resize(400, 200) + bts = diag.findChildren(QPushButton) + + for bt in bts: + if bt.text() == i18n['popup.root.continue'].capitalize(): + bt.setStyleSheet(css.OK_BUTTON) + + bt.setIcon(QIcon()) + for attempt in range(3): ok = diag.exec_() From 40aeaf0269216d0d1441765f0487c3d13b61d503 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 18:09:03 -0300 Subject: [PATCH 32/38] [root dialog] roolback: buttons style --- bauh/view/qt/root.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py index d7d4702a..37d9c1e9 100644 --- a/bauh/view/qt/root.py +++ b/bauh/view/qt/root.py @@ -1,11 +1,10 @@ import os from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QInputDialog, QLineEdit, QDialogButtonBox, QPushButton +from PyQt5.QtWidgets import QInputDialog, QLineEdit from bauh.api.abstract.view import MessageType from bauh.commons.system import new_subprocess -from bauh.view.qt import css from bauh.view.qt.dialog import show_message from bauh.view.util import resource from bauh.view.util.translation import I18n @@ -27,14 +26,6 @@ def ask_root_password(i18n: I18n): diag.setCancelButtonText(i18n['popup.button.cancel'].capitalize()) diag.resize(400, 200) - bts = diag.findChildren(QPushButton) - - for bt in bts: - if bt.text() == i18n['popup.root.continue'].capitalize(): - bt.setStyleSheet(css.OK_BUTTON) - - bt.setIcon(QIcon()) - for attempt in range(3): ok = diag.exec_() From 915c3b50a31a685dc6e6149cd1e8d536af0da36e Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 28 Nov 2019 18:36:50 -0300 Subject: [PATCH 33/38] [aur] --noprepare during dependency checking --- CHANGELOG.md | 3 +-- bauh/gems/arch/makepkg.py | 4 ++-- bauh/view/qt/window.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e4e6a7..b64c4cb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AUR - The optimized **makepkg.conf** file is now generated at **~/.config/bauh/arch/makepkg.conf** and passed as a parameter during package builds to not provoke the auto-merge of **/etc/makepkg.conf** and the old generated **~/.makepkg.conf**. (P.S: if your **~/.makepkg.conf** was generated by bauh, consider deleting it as it will be useless for bauh now and may impact your other Arch compilation tools). Behavior discussed in [#30](https://github.com/vinifmor/bauh/issues/30). + - Removing an unnecessary **prepare** step executed during dependency checking reducing the packages installation time. Also this step was preventing some packages to install due to its repeated execution ( e.g: xdman ) - Now AUR packages are enabled by default, but a warning is displayed in the installation dialog - New package suggestions - Caching Snap and Flatpak suggestions [#23](https://github.com/vinifmor/bauh/issues/23) @@ -28,8 +29,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixes - Flatpak - Ignoring no related updates ( there are some scenarios the updates are not listed due to warnings / suggestions related to some specific runtimes if the param **--no-related** is not informed ) -- AUR - - Removing repeated **prepare** step that was delaying the build and preventing some packages to install (e.g: xdman ) ### UI - AUR diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py index a59206dd..41bf1717 100644 --- a/bauh/gems/arch/makepkg.py +++ b/bauh/gems/arch/makepkg.py @@ -12,7 +12,7 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: res = {} - cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild'] + cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild', '--noprepare'] if os.path.exists(CUSTOM_MAKEPKG_PATH): handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) @@ -35,7 +35,7 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: def make(pkgdir: str, handler: ProcessHandler) -> Tuple[bool, str]: - cmd = ['makepkg', '-ALcsmf', '--noprepare'] + cmd = ['makepkg', '-ALcsmf'] if os.path.exists(CUSTOM_MAKEPKG_PATH): handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index a64ce663..33092eb9 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -112,7 +112,7 @@ def __init__(self, i18n: I18n, icon_cache: MemoryCache, manager: SoftwareManager self.input_search.setToolTip(self.i18n['window_manage.input_search.tooltip']) self.input_search.setStyleSheet("""QLineEdit { background-color: white; - color: black; + color: grey; spacing: 0; height: 30px; font-size: 12px; From dca66b315ef269b21c953f35c465db407a7596c1 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 29 Nov 2019 09:05:20 -0300 Subject: [PATCH 34/38] [aur] respecting BAUH_ARCH_OPTIMIZE when makepkg calls are executed --- bauh/gems/arch/__init__.py | 4 ++++ bauh/gems/arch/makepkg.py | 21 +++++++++++++-------- bauh/gems/arch/worker.py | 13 +++++++++---- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py index 3111c128..2a027234 100644 --- a/bauh/gems/arch/__init__.py +++ b/bauh/gems/arch/__init__.py @@ -10,3 +10,7 @@ URL_CATEGORIES_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/aur/categories.txt' CONFIG_DIR = '{}/.config/bauh/arch'.format(HOME_PATH) CUSTOM_MAKEPKG_PATH = '{}/makepkg.conf'.format(CONFIG_DIR) + + +def should_optimize_compilation() -> bool: + return bool(int(os.getenv('BAUH_ARCH_OPTIMIZE', 1))) diff --git a/bauh/gems/arch/makepkg.py b/bauh/gems/arch/makepkg.py index 41bf1717..a6ba0ff9 100644 --- a/bauh/gems/arch/makepkg.py +++ b/bauh/gems/arch/makepkg.py @@ -3,7 +3,7 @@ from typing import Tuple from bauh.commons.system import SimpleProcess, ProcessHandler -from bauh.gems.arch import CUSTOM_MAKEPKG_PATH +from bauh.gems.arch import CUSTOM_MAKEPKG_PATH, should_optimize_compilation RE_DEPS_PATTERN = re.compile(r'\n?\s+->\s(.+)\n') RE_UNKNOWN_GPG_KEY = re.compile(r'\(unknown public key (\w+)\)') @@ -14,9 +14,12 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: cmd = ['makepkg', '-ALcf', '--check', '--noarchive', '--nobuild', '--noprepare'] - if os.path.exists(CUSTOM_MAKEPKG_PATH): - handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) - cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + if should_optimize_compilation(): + if os.path.exists(CUSTOM_MAKEPKG_PATH): + handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) + cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + else: + handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH)) success, output = handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir)) @@ -37,9 +40,11 @@ def check(pkgdir: str, handler: ProcessHandler) -> dict: def make(pkgdir: str, handler: ProcessHandler) -> Tuple[bool, str]: cmd = ['makepkg', '-ALcsmf'] - if os.path.exists(CUSTOM_MAKEPKG_PATH): - handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) - cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + if should_optimize_compilation(): + if os.path.exists(CUSTOM_MAKEPKG_PATH): + handler.watcher.print('Using custom makepkg.conf -> {}'.format(CUSTOM_MAKEPKG_PATH)) + cmd.append('--config={}'.format(CUSTOM_MAKEPKG_PATH)) + else: + handler.watcher.print('Custom optimized makepkg.conf ( {} ) not found'.format(CUSTOM_MAKEPKG_PATH)) return handler.handle_simple(SimpleProcess(cmd, cwd=pkgdir)) - diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index 58078d31..ca628663 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -11,7 +11,7 @@ from bauh.api.abstract.context import ApplicationContext from bauh.api.abstract.controller import SoftwareManager -from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_PATH, CONFIG_DIR +from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_PATH, CONFIG_DIR, should_optimize_compilation URL_INDEX = 'https://aur.archlinux.org/packages.gz' URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&arg={}' @@ -75,12 +75,17 @@ class ArchCompilationOptimizer(Thread if bool(os.getenv('BAUH_DEBUG', 0)) else P def __init__(self, logger: logging.Logger): super(ArchCompilationOptimizer, self).__init__(daemon=True) self.logger = logger - self.compilation_optimizations = bool(int(os.getenv('BAUH_ARCH_OPTIMIZE', 1))) def run(self): - if not self.compilation_optimizations: - self.logger.info("Arch packages compilation optimization is disabled. Aborting...") + if not should_optimize_compilation(): + self.logger.info("Arch packages compilation optimization is disabled") + + if os.path.exists(CUSTOM_MAKEPKG_PATH): + self.logger.info("Removing custom 'makepkg.conf' -> '{}'".format(CUSTOM_MAKEPKG_PATH)) + os.remove(CUSTOM_MAKEPKG_PATH) + + self.logger.info('Finished') else: try: ncpus = os.cpu_count() From a9da7bacc2791aa8db652c21611a36c259dc565a Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 29 Nov 2019 09:20:11 -0300 Subject: [PATCH 35/38] [aur] new suggestion --- bauh/gems/arch/suggestions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bauh/gems/arch/suggestions.py b/bauh/gems/arch/suggestions.py index 5bb2517b..b6ab691f 100644 --- a/bauh/gems/arch/suggestions.py +++ b/bauh/gems/arch/suggestions.py @@ -2,4 +2,5 @@ ALL = {'google-chrome': SuggestionPriority.HIGH, 'lutris-git': SuggestionPriority.LOW, - 'xdman': SuggestionPriority.LOW} + 'xdman': SuggestionPriority.LOW, + 'optimus-manager-qt': SuggestionPriority.LOW} From 4834e8dafd148d73afc2685f99f5af62f517cbd0 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 29 Nov 2019 09:34:50 -0300 Subject: [PATCH 36/38] [aur] show the description field in the info window of not installed packages --- bauh/gems/arch/controller.py | 1 + bauh/gems/arch/resources/locale/ca | 1 + bauh/gems/arch/resources/locale/de | 1 + bauh/gems/arch/resources/locale/en | 1 + bauh/gems/arch/resources/locale/es | 1 + bauh/gems/arch/resources/locale/it | 1 + bauh/gems/arch/resources/locale/pt | 1 + 7 files changed, 7 insertions(+) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index af5531df..e9078613 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -294,6 +294,7 @@ def get_info(self, pkg: ArchPackage) -> dict: info = { '01_id': pkg.id, '02_name': pkg.name, + '03_description': pkg.description, '03_version': pkg.version, '04_popularity': pkg.popularity, '05_votes': pkg.votes, diff --git a/bauh/gems/arch/resources/locale/ca b/bauh/gems/arch/resources/locale/ca index dd47dff2..2c408d43 100644 --- a/bauh/gems/arch/resources/locale/ca +++ b/bauh/gems/arch/resources/locale/ca @@ -59,6 +59,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=nom aur.info.03_version=versió +aur.info.03_description=descripció aur.info.04_popularity=popularitat aur.info.05_votes=vots aur.info.06_package_base=paquet base diff --git a/bauh/gems/arch/resources/locale/de b/bauh/gems/arch/resources/locale/de index 647ff73f..ac71a2a5 100644 --- a/bauh/gems/arch/resources/locale/de +++ b/bauh/gems/arch/resources/locale/de @@ -27,6 +27,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=name aur.info.03_version=version +aur.info.03_description=Beschreibung aur.info.04_popularity=Beliebtheit aur.info.05_votes=Stimmen aur.info.06_package_base=Paketbasis diff --git a/bauh/gems/arch/resources/locale/en b/bauh/gems/arch/resources/locale/en index 4c2b35e9..f51ffcfc 100644 --- a/bauh/gems/arch/resources/locale/en +++ b/bauh/gems/arch/resources/locale/en @@ -27,6 +27,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=name aur.info.03_version=version +aur.info.03_description=description aur.info.04_popularity=popularity aur.info.05_votes=votes aur.info.06_package_base=package base diff --git a/bauh/gems/arch/resources/locale/es b/bauh/gems/arch/resources/locale/es index ef7c3183..60e47c41 100644 --- a/bauh/gems/arch/resources/locale/es +++ b/bauh/gems/arch/resources/locale/es @@ -59,6 +59,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=nombre aur.info.03_version=versión +aur.info.03_description=descripción aur.info.04_popularity=popularidad aur.info.05_votes=votos aur.info.06_package_base=paquete base diff --git a/bauh/gems/arch/resources/locale/it b/bauh/gems/arch/resources/locale/it index cb2b7e5a..c4acadde 100644 --- a/bauh/gems/arch/resources/locale/it +++ b/bauh/gems/arch/resources/locale/it @@ -27,6 +27,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=nome aur.info.03_version=versione +aur.info.03_description=descrizione aur.info.04_popularity=popularità aur.info.05_votes=voti aur.info.06_package_base=pacchetto base diff --git a/bauh/gems/arch/resources/locale/pt b/bauh/gems/arch/resources/locale/pt index 4aaeb383..8315cbd4 100644 --- a/bauh/gems/arch/resources/locale/pt +++ b/bauh/gems/arch/resources/locale/pt @@ -59,6 +59,7 @@ aur.info.00_pkg_build=pkgbuild aur.info.01_id=id aur.info.02_name=nome aur.info.03_version=versão +aur.info.03_description=descrição aur.info.04_popularity=popularidade aur.info.05_votes=votos aur.info.06_package_base=pacote base From 88818bf0245933d63761459cb77ef3080fa745e5 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 29 Nov 2019 10:55:27 -0300 Subject: [PATCH 37/38] [CHANGELOG] 0.7.3 release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b64c4cb4..1d7145b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [0.7.3] 2019-11 +## [0.7.3] 2019-11-29 ### Improvements - Not breaking the application when a i18n (translation) key was not found - Adding all english (**en**) i18n keys to help people with the application translation From a6de4caa519983dbbd1fab79f90d53dc1badaf71 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 29 Nov 2019 11:34:14 -0300 Subject: [PATCH 38/38] [aur] removing optimized makepkg.conf when it is not necessary --- bauh/gems/arch/worker.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bauh/gems/arch/worker.py b/bauh/gems/arch/worker.py index ca628663..b135e627 100644 --- a/bauh/gems/arch/worker.py +++ b/bauh/gems/arch/worker.py @@ -138,3 +138,11 @@ def run(self): f.write(custom_makepkg) self.logger.info("A custom optimized 'makepkg.conf' was generated at '{}'".format(CUSTOM_MAKEPKG_PATH)) + else: + self.logger.info("No optimizations are necessary") + + if os.path.exists(CUSTOM_MAKEPKG_PATH): + self.logger.info("Removing old optimized 'makepkg.conf' at '{}'".format(CUSTOM_MAKEPKG_PATH)) + os.remove(CUSTOM_MAKEPKG_PATH) + + self.logger.info('Finished')