[appimage] improvement -> manual file installation default search path set to '~/Downloads'

This commit is contained in:
Vinicius Moreira
2020-08-11 13:38:35 -03:00
parent 4f05cb985d
commit 4de2eb317e
4 changed files with 12 additions and 2 deletions

View File

@@ -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):

View File

@@ -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())

View File

@@ -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())