Further tweak messaging depending on Anki's state at installation time

This commit is contained in:
Glutanimate 2020-01-04 04:45:43 +01:00
parent 6a7f11b172
commit 7348e9c69e
2 changed files with 12 additions and 4 deletions

View File

@ -861,7 +861,8 @@ def installAddonPackages(
paths: List[str],
parent: Optional[QWidget] = None,
warn: bool = False,
strictly_modal: bool = False
strictly_modal: bool = False,
advise_restart: bool = False,
) -> bool:
if warn:
@ -889,6 +890,10 @@ def installAddonPackages(
if log:
log_html = "<br>".join(log)
if advise_restart:
log_html += "<br><br>" + _(
"<b>Please restart Anki to complete the installation.</b>"
)
if len(log) == 1 and not strictly_modal:
tooltip(log_html, parent=parent)
else:

View File

@ -1035,10 +1035,13 @@ QTreeWidget {
def installAddon(self, path: str, startup: bool = False):
from aqt.addons import installAddonPackages
parent = None if startup else self
installAddonPackages(
self.addonManager, [path], warn=True, strictly_modal=startup, parent=parent
self.addonManager,
[path],
warn=True,
advise_restart=not startup,
strictly_modal=startup,
parent=None if startup else self,
)
# Cramming