Merge branch 'staging' into modules

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Vinicius Moreira
2019-07-29 11:55:23 -03:00
5 changed files with 40 additions and 29 deletions

View File

@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Comments ### Comments
- Env variables / arguments FPAKMAN_SNAP / FPAKMAN_FLATPAK were removed. To disable a supported type, just uninstall its module. - Env variables / arguments FPAKMAN_SNAP / FPAKMAN_FLATPAK were removed. To disable a supported type, just uninstall its module.
## [0.4.3]
### Improvements
- new environment variable / argument to enable / disable the tray icon and update-check daemon: FPAKMAN_TRAY (--tray)
## [0.4.2] - 2019-07-28 ## [0.4.2] - 2019-07-28
### Improvements ### Improvements
- showing a warning dialog when the application starts and **snapd** is unavailable - showing a warning dialog when the application starts and **snapd** is unavailable

View File

@@ -50,6 +50,7 @@ You can change some application settings via environment variables or arguments
- **FPAKMAN_DISK_CACHE**: enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Use **0** (disable) or **1** (enable, default). - **FPAKMAN_DISK_CACHE**: enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Use **0** (disable) or **1** (enable, default).
- **FPAKMAN_DOWNLOAD_ICONS**: Enables / disables app icons download. It may improve the application speed depending on how applications data are being retrieved. Use **0** (disable) or **1** (enable, default). - **FPAKMAN_DOWNLOAD_ICONS**: Enables / disables app icons download. It may improve the application speed depending on how applications data are being retrieved. Use **0** (disable) or **1** (enable, default).
- **FPAKMAN_CHECK_PACKAGING_ONCE**: If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Use **0** (disable, default) or **1** (enable). - **FPAKMAN_CHECK_PACKAGING_ONCE**: If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Use **0** (disable, default) or **1** (enable).
- **FPAKMAN_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable) or **1** (enable, default).
### How to improve the application performance ### How to improve the application performance
- If you don't care about restarting **fpakman** every time a new supported packaging technology is installed, set "check-packaging-once=1" (**fpakman --check-packaging-once=1**). This can reduce the application response time up to 80% in some scenarios, since it won't need to recheck if the packaging type is available for every action you request. - If you don't care about restarting **fpakman** every time a new supported packaging technology is installed, set "check-packaging-once=1" (**fpakman --check-packaging-once=1**). This can reduce the application response time up to 80% in some scenarios, since it won't need to recheck if the packaging type is available for every action you request.

View File

@@ -6,15 +6,20 @@ from pathlib import Path
desktop_file = """ desktop_file = """
[Desktop Entry] [Desktop Entry]
Type = Application Type = Application
Name = fpakman Name = fpakman ({desc})
Categories = System; Categories = System;
Comment = Manage your Flatpak / Snap applications Comment = Manage your Flatpak / Snap applications
Exec = /usr/bin/fpakman Exec = /usr/bin/fpakman{param}
Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg
""".format(version="{}.{}".format(sys.version_info.major, sys.version_info.minor)) """
py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor)
with open('fpakman.desktop', 'w+') as f: with open('fpakman.desktop', 'w+') as f:
f.write(desktop_file) f.write(desktop_file.format(desc='panel', version=py_version, param=' --tray 0'))
with open('fpakman_tray.desktop', 'w+') as f:
f.write(desktop_file.format(desc='tray', version=py_version, param=''))
# cleaning the old fpakman.desktop entry model -> the following lines will be removed for the next releases # cleaning the old fpakman.desktop entry model -> the following lines will be removed for the next releases

View File

