From 392938f20c3bf835b21569373aad1fb0b0429853 Mon Sep 17 00:00:00 2001 From: Glutanimate Date: Sat, 4 Jan 2020 01:30:20 +0100 Subject: [PATCH] Adjust type annotations, format string, and remove tooltip on cancel Other areas of Anki don't confirm cancelling actions with tooltips, so after further consideration, the tooltip felt out of the place and might have actually confused users into thinking some action was being performed. --- qt/aqt/addons.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qt/aqt/addons.py b/qt/aqt/addons.py index 29093ff90..1bac9266b 100644 --- a/qt/aqt/addons.py +++ b/qt/aqt/addons.py @@ -666,7 +666,7 @@ class AddonsDialog(QDialog): def onGetAddons(self): GetAddons(self) - def onInstallFiles(self, paths: List[str] = None, external: bool = False): + def onInstallFiles(self, paths: Optional[List[str]] = None, external: bool = False): if not paths: key = _("Packaged Anki Add-on") + " (*{})".format(self.mgr.ext) paths = getFile( @@ -864,14 +864,14 @@ def installAddonPackages( ) -> bool: if external: - names_str = ",
".join(f"{os.path.basename(p)}" for p in paths) + names = ",
".join(f"{os.path.basename(p)}" for p in paths) q = _( "Important: As add-ons are programs downloaded from the internet, " "they are potentially malicious." "You should only install add-ons you trust.

" "Are you sure you want to proceed with the installation of the " - f"following add-on(s)?

{names_str}" - ) + "following add-on(s)?

%(names)s" + ) % dict(names=names) if ( not showInfo( q, @@ -882,7 +882,6 @@ def installAddonPackages( ) == QMessageBox.Yes ): - tooltip(_("Add-on installation aborted"), parent=parent) return False log, errs = addonsManager.processPackages(paths, parent=parent)