From 4a26381c0425667125bbf6797121c0709ba98299 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 13 Jan 2020 15:47:33 -0300 Subject: [PATCH] [flatpak] new model update for Flatpak 1.4.X --- CHANGELOG.md | 2 +- bauh/gems/flatpak/controller.py | 2 +- bauh/gems/flatpak/flatpak.py | 12 ++++++++---- bauh/view/qt/window.py | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 753681eb..7bc72d93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Flatpak: - allow the user to choose the application installation level: **user** or **system** - able to deal with user and system applications / runtimes - - able to handle partial updates for Flatpak >= 1.5 + - able to list partial updates for Flatpak >= 1.4 - new configuration file located at **~/.config/bauh/flatpak.yml** ( it allows to define a default installation level ) ### Improvements diff --git a/bauh/gems/flatpak/controller.py b/bauh/gems/flatpak/controller.py index 26a97ba3..5d59ba41 100644 --- a/bauh/gems/flatpak/controller.py +++ b/bauh/gems/flatpak/controller.py @@ -130,7 +130,7 @@ class FlatpakManager(SoftwareManager): models.append(model) if update_map and (update_map['full'] or update_map['partial']): - if version >= '1.5.0': + if version >= '1.4.0': update_id = '{}/{}/{}'.format(app_json['id'], app_json['branch'], app_json['installation']) if update_map['full'] and update_id in update_map['full']: diff --git a/bauh/gems/flatpak/flatpak.py b/bauh/gems/flatpak/flatpak.py index cbd0251f..5bf8cc37 100755 --- a/bauh/gems/flatpak/flatpak.py +++ b/bauh/gems/flatpak/flatpak.py @@ -194,17 +194,21 @@ def read_updates(version: str, installation: str) -> Dict[str, set]: else: updates = new_subprocess([BASE_CMD, 'update', '--{}'.format(installation)]).stdout - reg = r'[0-9]+\.\s+.+' if version >= '1.5.0' else r'[0-9]+\.\s+(\w+|\.)+\s+\w+\s+(\w|\.)+' + reg = r'[0-9]+\.\s+.+' try: for o in new_subprocess(['grep', '-E', reg, '-o', '--color=never'], stdin=updates).stdout: if o: line_split = o.decode().strip().split('\t') - update_id = '{}/{}/{}'.format(line_split[2], line_split[3], installation) - if len(line_split) == 7: + if version >= '1.5.0': + update_id = '{}/{}/{}'.format(line_split[2], line_split[3], installation) + else: + update_id = '{}/{}/{}'.format(line_split[2], line_split[4], installation) + + if len(line_split) >= 6: if line_split[4] != 'i': - if '(partial)' in line_split[6]: + if '(partial)' in line_split[-1]: res['partial'].add(update_id) else: res['full'].add(update_id) diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index bc64b648..32ebc393 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -846,8 +846,8 @@ class ManageWindow(QWidget): new_width = max(table_width, toolbar_width, topbar_width) - # if self.bt_upgrade.isVisible(): - # new_width *= 1.03 # this extra size is not because of the toolbar button, but the table upgrade buttons + if self.bt_upgrade.isVisible(): + new_width *= 1.05 # this extra size is not because of the toolbar button, but the table upgrade buttons if (self.pkgs and accept_lower_width) or new_width > self.width(): self.resize(new_width, self.height())