diff --git a/CHANGELOG.md b/CHANGELOG.md index f78ac834..84c6a2fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.7] 2020 ### Improvements +- AppImage + - Manual file installation default search path set to '~/Downloads' - Arch - upgrade summary: displaying the reason a given package must be installed

diff --git a/bauh/api/abstract/view.py b/bauh/api/abstract/view.py index 3e3a7369..7995add7 100644 --- a/bauh/api/abstract/view.py +++ b/bauh/api/abstract/view.py @@ -182,13 +182,14 @@ class FormComponent(ViewComponent): class FileChooserComponent(ViewComponent): def __init__(self, allowed_extensions: Set[str] = None, label: str = None, tooltip: str = None, - file_path: str = None, max_width: int = -1, id_: str = None): + file_path: str = None, max_width: int = -1, id_: str = None, search_path: str = None): super(FileChooserComponent, self).__init__(id_=id_) self.label = label self.allowed_extensions = allowed_extensions self.file_path = file_path self.tooltip = tooltip self.max_width = max_width + self.search_path = search_path class TabComponent(ViewComponent): diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index 18bac25d..b787814d 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -69,7 +69,12 @@ class AppImageManager(SoftwareManager): icon_path=resource.get_path('img/upgrade.svg', ROOT_DIR))] def install_file(self, root_password: str, watcher: ProcessWatcher) -> bool: - file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(), allowed_extensions={'AppImage'}) + default_path = '{}/Downloads'.format(str(Path.home())) + + if not os.path.isdir(default_path): + default_path = None + + file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(), allowed_extensions={'AppImage'}, search_path=default_path) input_name = TextInputComponent(label=self.i18n['name'].capitalize()) input_version = TextInputComponent(label=self.i18n['version'].capitalize()) input_description = TextInputComponent(label=self.i18n['description'].capitalize()) diff --git a/bauh/view/qt/components.py b/bauh/view/qt/components.py index 16f1e159..4501953b 100644 --- a/bauh/view/qt/components.py +++ b/bauh/view/qt/components.py @@ -840,6 +840,8 @@ class FormQt(QGroupBox): if c.file_path and os.path.isfile(c.file_path): cur_path = c.file_path + elif c.search_path and os.path.exists(c.search_path): + cur_path = c.search_path else: cur_path = str(Path.home())