aria download parameter fix | installation output log fix

This commit is contained in:
Vinicius Moreira
2019-09-23 13:26:50 -03:00
parent 5441d35ee2
commit dcb43d4f5a
4 changed files with 29 additions and 30 deletions

View File

@@ -35,8 +35,8 @@ class AdaptableFileDownloader(FileDownloader):
if output_path:
output_split = output_path.split('/')
cmd.append('-d=' + '/'.join(output_split[:-1]))
cmd.append('-o=' + output_split[-1])
cmd.append('--dir=' + '/'.join(output_split[:-1]))
cmd.append('--out=' + output_split[-1])
return SystemProcess(new_subprocess(cmd=cmd, cwd=cwd),
skip_stdout=True,

View File

@@ -231,10 +231,10 @@ class SearchPackages(AsyncAction):
self.word = None
class InstallApp(AsyncAction):
class InstallPackage(AsyncAction):
def __init__(self, manager: SoftwareManager, disk_cache: bool, icon_cache: MemoryCache, locale_keys: dict, pkg: PackageView = None):
super(InstallApp, self).__init__()
super(InstallPackage, self).__init__()
self.pkg = pkg
self.manager = manager
self.icon_cache = icon_cache
@@ -261,7 +261,7 @@ class InstallApp(AsyncAction):
success = False
self.print(self.locale_keys['internet.required'])
finally:
self.signal_finished.emit(self.pkg if success else None)
self.signal_finished.emit({'success': success, 'pkg': self.pkg})
self.pkg = None

View File

@@ -28,7 +28,7 @@ from bauh.view.qt.info import InfoDialog
from bauh.view.qt.root import is_root, ask_root_password
from bauh.view.qt.styles import StylesComboBox
from bauh.view.qt.thread import UpdateSelectedApps, RefreshApps, UninstallApp, DowngradeApp, GetAppInfo, \
GetAppHistory, SearchPackages, InstallApp, AnimateProgress, VerifyModels, FindSuggestions, ListWarnings, \
GetAppHistory, SearchPackages, InstallPackage, AnimateProgress, VerifyModels, FindSuggestions, ListWarnings, \
AsyncAction, LaunchApp, ApplyFilters, CustomAction
from bauh.view.qt.view_model import PackageView
from bauh.view.qt.view_utils import load_icon
@@ -219,7 +219,7 @@ class ManageWindow(QWidget):
self.thread_apply_filters.signal_table.connect(self._update_table_and_upgrades)
self.signal_table_update.connect(self.thread_apply_filters.stop_waiting)
self.thread_install = InstallApp(manager=self.manager, disk_cache=self.disk_cache, icon_cache=self.icon_cache, locale_keys=self.i18n)
self.thread_install = InstallPackage(manager=self.manager, disk_cache=self.disk_cache, icon_cache=self.icon_cache, locale_keys=self.i18n)
self._bind_async_action(self.thread_install, finished_call=self._finish_install)
self.thread_animate_progress = AnimateProgress()
@@ -868,31 +868,30 @@ class ManageWindow(QWidget):
self.thread_install.root_password = pwd
self.thread_install.start()
def _finish_install(self, pkgv: PackageView):
def _finish_install(self, res: dict):
self.input_search.setText('')
self.finish_action()
if pkgv:
console_output = self.textarea_output.toPlainText()
if console_output:
log_path = '/tmp/bauh/logs/install/{}/{}'.format(res['pkg'].model.get_type(), res['pkg'].model.name)
try:
Path(log_path).mkdir(parents=True, exist_ok=True)
with open(log_path + '/{}.log'.format(int(time.time())), 'w+') as f:
f.write(console_output)
except:
self.textarea_output.appendPlainText("[warning] Could not write install log file to '{}'".format(log_path))
if res['success']:
if self._can_notify_user():
util.notify_user(msg='{} ({}) {}'.format(pkgv.model.name, pkgv.model.get_type(), self.i18n['installed']))
util.notify_user(msg='{} ({}) {}'.format(res['pkg'].model.name, res['pkg'].model.get_type(), self.i18n['installed']))
console_output = self.textarea_output.toPlainText()
if console_output:
log_path = '/tmp/bauh/logs/install/{}/{}'.format(pkgv.model.get_type(), pkgv.model.name)
try:
Path(log_path).mkdir(parents=True, exist_ok=True)
with open(log_path + '/{}.log'.format(int(time.time())), 'w+') as f:
f.write(console_output)
except:
self.textarea_output.appendPlainText(
"[warning] Could not write install log file to '{}'".format(log_path))
self.refresh_apps(top_app=pkgv, pkg_types={pkgv.model.__class__})
self.refresh_apps(top_app=res['pkg'], pkg_types={res['pkg'].model.__class__})
else:
if self._can_notify_user():
util.notify_user('{}: {}'.format(pkgv.model.name, self.i18n['notification.install.failed']))
util.notify_user('{}: {}'.format(res['pkg'].model.name, self.i18n['notification.install.failed']))
self.checkbox_console.setChecked(True)