diff --git a/CHANGELOG.md b/CHANGELOG.md
index a620ef97..57501c34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,10 +4,27 @@ 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.8.1]
+### Improvements
+- All icons are now SVG files
+- HDPI support ( by [octopusSD](https://github.com/octopusSD) )
+- Web:
+ - not using HTTP sessions anymore to perform the searches. It seems to avoid URLs not being found after an internet drop event.
+
+### Fixes
+- missing categories i18n [48](https://github.com/vinifmor/bauh/issues/48)
+- not verifying if an icon path is a file
+- Web:
+ - not handling HTTP connection issues
+- not passing the Home path as a String ( does not work in Python 3.5 )
+
+### UI
+- Default **Type** icon removed from the Type filter to make the design more consistent with the Category filter.
+
## [0.8.0] 2019-12-24
### Features
- Native Web applications support:
- - if an URL is typed in the search bar, a native web application result will be displayed in the results table.
+ - if an URL is typed on the search bar, a native web application result will be displayed on the table.
- bauh relies on [NodeJS](https://nodejs.org/en/), [Electron](https://electronjs.org/) and [nativefier](https://github.com/jiahaog/nativefier) to install the Web applications, but there is no need to have them installed on your system. Bauh will create its own installation environment with these technologies in **~/.local/share/bauh/web/env**.
- suggestions are retrieved from [suggestions.txt](https://github.com/vinifmor/bauh-files/blob/master/web/suggestions.yml)
- requires only **python-beautifulsoup4** and **python-lxml** to be enabled
diff --git a/bauh/__init__.py b/bauh/__init__.py
index 7289277f..e6a21914 100644
--- a/bauh/__init__.py
+++ b/bauh/__init__.py
@@ -1,4 +1,4 @@
-__version__ = '0.8.0'
+__version__ = '0.8.1'
__app_name__ = 'bauh'
import os
diff --git a/bauh/api/constants.py b/bauh/api/constants.py
index a14e0b8d..61c96fe1 100644
--- a/bauh/api/constants.py
+++ b/bauh/api/constants.py
@@ -1,6 +1,5 @@
from pathlib import Path
-HOME_PATH = Path.home()
-CACHE_PATH = '{}/.cache/bauh'.format(HOME_PATH)
-CONFIG_PATH = '{}/.config/bauh'.format(HOME_PATH)
-DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(HOME_PATH)
+CACHE_PATH = '{}/.cache/bauh'.format(Path.home())
+CONFIG_PATH = '{}/.config/bauh'.format(Path.home())
+DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(Path.home())
diff --git a/bauh/api/http.py b/bauh/api/http.py
index 31e90c90..2a1c91be 100644
--- a/bauh/api/http.py
+++ b/bauh/api/http.py
@@ -17,7 +17,7 @@ class HttpClient:
self.sleep = sleep
self.logger = logger
- def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False, single_call: bool = False) -> requests.Request:
+ def get(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, ignore_ssl: bool = False, single_call: bool = False, session: bool = True) -> requests.Response:
cur_attempts = 1
while cur_attempts <= self.max_attempts:
@@ -35,7 +35,10 @@ class HttpClient:
if ignore_ssl:
args['verify'] = False
- res = self.session.get(url, **args)
+ if session:
+ res = self.session.get(url, **args)
+ else:
+ res = requests.get(url, **args)
if res.status_code == 200:
return res
@@ -56,20 +59,20 @@ class HttpClient:
self.logger.warning("Could not retrieve data from '{}'".format(url))
- def get_json(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True):
- res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects)
+ def get_json(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, session: bool = True):
+ res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects, session=session)
return res.json() if res else None
- def get_yaml(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True):
- res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects)
+ def get_yaml(self, url: str, params: dict = None, headers: dict = None, allow_redirects: bool = True, session: bool = True):
+ res = self.get(url, params=params, headers=headers, allow_redirects=allow_redirects, session=session)
return yaml.safe_load(res.text) if res else None
- def get_content_length(self, url: str) -> str:
- """
- :param url:
- :return:
- """
- res = self.session.get(url, allow_redirects=True, stream=True)
+ def get_content_length(self, url: str, session: bool = True) -> str:
+ params = {'url': url, 'allow_redirects': True, 'stream': True}
+ if session:
+ res = self.session.get(**params)
+ else:
+ res = requests.get(**params)
if res.status_code == 200:
size = res.headers.get('Content-Length')
@@ -77,6 +80,11 @@ class HttpClient:
if size is not None:
return system.get_human_size_str(size)
- def exists(self, url: str) -> bool:
- res = self.session.head(url=url, allow_redirects=True, verify=False, timeout=5)
+ def exists(self, url: str, session: bool = True) -> bool:
+ params = {'url': url, 'allow_redirects': True, 'verify': False, 'timeout': 5}
+ if session:
+ res = self.session.head(**params)
+ else:
+ res = self.session.get(**params)
+
return res.status_code in (200, 403)
diff --git a/bauh/app.py b/bauh/app.py
index 28bdce9b..01602d06 100755
--- a/bauh/app.py
+++ b/bauh/app.py
@@ -3,6 +3,7 @@ import sys
from threading import Thread
import urllib3
+from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication
@@ -71,6 +72,7 @@ def main():
app.setApplicationVersion(__version__)
app_icon = util.get_default_icon()[1]
app.setWindowIcon(app_icon)
+ app.setAttribute(Qt.AA_UseHighDpiPixmaps) # This fix images on HDPI resolution, not tested on non HDPI
if local_config['ui']['style']:
app.setStyle(str(local_config['ui']['style']))
diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py
index 7ac802a6..341db84d 100644
--- a/bauh/gems/appimage/__init__.py
+++ b/bauh/gems/appimage/__init__.py
@@ -1,8 +1,7 @@
import os
-
-from bauh.api.constants import HOME_PATH
+from pathlib import Path
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
-LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(HOME_PATH)
+LOCAL_PATH = '{}/.local/share/bauh/appimage'.format(Path.home())
INSTALLATION_PATH = LOCAL_PATH + '/installed/'
SUGGESTIONS_FILE = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/appimage/suggestions.txt'
\ No newline at end of file
diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py
index fd9ace98..538d3051 100644
--- a/bauh/gems/appimage/controller.py
+++ b/bauh/gems/appimage/controller.py
@@ -20,15 +20,14 @@ from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.model import SoftwarePackage, PackageHistory, PackageUpdate, PackageSuggestion, \
SuggestionPriority
from bauh.api.abstract.view import MessageType
-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, LOCAL_PATH, SUGGESTIONS_FILE
from bauh.gems.appimage.config import read_config
from bauh.gems.appimage.model import AppImage
-from bauh.gems.appimage.query import FIND_APPS_BY_NAME, FIND_APPS_BY_NAME_ONLY_NAME
from bauh.gems.appimage.worker import DatabaseUpdater
+HOME_PATH = str(Path.home())
DB_APPS_PATH = '{}/{}'.format(HOME_PATH, '.local/share/bauh/appimage/apps.db')
DB_RELEASES_PATH = '{}/{}'.format(HOME_PATH, '.local/share/bauh/appimage/releases.db')
diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py
index e158ee81..50db2b2f 100644
--- a/bauh/gems/appimage/model.py
+++ b/bauh/gems/appimage/model.py
@@ -46,7 +46,7 @@ class AppImage(SoftwarePackage):
return self.get_type_icon_path()
def get_type_icon_path(self):
- return resource.get_path('img/appimage.png', ROOT_DIR)
+ return resource.get_path('img/appimage.svg', ROOT_DIR)
def is_application(self):
return True
diff --git a/bauh/gems/appimage/resources/img/appimage.png b/bauh/gems/appimage/resources/img/appimage.png
deleted file mode 100755
index 059771a7..00000000
Binary files a/bauh/gems/appimage/resources/img/appimage.png and /dev/null differ
diff --git a/bauh/gems/appimage/resources/img/appimage.svg b/bauh/gems/appimage/resources/img/appimage.svg
new file mode 100644
index 00000000..f9cb7968
--- /dev/null
+++ b/bauh/gems/appimage/resources/img/appimage.svg
@@ -0,0 +1,335 @@
+
+
+
+
diff --git a/bauh/gems/arch/__init__.py b/bauh/gems/arch/__init__.py
index 65bf849e..5c3c8bee 100644
--- a/bauh/gems/arch/__init__.py
+++ b/bauh/gems/arch/__init__.py
@@ -1,6 +1,7 @@
import os
+from pathlib import Path
-from bauh.api.constants import CACHE_PATH, HOME_PATH, CONFIG_PATH
+from bauh.api.constants import CACHE_PATH, CONFIG_PATH
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD_DIR = '/tmp/bauh/aur'
@@ -8,7 +9,7 @@ ARCH_CACHE_PATH = CACHE_PATH + '/arch'
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)
+CONFIG_DIR = '{}/.config/bauh/arch'.format(Path.home())
CUSTOM_MAKEPKG_FILE = '{}/makepkg.conf'.format(CONFIG_DIR)
AUR_INDEX_FILE = '{}/aur.txt'.format(BUILD_DIR)
CONFIG_FILE = '{}/arch.yml'.format(CONFIG_PATH)
diff --git a/bauh/gems/arch/confirmation.py b/bauh/gems/arch/confirmation.py
index 544c9ef3..9c53f7fb 100644
--- a/bauh/gems/arch/confirmation.py
+++ b/bauh/gems/arch/confirmation.py
@@ -9,7 +9,7 @@ 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)
+ return resource.get_path('img/{}.svg'.format('arch' if mirror == 'aur' else 'mirror'), ROOT_DIR)
def request_optional_deps(pkgname: str, pkg_mirrors: dict, watcher: ProcessWatcher, i18n: I18n) -> Set[str]:
diff --git a/bauh/gems/arch/model.py b/bauh/gems/arch/model.py
index 62d6d5fb..70d02d62 100644
--- a/bauh/gems/arch/model.py
+++ b/bauh/gems/arch/model.py
@@ -61,7 +61,7 @@ class ArchPackage(SoftwarePackage):
return self.icon_path
def get_type_icon_path(self):
- return resource.get_path('img/arch.png', ROOT_DIR) # TODO change icon when from mirrors
+ return resource.get_path('img/arch.svg', ROOT_DIR) # TODO change icon when from mirrors
def is_application(self):
return self.can_be_run()
diff --git a/bauh/gems/arch/resources/img/arch.png b/bauh/gems/arch/resources/img/arch.png
deleted file mode 100755
index c1e2fb1f..00000000
Binary files a/bauh/gems/arch/resources/img/arch.png and /dev/null differ
diff --git a/bauh/gems/arch/resources/img/arch.svg b/bauh/gems/arch/resources/img/arch.svg
new file mode 100644
index 00000000..69267f5c
--- /dev/null
+++ b/bauh/gems/arch/resources/img/arch.svg
@@ -0,0 +1,57 @@
+
+
\ No newline at end of file
diff --git a/bauh/gems/arch/resources/img/mirror.png b/bauh/gems/arch/resources/img/mirror.png
deleted file mode 100755
index b4d85c0d..00000000
Binary files a/bauh/gems/arch/resources/img/mirror.png and /dev/null differ
diff --git a/bauh/gems/arch/resources/img/mirror.svg b/bauh/gems/arch/resources/img/mirror.svg
new file mode 100644
index 00000000..74336f2b
--- /dev/null
+++ b/bauh/gems/arch/resources/img/mirror.svg
@@ -0,0 +1,55 @@
+
+
\ No newline at end of file
diff --git a/bauh/gems/flatpak/model.py b/bauh/gems/flatpak/model.py
index 50e70665..4a95c7ff 100644
--- a/bauh/gems/flatpak/model.py
+++ b/bauh/gems/flatpak/model.py
@@ -36,7 +36,7 @@ class FlatpakApplication(SoftwarePackage):
return 'flatpak'
def get_default_icon_path(self):
- return resource.get_path('img/flathub.svg', ROOT_DIR)
+ return resource.get_path('img/flatpak.svg', ROOT_DIR)
def get_type_icon_path(self):
return self.get_default_icon_path()
diff --git a/bauh/gems/flatpak/resources/img/flatpak.png b/bauh/gems/flatpak/resources/img/flatpak.png
deleted file mode 100755
index 4fa5bb94..00000000
Binary files a/bauh/gems/flatpak/resources/img/flatpak.png and /dev/null differ
diff --git a/bauh/gems/flatpak/resources/img/flathub.svg b/bauh/gems/flatpak/resources/img/flatpak.svg
old mode 100755
new mode 100644
similarity index 97%
rename from bauh/gems/flatpak/resources/img/flathub.svg
rename to bauh/gems/flatpak/resources/img/flatpak.svg
index 1b44a5d4..1a17bd92
--- a/bauh/gems/flatpak/resources/img/flathub.svg
+++ b/bauh/gems/flatpak/resources/img/flatpak.svg
@@ -9,13 +9,13 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="47.919052"
- height="48.110374"
- viewBox="0 0 12.678582 12.729203"
+ width="24.007744"
+ height="23.836931"
+ viewBox="0 0 6.3520486 6.3068546"
version="1.1"
id="svg3871"
- inkscape:version="0.92.3 (2405546, 2018-03-11)"
- sodipodi:docname="flathub.svg">
+ inkscape:version="0.92.4 5da689c313, 2019-01-14"
+ sodipodi:docname="flatpak.svg">
+ transform="translate(-12.150001,-173.82134)">
+
diff --git a/bauh/gems/web/__init__.py b/bauh/gems/web/__init__.py
index 68af6a87..7d9f9321 100644
--- a/bauh/gems/web/__init__.py
+++ b/bauh/gems/web/__init__.py
@@ -1,7 +1,7 @@
import os
from pathlib import Path
-from bauh.api.constants import HOME_PATH, DESKTOP_ENTRIES_DIR, CONFIG_PATH
+from bauh.api.constants import DESKTOP_ENTRIES_DIR, CONFIG_PATH
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home())
@@ -13,7 +13,7 @@ NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH)
NPM_BIN_PATH = '{}/bin/npm'.format(NODE_DIR_PATH)
NODE_MODULES_PATH = '{}/node_modules'.format(ENV_PATH)
NATIVEFIER_BIN_PATH = '{}/.bin/nativefier'.format(NODE_MODULES_PATH)
-ELECTRON_PATH = '{}/.cache/electron'.format(HOME_PATH)
+ELECTRON_PATH = '{}/.cache/electron'.format(Path.home())
ELECTRON_DOWNLOAD_URL = 'https://github.com/electron/electron/releases/download/v{version}/electron-v{version}-linux-{arch}.zip'
ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt'
URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'
diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py
index 0a922658..45fde8db 100644
--- a/bauh/gems/web/controller.py
+++ b/bauh/gems/web/controller.py
@@ -11,6 +11,7 @@ from typing import List, Type, Set, Tuple
import yaml
from colorama import Fore
+from requests import exceptions
from bauh.api.abstract.context import ApplicationContext
from bauh.api.abstract.controller import SoftwareManager, SearchResult
@@ -136,10 +137,14 @@ class WebApplicationManager(SoftwareManager):
return description
def _get_fix_for(self, url_no_protocol: str) -> str:
- res = self.http_client.get(URL_FIX_PATTERN.format(url=url_no_protocol))
+ fix_url = URL_FIX_PATTERN.format(url=url_no_protocol)
- if res:
- return res.text
+ try:
+ res = self.http_client.get(fix_url, session=False)
+ if res:
+ return res.text
+ except Exception as e:
+ self.logger.warning("Error when trying to retrieve a fix for {}: {}".format(fix_url, e.__class__.__name__))
def _strip_url_protocol(self, url: str) -> str:
return RE_PROTOCOL_STRIP.split(url)[1].strip().lower()
@@ -149,10 +154,14 @@ class WebApplicationManager(SoftwareManager):
def _map_url(self, url: str) -> "BeautifulSoup":
headers = {'Accept-language': self._get_lang_header(), 'User-Agent': UA_CHROME}
- url_res = self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True)
- if url_res:
- return BeautifulSoup(url_res.text, 'lxml', parse_only=SoupStrainer('head'))
+ try:
+ url_res = self.http_client.get(url, headers=headers, ignore_ssl=True, single_call=True, session=False)
+
+ if url_res:
+ return BeautifulSoup(url_res.text, 'lxml', parse_only=SoupStrainer('head'))
+ except exceptions.ConnectionError as e:
+ self.logger.warning("Could not get {}: {}".format(url, e.__class__.__name__))
def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_url: bool = False) -> SearchResult:
local_config = {}
@@ -411,7 +420,7 @@ class WebApplicationManager(SoftwareManager):
default_option=icon_op_disp if app.icon_url and app.save_icon else icon_op_ded,
label=self.i18n['web.install.option.wicon.label'])
- icon_chooser = FileChooserComponent(allowed_extensions={'png', 'svg', 'ico'}, label=self.i18n['web.install.option.icon.label'])
+ icon_chooser = FileChooserComponent(allowed_extensions={'png', 'svg', 'ico', 'xpm'}, label=self.i18n['web.install.option.icon.label'])
form_1 = FormComponent(components=[inp_url, inp_name, inp_desc, inp_cat, inp_icon, icon_chooser, inp_tray], label=self.i18n['web.install.options.basic'].capitalize())
@@ -506,7 +515,7 @@ class WebApplicationManager(SoftwareManager):
def _ask_update_permission(self, to_update: List[EnvironmentComponent], watcher: ProcessWatcher) -> bool:
- icon = resource.get_path('img/web.png', ROOT_DIR)
+ icon = resource.get_path('img/web.svg', ROOT_DIR)
opts = [InputOption(label='{} ( {} )'.format(f.name, f.size or '?'),
tooltip=f.url, icon_path=icon, read_only=True, value=f.name) for f in to_update]
@@ -520,11 +529,11 @@ class WebApplicationManager(SoftwareManager):
def _download_suggestion_icon(self, pkg: WebApplication, app_dir: str) -> Tuple[str, bytes]:
try:
- if self.http_client.exists(pkg.icon_url):
+ if self.http_client.exists(pkg.icon_url, session=False):
icon_path = '{}/{}'.format(app_dir, pkg.icon_url.split('/')[-1])
try:
- res = self.http_client.get(pkg.icon_url)
+ res = self.http_client.get(pkg.icon_url, session=False)
if not res:
self.logger.info('Could not download the icon {}'.format(pkg.icon_url))
else:
@@ -747,7 +756,7 @@ class WebApplicationManager(SoftwareManager):
if not app.description:
app.description = self._get_app_description(app.url, soup)
- find_url = not app.icon_url or (app.icon_url and not self.http_client.exists(app.icon_url))
+ find_url = not app.icon_url or (app.icon_url and not self.http_client.exists(app.icon_url, session=False))
if find_url:
app.icon_url = self._get_app_icon_url(app.url, soup)
diff --git a/bauh/gems/web/model.py b/bauh/gems/web/model.py
index 46bd35df..be82babc 100644
--- a/bauh/gems/web/model.py
+++ b/bauh/gems/web/model.py
@@ -54,7 +54,7 @@ class WebApplication(SoftwarePackage):
return self.get_default_icon_path()
def get_default_icon_path(self) -> str:
- return resource.get_path('img/web.png', ROOT_DIR)
+ return resource.get_path('img/web.svg', ROOT_DIR)
def get_disk_data_path(self) -> str:
return '{}/data.yml'.format(self.get_disk_cache_path())
diff --git a/bauh/gems/web/resources/img/web.png b/bauh/gems/web/resources/img/web.png
deleted file mode 100644
index 2e6fb51c..00000000
Binary files a/bauh/gems/web/resources/img/web.png and /dev/null differ
diff --git a/bauh/gems/web/resources/img/web.svg b/bauh/gems/web/resources/img/web.svg
new file mode 100644
index 00000000..c6c54485
--- /dev/null
+++ b/bauh/gems/web/resources/img/web.svg
@@ -0,0 +1,112 @@
+
+
diff --git a/bauh/gems/web/worker.py b/bauh/gems/web/worker.py
index c6b68d6e..48182222 100644
--- a/bauh/gems/web/worker.py
+++ b/bauh/gems/web/worker.py
@@ -19,7 +19,7 @@ class SuggestionsDownloader:
def download(self) -> dict:
self.logger.info("Reading suggestions from {}".format(URL_SUGGESTIONS))
try:
- suggestions = self.http_client.get_yaml(URL_SUGGESTIONS)
+ suggestions = self.http_client.get_yaml(URL_SUGGESTIONS, session=False)
if suggestions:
self.logger.info("{} suggestions successfully read".format(len(suggestions)))
diff --git a/bauh/view/qt/about.py b/bauh/view/qt/about.py
index e553c1a0..abc2e3c1 100644
--- a/bauh/view/qt/about.py
+++ b/bauh/view/qt/about.py
@@ -55,7 +55,7 @@ class AboutDialog(QDialog):
gems_widget.layout().addWidget(QLabel())
for gem_path in available_gems:
icon = QLabel()
- pxmap = QPixmap(gem_path + '/resources/img/{}.png'.format(gem_path.split('/')[-1]))
+ pxmap = QPixmap(gem_path + '/resources/img/{}.svg'.format(gem_path.split('/')[-1]))
icon.setPixmap(pxmap.scaled(24, 24, Qt.KeepAspectRatio, Qt.SmoothTransformation))
gems_widget.layout().addWidget(icon)
gems_widget.layout().addWidget(QLabel())
diff --git a/bauh/view/qt/apps_table.py b/bauh/view/qt/apps_table.py
index 2a68cda1..19acbc11 100644
--- a/bauh/view/qt/apps_table.py
+++ b/bauh/view/qt/apps_table.py
@@ -2,7 +2,7 @@ import os
from threading import Lock
from typing import List
-from PyQt5.QtCore import Qt, QUrl
+from PyQt5.QtCore import Qt, QUrl, QSize
from PyQt5.QtGui import QPixmap, QIcon, QCursor
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
from PyQt5.QtWidgets import QTableWidget, QTableView, QMenu, QAction, QTableWidgetItem, QToolButton, QWidget, \
@@ -14,6 +14,7 @@ from bauh.commons.html import strip_html
from bauh.view.qt import dialog
from bauh.view.qt.components import IconButton
from bauh.view.qt.view_model import PackageView, PackageViewStatus
+from bauh.view.qt.view_utils import load_resource_icon
from bauh.view.util import resource
from bauh.view.util.translation import I18n
@@ -77,7 +78,7 @@ class AppsTable(QTableWidget):
self.setHorizontalHeaderLabels(['' for _ in range(self.columnCount())])
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.icon_logo = QIcon(resource.get_path('img/logo.svg'))
- self.pixmap_verified = QPixmap(resource.get_path('img/verified.svg'))
+ self.pixmap_verified = QIcon(resource.get_path('img/verified.svg')).pixmap(QSize(10, 10))
self.network_man = QNetworkAccessManager()
self.network_man.finished.connect(self._load_icon_and_cache)
@@ -288,8 +289,7 @@ class AppsTable(QTableWidget):
pixmap = self.cache_type_icon.get(pkg.model.get_type())
if not pixmap:
- pixmap = QPixmap(pkg.model.get_type_icon_path())
- pixmap = pixmap.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation)
+ pixmap = QIcon(pkg.model.get_type_icon_path()).pixmap(QSize(14,14))
self.cache_type_icon[pkg.model.get_type()] = pixmap
item = QLabel()
@@ -426,26 +426,26 @@ class AppsTable(QTableWidget):
def run():
self.window.run_app(pkg)
- item.addWidget(IconButton(icon_path=resource.get_path('img/app_play.png'), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
+ item.addWidget(IconButton(QIcon(resource.get_path('img/app_play.svg')), action=run, background='#088A08', tooltip=self.i18n['action.run.tooltip']))
if pkg.model.has_info():
def get_info():
self.window.get_app_info(pkg)
- item.addWidget(IconButton(icon_path=resource.get_path('img/app_info.svg'), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']))
+ item.addWidget(IconButton(QIcon(resource.get_path('img/app_info.svg')), action=get_info, background='#2E68D3', tooltip=self.i18n['action.info.tooltip']))
if pkg.model.has_screenshots():
def get_screenshots():
self.window.get_screenshots(pkg)
- item.addWidget(IconButton(icon_path=resource.get_path('img/camera.svg'), action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']))
+ item.addWidget(IconButton(QIcon(resource.get_path('img/camera.svg')), action=get_screenshots, background='purple', tooltip=self.i18n['action.screenshots.tooltip']))
def handle_click():
self.show_pkg_settings(pkg)
if self.has_any_settings(pkg):
- bt = IconButton(icon_path=resource.get_path('img/app_settings.svg'), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
+ bt = IconButton(QIcon(resource.get_path('img/app_settings.svg')), action=handle_click, background='#12ABAB', tooltip=self.i18n['action.settings.tooltip'])
item.addWidget(bt)
self.setCellWidget(pkg.table_index, col, item)
diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py
index 5f6e4e30..dd7b2da2 100644
--- a/bauh/view/qt/components.py
+++ b/bauh/view/qt/components.py
@@ -8,7 +8,7 @@ from PyQt5.QtWidgets import QRadioButton, QGroupBox, QCheckBox, QComboBox, QGrid
from bauh.api.abstract.view import SingleSelectComponent, InputOption, MultipleSelectComponent, SelectViewType, \
TextInputComponent, FormComponent, FileChooserComponent
-from bauh.view.qt import css
+from bauh.view.qt import css, view_utils
from bauh.view.util import resource
from bauh.view.util.translation import I18n
@@ -182,8 +182,9 @@ class MultipleSelectQt(QGroupBox):
for op in model.options: # loads the help icon if at least one option has a tooltip
if op.tooltip:
- with open(resource.get_path('img/help.png'), 'rb') as f:
+ with open(resource.get_path('img/about.svg'), 'rb') as f:
pixmap_help.loadFromData(f.read())
+ pixmap_help = pixmap_help.scaled(16, 16, Qt.KeepAspectRatio, Qt.SmoothTransformation)
break
for op in model.options:
@@ -240,10 +241,10 @@ class InputFilter(QLineEdit):
class IconButton(QWidget):
- def __init__(self, icon_path: str, action, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None):
+ def __init__(self, icon: QIcon, action, background: str = None, align: int = Qt.AlignCenter, tooltip: str = None):
super(IconButton, self).__init__()
self.bt = QToolButton()
- self.bt.setIcon(QIcon(icon_path))
+ self.bt.setIcon(icon)
self.bt.clicked.connect(action)
if background:
diff --git a/bauh/view/qt/gem_selector.py b/bauh/view/qt/gem_selector.py
index e8bf9dae..15f4b5a3 100644
--- a/bauh/view/qt/gem_selector.py
+++ b/bauh/view/qt/gem_selector.py
@@ -49,7 +49,7 @@ class GemSelectorPanel(QWidget):
op = InputOption(label=i18n.get('gem.{}.label'.format(modname), modname.capitalize()),
tooltip=i18n.get('gem.{}.info'.format(modname)),
value=modname,
- icon_path='{r}/gems/{n}/resources/img/{n}.png'.format(r=ROOT_DIR, n=modname))
+ icon_path='{r}/gems/{n}/resources/img/{n}.svg'.format(r=ROOT_DIR, n=modname))
gem_options.append(op)
self.gem_map[modname] = m
diff --git a/bauh/view/qt/root.py b/bauh/view/qt/root.py
index 37d9c1e9..539a1e89 100644
--- a/bauh/view/qt/root.py
+++ b/bauh/view/qt/root.py
@@ -1,12 +1,11 @@
import os
-from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QInputDialog, QLineEdit
from bauh.api.abstract.view import MessageType
from bauh.commons.system import new_subprocess
from bauh.view.qt.dialog import show_message
-from bauh.view.util import resource
+from bauh.view.qt.view_utils import load_resource_icon
from bauh.view.util.translation import I18n
@@ -19,7 +18,7 @@ def ask_root_password(i18n: I18n):
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.setWindowIcon(load_resource_icon('img/lock.svg', 20, 24))
diag.setWindowTitle(i18n['popup.root.title'])
diag.setLabelText('')
diag.setOkButtonText(i18n['popup.root.continue'].capitalize())
diff --git a/bauh/view/qt/systray.py b/bauh/view/qt/systray.py
index dfd986b0..461ba3ad 100755
--- a/bauh/view/qt/systray.py
+++ b/bauh/view/qt/systray.py
@@ -11,6 +11,7 @@ from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
from bauh import __app_name__
from bauh.api.abstract.controller import SoftwareManager
from bauh.api.abstract.model import PackageUpdate
+from bauh.view.qt.view_utils import load_resource_icon
from bauh.view.util import util, resource
from bauh.view.qt.about import AboutDialog
from bauh.view.qt.window import ManageWindow
@@ -47,7 +48,7 @@ class TrayIcon(QSystemTrayIcon):
self.icon_default = QIcon.fromTheme('bauh_tray_default')
if self.icon_default.isNull():
- self.icon_default = QIcon(resource.get_path('img/logo.png'))
+ self.icon_default = load_resource_icon('img/logo.svg', 24)
if config['ui']['tray']['updates_icon']:
self.icon_updates = QIcon(config['ui']['tray']['updates_icon'])
@@ -55,7 +56,7 @@ class TrayIcon(QSystemTrayIcon):
self.icon_updates = QIcon.fromTheme('bauh_tray_updates')
if self.icon_updates.isNull():
- self.icon_updates = QIcon(resource.get_path('img/logo_update.png'))
+ self.icon_updates = load_resource_icon('img/logo_update.svg', 24)
self.setIcon(self.icon_default)
diff --git a/bauh/view/qt/view_utils.py b/bauh/view/qt/view_utils.py
index b8edd2f5..bb66cb88 100644
--- a/bauh/view/qt/view_utils.py
+++ b/bauh/view/qt/view_utils.py
@@ -1,7 +1,13 @@
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIcon, QPixmap
+from bauh.view.util import resource
+
+
+def load_icon(path: str, width: int, height: int = None) -> QIcon:
+ return QIcon(QPixmap(path).scaled(width, height if height else width, Qt.KeepAspectRatio, Qt.SmoothTransformation))
+
+
+def load_resource_icon(path: str, width: int, height: int = None) -> QIcon:
+ return load_icon(resource.get_path(path), width, height)
-def load_icon(path: str, size: int) -> QIcon:
- pixmap = QPixmap(path)
- return QIcon(pixmap.scaled(size, size, Qt.KeepAspectRatio, Qt.SmoothTransformation))
diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py
index 3d89f659..536a59e0 100755
--- a/bauh/view/qt/window.py
+++ b/bauh/view/qt/window.py
@@ -8,7 +8,7 @@ from typing import List, Type, Set
from PyQt5.QtCore import QEvent, Qt, QSize, pyqtSignal
from PyQt5.QtGui import QIcon, QWindowStateChangeEvent, QPixmap, QCursor
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox, QHeaderView, QToolBar, \
- QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QPushButton, QComboBox, QMenu, QAction, QApplication
+ QLabel, QPlainTextEdit, QLineEdit, QProgressBar, QPushButton, QComboBox, QMenu, QAction, QApplication, QListView
from bauh.api.abstract.cache import MemoryCache
from bauh.api.abstract.context import ApplicationContext
@@ -33,7 +33,7 @@ from bauh.view.qt.thread import UpdateSelectedApps, RefreshApps, UninstallApp, D
GetAppHistory, SearchPackages, InstallPackage, AnimateProgress, VerifyModels, FindSuggestions, ListWarnings, \
AsyncAction, LaunchApp, ApplyFilters, CustomAction, GetScreenshots
from bauh.view.qt.view_model import PackageView
-from bauh.view.qt.view_utils import load_icon
+from bauh.view.qt.view_utils import load_icon, load_resource_icon
from bauh.view.util import util, resource
from bauh.view.util.translation import I18n
@@ -118,7 +118,8 @@ class ManageWindow(QWidget):
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.setPixmap(QPixmap(resource.get_path('img/search.svg')))
+ label_pos_search.setPixmap(QIcon(resource.get_path('img/search.svg')).pixmap(QSize(10,10)))
label_pos_search.setStyleSheet("""
background: white; padding-right: 10px;
border-top-right-radius: 5px;
@@ -151,13 +152,15 @@ class ManageWindow(QWidget):
self.any_type_filter = 'any'
self.cache_type_filter_icons = {}
self.combo_filter_type = QComboBox()
+ self.combo_filter_type.setView(QListView())
self.combo_filter_type.setStyleSheet('QLineEdit { height: 2px; }')
self.combo_filter_type.setSizeAdjustPolicy(QComboBox.AdjustToContents)
self.combo_filter_type.setEditable(True)
self.combo_filter_type.lineEdit().setReadOnly(True)
self.combo_filter_type.lineEdit().setAlignment(Qt.AlignCenter)
+ self.combo_filter_type.setIconSize(QSize(14,14))
self.combo_filter_type.activated.connect(self._handle_type_filter)
- self.combo_filter_type.addItem(load_icon(resource.get_path('img/logo.svg'), 14), self.i18n['type'].capitalize(), self.any_type_filter)
+ self.combo_filter_type.addItem('--- {} ---'.format(self.i18n['type'].capitalize()), self.any_type_filter)
self.ref_combo_filter_type = self.toolbar.addWidget(self.combo_filter_type)
self.any_category_filter = 'any'
@@ -185,7 +188,7 @@ class ManageWindow(QWidget):
self.bt_installed = QPushButton()
self.bt_installed.setToolTip(self.i18n['manage_window.bt.installed.tooltip'])
- self.bt_installed.setIcon(QIcon(resource.get_path('img/disk.png')))
+ self.bt_installed.setIcon(QIcon(resource.get_path('img/disk.svg')))
self.bt_installed.setText(self.i18n['manage_window.bt.installed.text'].capitalize())
self.bt_installed.clicked.connect(self._show_installed)
self.bt_installed.setStyleSheet(toolbar_button_style('#A94E0A'))
@@ -318,7 +321,7 @@ class ManageWindow(QWidget):
self.combo_styles.setStyleSheet('QComboBox {font-size: 12px;}')
self.ref_combo_styles = self.toolbar_bottom.addWidget(self.combo_styles)
- bt_settings = IconButton(icon_path=resource.get_path('img/app_settings.svg'),
+ bt_settings = IconButton(QIcon(resource.get_path('img/app_settings.svg')),
action=self._show_settings_menu,
background='#12ABAB',
tooltip=self.i18n['manage_window.bt_settings.tooltip'])
@@ -777,7 +780,7 @@ class ManageWindow(QWidget):
icon = self.cache_type_filter_icons.get(app_type)
if not icon:
- icon = load_icon(icon_path, 14)
+ icon = QIcon(icon_path)
self.cache_type_filter_icons[app_type] = icon
self.combo_filter_type.addItem(icon, app_type.capitalize(), app_type)
diff --git a/bauh/view/resources/img/app_play.png b/bauh/view/resources/img/app_play.png
deleted file mode 100755
index b98062b5..00000000
Binary files a/bauh/view/resources/img/app_play.png and /dev/null differ
diff --git a/bauh/view/resources/img/app_play.svg b/bauh/view/resources/img/app_play.svg
new file mode 100755
index 00000000..284bd52e
--- /dev/null
+++ b/bauh/view/resources/img/app_play.svg
@@ -0,0 +1,156 @@
+
+
+
+
diff --git a/bauh/view/resources/img/disk.png b/bauh/view/resources/img/disk.png
deleted file mode 100755
index c9c5d790..00000000
Binary files a/bauh/view/resources/img/disk.png and /dev/null differ
diff --git a/bauh/view/resources/img/disc.svg b/bauh/view/resources/img/disk.svg
similarity index 59%
rename from bauh/view/resources/img/disc.svg
rename to bauh/view/resources/img/disk.svg
index f3ca7d18..a3fa07a0 100755
--- a/bauh/view/resources/img/disc.svg
+++ b/bauh/view/resources/img/disk.svg
@@ -13,13 +13,12 @@
id="Capa_1"
x="0px"
y="0px"
- viewBox="0 0 24 24"
+ viewBox="0 0 24.000261 23.700262"
xml:space="preserve"
- sodipodi:docname="disc_2.svg"
- width="24"
- height="24"
+ sodipodi:docname="disc.svg"
+ width="24.000261"
+ height="23.700262"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
- inkscape:export-filename="/home/vinicius.moreira/shared_vb/disk_2.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+ transform="translate(-8.9953185,-22.380568)">
+
+
+
\ No newline at end of file
diff --git a/bauh/view/resources/img/logo.png b/bauh/view/resources/img/logo.png
deleted file mode 100644
index c557b4c3..00000000
Binary files a/bauh/view/resources/img/logo.png and /dev/null differ
diff --git a/bauh/view/resources/img/logo_update.png b/bauh/view/resources/img/logo_update.png
deleted file mode 100644
index 6941519b..00000000
Binary files a/bauh/view/resources/img/logo_update.png and /dev/null differ
diff --git a/bauh/view/resources/locale/de b/bauh/view/resources/locale/de
index f4387ad2..d931929d 100644
--- a/bauh/view/resources/locale/de
+++ b/bauh/view/resources/locale/de
@@ -171,4 +171,5 @@ files=Dateien
all_files=Alle Dateien
file_chooser.title=Dateiauswahl
message.file.not_exist=Datei existiert nicht
-message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
\ No newline at end of file
+message.file.not_exist.body=Die Datei {} scheint nicht zu existieren
+development=Entwicklung
\ No newline at end of file
diff --git a/bauh/view/resources/locale/en b/bauh/view/resources/locale/en
index baf28c65..079441d4 100644
--- a/bauh/view/resources/locale/en
+++ b/bauh/view/resources/locale/en
@@ -175,4 +175,5 @@ files=files
all_files=all files
file_chooser.title=File selector
message.file.not_exist=File does not exist
-message.file.not_exist.body=The file {} seems not to exist
\ No newline at end of file
+message.file.not_exist.body=The file {} seems not to exist
+development=development
\ No newline at end of file
diff --git a/bauh/view/resources/locale/it b/bauh/view/resources/locale/it
index f715f261..d9d9fed0 100644
--- a/bauh/view/resources/locale/it
+++ b/bauh/view/resources/locale/it
@@ -172,4 +172,5 @@ files=files
all_files=tutti i files
file_chooser.title=Selettore file
message.file.not_exist=File non esiste
-message.file.not_exist.body=Il file {} sembra non esistere
\ No newline at end of file
+message.file.not_exist.body=Il file {} sembra non esistere
+development=sviluppo
\ No newline at end of file
diff --git a/bauh/view/util/translation.py b/bauh/view/util/translation.py
index a76204a2..40c22685 100644
--- a/bauh/view/util/translation.py
+++ b/bauh/view/util/translation.py
@@ -19,7 +19,10 @@ class I18n(dict):
return self.current.__getitem__(item)
except KeyError:
if self.default:
- return self.default.__getitem__(item)
+ try:
+ return self.default.__getitem__(item)
+ except KeyError:
+ return item
else:
return item