@@ -20,6 +20,7 @@ from fpakman.util.cache import Cache
from fpakman.util.memory import CacheCleaner from fpakman.util.memory import CacheCleaner
from fpakman.view.qt import dialog from fpakman.view.qt import dialog
from fpakman.view.qt.systray import TrayIcon from fpakman.view.qt.systray import TrayIcon
from fpakman.view.qt.window import ManageWindow
def log_msg(msg: str, color: int = None): def log_msg(msg: str, color: int = None):
@@ -40,6 +41,7 @@ parser.add_argument('-n', '--update-notification', action="store", choices=[0, 1
parser.add_argument('-dc', '--disk-cache', action="store", choices=[0, 1], default=os.getenv('FPAKMAN_DISK_CACHE', 1), type=int, help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s') parser.add_argument('-dc', '--disk-cache', action="store", choices=[0, 1], default=os.getenv('FPAKMAN_DISK_CACHE', 1), type=int, help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s')
parser.add_argument('-di', '--download-icons', action="store", choices=[0, 1], default=os.getenv('FPAKMAN_DOWNLOAD_ICONS', 1), type=int, help='Enables / disables app icons download. It may improve the application speed, depending of how applications data are retrieved by their extensions.') parser.add_argument('-di', '--download-icons', action="store", choices=[0, 1], default=os.getenv('FPAKMAN_DOWNLOAD_ICONS', 1), type=int, help='Enables / disables app icons download. It may improve the application speed, depending of how applications data are retrieved by their extensions.')
parser.add_argument('-co', '--check-packaging-once', action="store", default=os.getenv('FPAKMAN_CHECK_PACKAGING_ONCE', 0), choices=[0, 1], type=int, help='If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Default: %(default)s') parser.add_argument('-co', '--check-packaging-once', action="store", default=os.getenv('FPAKMAN_CHECK_PACKAGING_ONCE', 0), choices=[0, 1], type=int, help='If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Default: %(default)s')
parser.add_argument('--tray', action="store", default=os.getenv('FPAKMAN_TRAY', 1), choices=[0, 1], type=int, help='If the tray icon and update-check daemon should be created. Default: %(default)s')
args = parser.parse_args() args = parser.parse_args()
if args.cache_exp < 0: if args.cache_exp < 0:
@@ -114,16 +116,27 @@ app.setApplicationName(__app_name__)
app.setApplicationVersion(__version__) app.setApplicationVersion(__version__)
app.setWindowIcon(QIcon(resource.get_path('img/logo.svg'))) app.setWindowIcon(QIcon(resource.get_path('img/logo.svg')))
trayIcon = TrayIcon(locale_keys=locale_keys, screen_size = app.primaryScreen().size()
manager=manager,
check_interval=args.check_interval,
icon_cache=icon_cache,
disk_cache=args.disk_cache,
update_notification=bool(args.update_notification),
download_icons=args.download_icons,
screen_size=app.primaryScreen().size())
trayIcon.show() manage_window = ManageWindow(locale_keys=locale_keys,
manager=manager,
icon_cache=icon_cache,
disk_cache=args.disk_cache,
download_icons=bool(args.download_icons),
screen_size=screen_size)
if args.tray:
trayIcon = TrayIcon(locale_keys=locale_keys,
manager=manager,
manage_window=manage_window,
check_interval=args.check_interval,
update_notification=bool(args.update_notification))
manage_window.tray_icon = trayIcon
trayIcon.show()
else:
manage_window.refresh_apps()
manage_window.show()
CacheCleaner(caches).start() CacheCleaner(caches).start()

View File

@@ -2,7 +2,7 @@ import time
from threading import Lock, Thread from threading import Lock, Thread
from typing import List from typing import List
from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, Qt, QSize from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, Qt
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QSystemTrayIcon, QMenu from PyQt5.QtWidgets import QSystemTrayIcon, QMenu
@@ -10,7 +10,6 @@ from fpakman import __app_name__
from fpakman.core import resource, system from fpakman.core import resource, system
from fpakman.core.controller import ApplicationManager from fpakman.core.controller import ApplicationManager
from fpakman.core.model import ApplicationUpdate from fpakman.core.model import ApplicationUpdate
from fpakman.util.cache import Cache
from fpakman.view.qt.about import AboutDialog from fpakman.view.qt.about import AboutDialog
from fpakman.view.qt.window import ManageWindow from fpakman.view.qt.window import ManageWindow
@@ -34,14 +33,10 @@ class UpdateCheck(QThread):
class TrayIcon(QSystemTrayIcon): class TrayIcon(QSystemTrayIcon):
def __init__(self, locale_keys: dict, manager: ApplicationManager, icon_cache: Cache, disk_cache: bool, download_icons: bool, screen_size: QSize, check_interval: int = 60, update_notification: bool = True): def __init__(self, locale_keys: dict, manager: ApplicationManager, manage_window: ManageWindow, check_interval: int = 60, update_notification: bool = True):
super(TrayIcon, self).__init__() super(TrayIcon, self).__init__()
self.locale_keys = locale_keys self.locale_keys = locale_keys
self.manager = manager self.manager = manager
self.icon_cache = icon_cache
self.disk_cache = disk_cache
self.download_icons = download_icons
self.screen_size = screen_size
self.icon_default = QIcon(resource.get_path('img/logo.png')) self.icon_default = QIcon(resource.get_path('img/logo.png'))
self.icon_update = QIcon(resource.get_path('img/logo_update.png')) self.icon_update = QIcon(resource.get_path('img/logo_update.png'))
@@ -73,6 +68,8 @@ class TrayIcon(QSystemTrayIcon):
self.activated.connect(self.handle_click) self.activated.connect(self.handle_click)
self.set_default_tooltip() self.set_default_tooltip()
self.manage_window = manage_window
def set_default_tooltip(self): def set_default_tooltip(self):
self.setToolTip('{} ({})'.format(self.locale_keys['manage_window.title'], __app_name__).lower()) self.setToolTip('{} ({})'.format(self.locale_keys['manage_window.title'], __app_name__).lower())
@@ -116,15 +113,6 @@ class TrayIcon(QSystemTrayIcon):
self.lock_notify.release() self.lock_notify.release()
def show_manage_window(self): def show_manage_window(self):
if self.manage_window is None:
self.manage_window = ManageWindow(locale_keys=self.locale_keys,
manager=self.manager,
icon_cache=self.icon_cache,
tray_icon=self,
disk_cache=self.disk_cache,
download_icons=self.download_icons,
screen_size=self.screen_size)
if self.manage_window.isMinimized(): if self.manage_window.isMinimized():
self.manage_window.setWindowState(Qt.WindowNoState) self.manage_window.setWindowState(Qt.WindowNoState)
elif not self.manage_window.isVisible(): elif not self.manage_window.isVisible():