From 7ec62618fa50fb7fd1493e0dd45a4d0d4ebe1038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Mon, 24 Jun 2019 13:05:03 -0300 Subject: [PATCH] 0.2.1 Features - Showing the number of apps and runtime updates available Fixes - Retrieving information for the same AppId from different branches. --- CHANGELOG.md | 6 ++++++ fpakman/__init__.py | 2 +- fpakman/core/flatpak.py | 6 +++--- fpakman/view/qt/window.py | 16 ++++++++++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9681db..affcdc85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +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.2.1] - 2019-06-24 +### Features +- Showing the number of apps and runtime updates available +### Fixes +- Retrieving information for the same AppId from different branches. + ## [0.2.0] - 2019-06-18 ### Features - Management panel shows update commands streams diff --git a/fpakman/__init__.py b/fpakman/__init__.py index 7fd229a3..fc79d63d 100644 --- a/fpakman/__init__.py +++ b/fpakman/__init__.py @@ -1 +1 @@ -__version__ = '0.2.0' +__version__ = '0.2.1' diff --git a/fpakman/core/flatpak.py b/fpakman/core/flatpak.py index fa9ca0bf..82ea400d 100755 --- a/fpakman/core/flatpak.py +++ b/fpakman/core/flatpak.py @@ -32,7 +32,7 @@ def app_str_to_json(line: str, version: str) -> dict: else: raise Exception('Unsupported version') - info = re.findall('\w+:\s.+', get_app_info(app['id'])) + info = re.findall(r'\w+:\s.+', get_app_info(app['id'], app['branch'])) fields_to_get = ['origin', 'arch', 'ref'] for field in info: @@ -53,8 +53,8 @@ def get_version(): return res.split(' ')[1].strip() if res else None -def get_app_info(app_id: str): - return system.run_cmd('flatpak info ' + app_id) +def get_app_info(app_id: str, branch: str): + return system.run_cmd('flatpak info {} {}'.format(app_id, branch)) def list_installed() -> List[dict]: diff --git a/fpakman/view/qt/window.py b/fpakman/view/qt/window.py index 978a2ed8..ab5bb616 100755 --- a/fpakman/view/qt/window.py +++ b/fpakman/view/qt/window.py @@ -248,10 +248,18 @@ class ManageWindow(QWidget): enable_bt_update = False - updates = len([app for app in self.apps if app['model']['update']]) + app_updates, runtime_updates = 0, 0 - if updates > 0: - self.label_updates.setText('{}: {}'.format(self.locale_keys['manage_window.label.updates'], updates)) + for app in self.apps: + if app['model']['update']: + if app['model']['runtime']: + runtime_updates += 1 + else: + app_updates += 1 + + total_updates = app_updates + runtime_updates + if total_updates > 0: + self.label_updates.setText('{}: {} ( {} apps | {} runtimes )'.format(self.locale_keys['manage_window.label.updates'], total_updates, app_updates, runtime_updates)) else: self.label_updates.setText('') @@ -262,7 +270,7 @@ class ManageWindow(QWidget): self.bt_update.setEnabled(enable_bt_update) - self.tray_icon.notify_updates(updates) + self.tray_icon.notify_updates(total_updates) def centralize(self): geo = self.frameGeometry()