arch: improving error messages

This commit is contained in:
Vinicius Moreira
2019-09-20 19:44:12 -03:00
parent 0d2770296c
commit 0085f40cdf
3 changed files with 7 additions and 6 deletions

View File

@@ -1,20 +1,21 @@
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abstract.view import MessageType
from bauh.commons.html import bold
def show_dep_not_installed(watcher: ProcessWatcher, pkgname: str, depname: str, i18n: dict):
watcher.show_message(title=i18n['error'],
body=i18n['arch.install.dependency.install.error'].format('"{}"'.format(depname), '"{}"'.format(pkgname)),
body=i18n['arch.install.dependency.install.error'].format(bold(depname), bold(pkgname)),
type_=MessageType.ERROR)
def show_dep_not_found(depname: str, i18n: dict, watcher: ProcessWatcher):
watcher.show_message(title=i18n['arch.install.dep_not_found.title'],
body=i18n['arch.install.dep_not_found.body'].format('"{}"'.format(depname)),
body=i18n['arch.install.dep_not_found.body'].format(bold(depname)),
type_=MessageType.ERROR)
def show_optdep_not_installed(depname: str, watcher: ProcessWatcher, i18n: dict):
watcher.show_message(title=i18n['error'],
body=i18n['arch.install.optdep.error'].format('"{}"'.format(depname)),
body=i18n['arch.install.optdep.error'].format(bold(depname)),
type_=MessageType.ERROR)