improvement: only changing the installed package status ( not refreshing the whole table ) | fix: flatpak downgrading error handling

This commit is contained in:
Vinicius Moreira
2019-09-24 15:17:09 -03:00
parent d3e5835a8b
commit 2a84ff4c32
15 changed files with 104 additions and 54 deletions

View File

@@ -34,6 +34,22 @@ def get_app_info_fields(app_id: str, branch: str, fields: List[str] = [], check_
return data
def get_fields(app_id: str, branch: str, fields: List[str]) -> List[str]:
cmd = [BASE_CMD, 'info', app_id]
if branch:
cmd.append(branch)
info = new_subprocess(cmd).stdout
res = []
for o in new_subprocess(['grep', '-E', '({}):.+'.format('|'.join(fields)), '-o'], stdin=info).stdout:
if o:
res.append(o.decode().split(':')[-1].strip())
return res
def is_installed():
version = get_version()
return False if version is None else True
@@ -282,5 +298,3 @@ def has_remotes_set() -> bool:
def run(app_id: str):
subprocess.Popen([BASE_CMD, 'run', app_id])