From 1930d5d54bbde453f0d72ed659e2e4744b9997b0 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 10:26:47 -0300 Subject: [PATCH 1/7] --tray default to 0 --- CHANGELOG.md | 1 + README.md | 2 +- aur/panel_entry.py | 9 ++++++--- aur/tray_entry.py | 11 +++++++---- fpakman/app.py | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e4e69e..2e563f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - suggestions are now retrieved asynchronously taking 45% less time. - search response takes an average of 20% less time ( reaching 35% for several results ) - app boot takes 98% less time when snapd is installed, but disabled +- FPAKMAN_TRAY (--tray) is not enabled by default (0). ### Fixes: - [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36) diff --git a/README.md b/README.md index e5edc104..a3b8aa64 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ You can change some application settings via environment variables or arguments - **FPAKMAN_FLATPAK**: enables / disables flatpak usage. Use **0** (disable) or **1** (enabled, default) - **FPAKMAN_SNAP**: enables / disables snap usage. Use **0** (disable) or **1** (enabled, 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_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable) or **1** (enable, default). +- **FPAKMAN_TRAY**: If the tray icon and update-check daemon should be created. Use **0** (disable, default) or **1** (enable). - **FPAKMAN_SUGGESTIONS**: If application suggestions should be displayed if no app is installed (runtimes do not count as apps). Use **0** (disable) or **1** (enable, default). ### How to improve the application performance diff --git a/aur/panel_entry.py b/aur/panel_entry.py index a2e2887e..56493aa7 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -1,4 +1,5 @@ # Generates a .desktop file based on the current python version. Used for AUR installation +import os import sys desktop_file = """ @@ -7,11 +8,13 @@ Type = Application Name = fpakman Categories = System; Comment = Manage your Flatpak / Snap applications -Exec = /usr/bin/fpakman --tray=0 -Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg +Exec = {path} +Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg """ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) with open('fpakman.desktop', 'w+') as f: - f.write(desktop_file.format(version=py_version)) + f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), + version=py_version, + path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) diff --git a/aur/tray_entry.py b/aur/tray_entry.py index 881a95e6..77d2d9f2 100644 --- a/aur/tray_entry.py +++ b/aur/tray_entry.py @@ -1,17 +1,20 @@ # Generates a .desktop file based on the current python version. Used for AUR installation +import os import sys desktop_file = """ [Desktop Entry] Type = Application -Name = fpakman ( tray ) +Name = fpakman Categories = System; Comment = Manage your Flatpak / Snap applications -Exec = /usr/bin/fpakman -Icon = /usr/lib/python{version}/site-packages/fpakman/resources/img/logo.svg +Exec = {path} --tray=1 +Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg """ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) with open('fpakman_tray.desktop', 'w+') as f: - f.write(desktop_file.format(version=py_version)) + f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), + version=py_version, + path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) diff --git a/fpakman/app.py b/fpakman/app.py index 1535103e..1eb7b586 100755 --- a/fpakman/app.py +++ b/fpakman/app.py @@ -45,7 +45,7 @@ parser.add_argument('-di', '--download-icons', action="store", choices=[0, 1], d parser.add_argument('--flatpak', action="store", default=os.getenv('FPAKMAN_FLATPAK', 1), choices=[0, 1], type=int, help='Enables / disables flatpak usage. Default: %(default)s') parser.add_argument('--snap', action="store", default=os.getenv('FPAKMAN_SNAP', 1), choices=[0, 1], type=int, help='Enables / disables snap usage. 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') +parser.add_argument('--tray', action="store", default=os.getenv('FPAKMAN_TRAY', 0), choices=[0, 1], type=int, help='If the tray icon and update-check daemon should be created. Default: %(default)s') parser.add_argument('--sugs', action="store", default=os.getenv('FPAKMAN_SUGGESTIONS', 1), choices=[0, 1], type=int, help='If app suggestions should be displayed if no app is installed (runtimes do not count as apps). Default: %(default)s') args = parser.parse_args() From e87a13a987563a7aea9e84fca44b9c34deed23db Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 10:28:27 -0300 Subject: [PATCH 2/7] fix: AUR tray entry --- aur/tray_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aur/tray_entry.py b/aur/tray_entry.py index 77d2d9f2..2035b1d7 100644 --- a/aur/tray_entry.py +++ b/aur/tray_entry.py @@ -5,7 +5,7 @@ import sys desktop_file = """ [Desktop Entry] Type = Application -Name = fpakman +Name = fpakman (tray) Categories = System; Comment = Manage your Flatpak / Snap applications Exec = {path} --tray=1 From 629b0ac344c9d546d27a9ff5396b307fbaa72693 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 11:00:27 -0300 Subject: [PATCH 3/7] AUR: generate command link to the tray --- aur/panel_entry.py | 10 ++++++++-- aur/tray_entry.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/aur/panel_entry.py b/aur/panel_entry.py index 56493aa7..8f427e73 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -14,7 +14,13 @@ Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) -with open('fpakman.desktop', 'w+') as f: +fpakman_cmd = os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman') + +with open('fpakman_desktop.desktop', 'w+') as f: f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), version=py_version, - path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) + path=fpakman_cmd)) + + +with open('fpakman', 'w') as f: + f.write(fpakman_cmd) diff --git a/aur/tray_entry.py b/aur/tray_entry.py index 2035b1d7..9b1b3d77 100644 --- a/aur/tray_entry.py +++ b/aur/tray_entry.py @@ -8,13 +8,19 @@ Type = Application Name = fpakman (tray) Categories = System; Comment = Manage your Flatpak / Snap applications -Exec = {path} --tray=1 +Exec = {path} Icon = {lib_path}/python{version}/site-packages/fpakman/resources/img/logo.svg """ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) +fpakman_cmd = os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman') + ' --tray=1' + with open('fpakman_tray.desktop', 'w+') as f: f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), version=py_version, - path=os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman'))) + path=fpakman_cmd)) + + +with open('fpakman-tray', 'w') as f: + f.write(fpakman_cmd) From 3d7ebd1ec7918381a3cf43ee043fcd2b1adbb17b Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 11:05:09 -0300 Subject: [PATCH 4/7] AUR: entry fix --- aur/panel_entry.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/aur/panel_entry.py b/aur/panel_entry.py index 8f427e73..1c284daa 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -20,7 +20,3 @@ with open('fpakman_desktop.desktop', 'w+') as f: f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), version=py_version, path=fpakman_cmd)) - - -with open('fpakman', 'w') as f: - f.write(fpakman_cmd) From 7fb4c261418325fd387df252f74ec3764584864f Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 11:07:24 -0300 Subject: [PATCH 5/7] AUR: entry fix --- aur/panel_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aur/panel_entry.py b/aur/panel_entry.py index 1c284daa..e23602df 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -16,7 +16,7 @@ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) fpakman_cmd = os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman') -with open('fpakman_desktop.desktop', 'w+') as f: +with open('fpakman_desktop', 'w+') as f: f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), version=py_version, path=fpakman_cmd)) From b7d1314adf4e294a3192151b096b286a76813fe8 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 11:09:46 -0300 Subject: [PATCH 6/7] AUR: entry fix --- aur/panel_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aur/panel_entry.py b/aur/panel_entry.py index e23602df..20576729 100644 --- a/aur/panel_entry.py +++ b/aur/panel_entry.py @@ -16,7 +16,7 @@ py_version = "{}.{}".format(sys.version_info.major, sys.version_info.minor) fpakman_cmd = os.getenv('FPAKMAN_PATH', '/usr/bin/fpakman') -with open('fpakman_desktop', 'w+') as f: +with open('fpakman.desktop', 'w+') as f: f.write(desktop_file.format(lib_path=os.getenv('FPAKMAN_LIB_PATH', '/usr/lib'), version=py_version, path=fpakman_cmd)) From ccbd57df22273aecf0d71543c9d7ada49781ef59 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Fri, 9 Aug 2019 14:50:07 -0300 Subject: [PATCH 7/7] fix: not showing correctly the latest flatpak app versions when bringing the search results --- CHANGELOG.md | 3 ++- fpakman/core/flatpak/worker.py | 3 +++ fpakman/view/qt/apps_table.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e563f8c..bce5acf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - search response takes an average of 20% less time ( reaching 35% for several results ) - app boot takes 98% less time when snapd is installed, but disabled - FPAKMAN_TRAY (--tray) is not enabled by default (0). -### Fixes: +### Fixes +- not showing correctly the latest flatpak app versions when bringing the search results - [flatpak dependency](https://github.com/vinifmor/fpakman/issues/36) ## [0.5.0] - 2019-08-06 diff --git a/fpakman/core/flatpak/worker.py b/fpakman/core/flatpak/worker.py index 44bff278..c6d5e422 100644 --- a/fpakman/core/flatpak/worker.py +++ b/fpakman/core/flatpak/worker.py @@ -48,6 +48,9 @@ class FlatpakAsyncDataLoader(AsyncDataLoader): if not self.app.base_data.version and self.app.base_data.latest_version: self.app.base_data.version = self.app.base_data.latest_version + if not self.app.installed and self.app.base_data.latest_version: + self.app.base_data.version = self.app.base_data.latest_version + if self.app.base_data.icon_url and self.app.base_data.icon_url.startswith('/'): self.app.base_data.icon_url = FLATHUB_URL + self.app.base_data.icon_url diff --git a/fpakman/view/qt/apps_table.py b/fpakman/view/qt/apps_table.py index ca06ad80..b953626e 100644 --- a/fpakman/view/qt/apps_table.py +++ b/fpakman/view/qt/apps_table.py @@ -315,7 +315,7 @@ class AppsTable(QTableWidget): label_version.setStyleSheet("color: #4EC306; font-weight: bold") tooltip = self.window.locale_keys['version.installed_outdated'] - if app_v.model.base_data.version and app_v.model.base_data.latest_version and app_v.model.base_data.version < app_v.model.base_data.latest_version: + if app_v.model.installed and app_v.model.base_data.version and app_v.model.base_data.latest_version and app_v.model.base_data.version < app_v.model.base_data.latest_version: tooltip = '{}. {}: {}'.format(tooltip, self.window.locale_keys['version.latest'], app_v.model.base_data.latest_version) label_version.setText(label_version.text() + ' > {}'.format(app_v.model.base_data.latest_version))