From da2ddcc6e2c18cc2b1b6da3318248e77fd95a510 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 4 Mar 2019 11:58:34 +1000 Subject: [PATCH] explicitly import _ and ngettext --- aqt/about.py | 1 + aqt/addons.py | 2 +- aqt/browser.py | 1 + aqt/clayout.py | 2 +- aqt/customstudy.py | 1 + aqt/deckbrowser.py | 1 + aqt/deckchooser.py | 1 + aqt/deckconf.py | 2 +- aqt/downloader.py | 1 + aqt/dyndeckconf.py | 1 + aqt/editcurrent.py | 2 +- aqt/exporting.py | 2 +- aqt/fields.py | 1 + aqt/importing.py | 3 +-- aqt/main.py | 1 + aqt/modelchooser.py | 1 + aqt/models.py | 1 + aqt/overview.py | 1 + aqt/preferences.py | 1 + aqt/profiles.py | 1 + aqt/progress.py | 1 + aqt/sound.py | 1 + aqt/stats.py | 1 + aqt/studydeck.py | 1 + aqt/sync.py | 2 +- aqt/toolbar.py | 1 + aqt/update.py | 1 + aqt/utils.py | 1 + aqt/webview.py | 1 + 29 files changed, 29 insertions(+), 8 deletions(-) diff --git a/aqt/about.py b/aqt/about.py index b86293909..6d131a41e 100644 --- a/aqt/about.py +++ b/aqt/about.py @@ -6,6 +6,7 @@ from aqt.qt import * import aqt.forms from anki.utils import versionWithBuild from aqt.utils import supportText, tooltip +from anki.lang import _ class ClosableQDialog(QDialog): def reject(self): diff --git a/aqt/addons.py b/aqt/addons.py index 4020b35b7..22c0f1435 100644 --- a/aqt/addons.py +++ b/aqt/addons.py @@ -17,7 +17,7 @@ from zipfile import ZipFile import aqt.forms import aqt from aqt.downloader import download -from anki.lang import _ +from anki.lang import _, ngettext from anki.utils import intTime from anki.sync import AnkiRequestsClient diff --git a/aqt/browser.py b/aqt/browser.py index e38de1007..840aa7f6a 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -21,6 +21,7 @@ from aqt.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter, \ saveHeader, restoreHeader, saveState, restoreState, getTag, \ showInfo, askUser, tooltip, openHelp, showWarning, shortcut, mungeQA, \ getOnlyText, MenuList, SubMenu, qtMenuShortcutWorkaround +from anki.lang import _ from anki.hooks import runHook, addHook, remHook, runFilter from aqt.webview import AnkiWebView from anki.consts import * diff --git a/aqt/clayout.py b/aqt/clayout.py index 207537ee8..e9ea807cf 100644 --- a/aqt/clayout.py +++ b/aqt/clayout.py @@ -16,7 +16,7 @@ from anki.utils import isMac, isWin, joinFields, bodyClass from aqt.webview import AnkiWebView import json from anki.hooks import runFilter - +from anki.lang import _, ngettext class CardLayout(QDialog): diff --git a/aqt/customstudy.py b/aqt/customstudy.py index df57dfdf7..e725988f0 100644 --- a/aqt/customstudy.py +++ b/aqt/customstudy.py @@ -6,6 +6,7 @@ from aqt.qt import * import aqt from aqt.utils import showInfo, showWarning from anki.consts import * +from anki.lang import _ RADIO_NEW = 1 RADIO_REV = 2 diff --git a/aqt/deckbrowser.py b/aqt/deckbrowser.py index c2d76ecc6..01bce24d0 100644 --- a/aqt/deckbrowser.py +++ b/aqt/deckbrowser.py @@ -11,6 +11,7 @@ import aqt from anki.sound import clearAudioQueue from anki.hooks import runHook from copy import deepcopy +from anki.lang import _, ngettext class DeckBrowser: diff --git a/aqt/deckchooser.py b/aqt/deckchooser.py index a7fb09462..2bd617343 100644 --- a/aqt/deckchooser.py +++ b/aqt/deckchooser.py @@ -5,6 +5,7 @@ from aqt.qt import * from anki.hooks import addHook, remHook from aqt.utils import shortcut +from anki.lang import _ class DeckChooser(QHBoxLayout): diff --git a/aqt/deckconf.py b/aqt/deckconf.py index 0c834d2a8..a21c8392d 100644 --- a/aqt/deckconf.py +++ b/aqt/deckconf.py @@ -8,7 +8,7 @@ from aqt.qt import * import aqt from aqt.utils import showInfo, showWarning, openHelp, getOnlyText, askUser, \ tooltip, saveGeom, restoreGeom, downArrow - +from anki.lang import _, ngettext class DeckConf(QDialog): def __init__(self, mw, deck): diff --git a/aqt/downloader.py b/aqt/downloader.py index db3dc9d32..7524674c5 100644 --- a/aqt/downloader.py +++ b/aqt/downloader.py @@ -8,6 +8,7 @@ from anki.sync import AnkiRequestsClient from aqt.utils import showWarning from anki.hooks import addHook, remHook import aqt +from anki.lang import _ def download(mw, code): "Download addon from AnkiWeb. Caller must start & stop progress diag." diff --git a/aqt/dyndeckconf.py b/aqt/dyndeckconf.py index e968e87cd..36abeb2c2 100644 --- a/aqt/dyndeckconf.py +++ b/aqt/dyndeckconf.py @@ -5,6 +5,7 @@ from aqt.qt import * import aqt from aqt.utils import showWarning, openHelp, askUser, saveGeom, restoreGeom +from anki.lang import _ class DeckConf(QDialog): def __init__(self, mw, first=False, search="", deck=None): diff --git a/aqt/editcurrent.py b/aqt/editcurrent.py index 87be380ba..c0418222a 100644 --- a/aqt/editcurrent.py +++ b/aqt/editcurrent.py @@ -8,7 +8,7 @@ import aqt.editor from aqt.utils import saveGeom, restoreGeom from anki.hooks import addHook, remHook from anki.utils import isMac - +from anki.lang import _ class EditCurrent(QDialog): diff --git a/aqt/exporting.py b/aqt/exporting.py index 3ca650b7b..f89dad174 100644 --- a/aqt/exporting.py +++ b/aqt/exporting.py @@ -10,7 +10,7 @@ from aqt.utils import getSaveFile, tooltip, showWarning, askUser, \ checkInvalidFilename, showInfo from anki.exporting import exporters from anki.hooks import addHook, remHook -from anki.lang import ngettext +from anki.lang import ngettext, _ import time class ExportDialog(QDialog): diff --git a/aqt/fields.py b/aqt/fields.py index 2d043ead7..55362d9fa 100644 --- a/aqt/fields.py +++ b/aqt/fields.py @@ -5,6 +5,7 @@ from aqt.qt import * from anki.consts import * import aqt from aqt.utils import showWarning, openHelp, getOnlyText, askUser +from anki.lang import _, ngettext class FieldDialog(QDialog): diff --git a/aqt/importing.py b/aqt/importing.py index 57040cdaa..23b396a08 100644 --- a/aqt/importing.py +++ b/aqt/importing.py @@ -18,8 +18,7 @@ from anki.hooks import addHook, remHook import aqt.forms import aqt.modelchooser import aqt.deckchooser -from anki.lang import ngettext - +from anki.lang import ngettext, _ class ChangeMap(QDialog): def __init__(self, mw, model, current): diff --git a/aqt/main.py b/aqt/main.py index 83e56c27b..3580179ab 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -30,6 +30,7 @@ from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \ restoreState, getOnlyText, askUser, showText, tooltip, \ openHelp, openLink, checkInvalidFilename, getFile from aqt.qt import sip +from anki.lang import _, ngettext class AnkiQt(QMainWindow): def __init__(self, app, profileManager, opts, args): diff --git a/aqt/modelchooser.py b/aqt/modelchooser.py index 491b69094..2eb0d09b7 100644 --- a/aqt/modelchooser.py +++ b/aqt/modelchooser.py @@ -6,6 +6,7 @@ from aqt.qt import * from anki.hooks import addHook, remHook, runHook from aqt.utils import shortcut import aqt +from anki.lang import _ class ModelChooser(QHBoxLayout): diff --git a/aqt/models.py b/aqt/models.py index 39a058153..0ccfe0486 100644 --- a/aqt/models.py +++ b/aqt/models.py @@ -8,6 +8,7 @@ import aqt.clayout from anki import stdmodels from aqt.utils import saveGeom, restoreGeom import collections +from anki.lang import _, ngettext class Models(QDialog): def __init__(self, mw, parent=None, fromMain=False): diff --git a/aqt/overview.py b/aqt/overview.py index 11dca83f7..e4fe3e8b0 100644 --- a/aqt/overview.py +++ b/aqt/overview.py @@ -6,6 +6,7 @@ from aqt.utils import openLink, shortcut, tooltip, askUserDialog from anki.utils import isMac import aqt from anki.sound import clearAudioQueue +from anki.lang import _ class Overview: "Deck overview." diff --git a/aqt/preferences.py b/aqt/preferences.py index 9949a771e..29d9b195b 100644 --- a/aqt/preferences.py +++ b/aqt/preferences.py @@ -8,6 +8,7 @@ import anki.lang from aqt.utils import openFolder, showWarning, getText, openHelp, showInfo, \ askUser import aqt +from anki.lang import _ class Preferences(QDialog): diff --git a/aqt/profiles.py b/aqt/profiles.py index 492e64b84..6d70d252f 100644 --- a/aqt/profiles.py +++ b/aqt/profiles.py @@ -23,6 +23,7 @@ from aqt import appHelpSite import aqt.forms from send2trash import send2trash import anki.sound +from anki.lang import _ metaConf = dict( ver=0, diff --git a/aqt/progress.py b/aqt/progress.py index 7c5b46410..a053c48aa 100644 --- a/aqt/progress.py +++ b/aqt/progress.py @@ -5,6 +5,7 @@ import time from aqt.qt import * import aqt.forms +from anki.lang import _ # fixme: if mw->subwindow opens a progress dialog with mw as the parent, mw # gets raised on finish on compiz. perhaps we should be using the progress diff --git a/aqt/sound.py b/aqt/sound.py index bef2d4c4c..214ce52e3 100644 --- a/aqt/sound.py +++ b/aqt/sound.py @@ -6,6 +6,7 @@ from aqt.qt import * import time from anki.sound import Recorder from aqt.utils import saveGeom, restoreGeom, showWarning +from anki.lang import _ if not Recorder: print("pyaudio not installed") diff --git a/aqt/stats.py b/aqt/stats.py index c71a2c997..cc1cab21f 100644 --- a/aqt/stats.py +++ b/aqt/stats.py @@ -7,6 +7,7 @@ import os, time from aqt.utils import saveGeom, restoreGeom, maybeHideClose, addCloseShortcut, \ tooltip, getSaveFile import aqt +from anki.lang import _ # Deck Stats ###################################################################### diff --git a/aqt/studydeck.py b/aqt/studydeck.py index 658013fba..489a38f46 100644 --- a/aqt/studydeck.py +++ b/aqt/studydeck.py @@ -6,6 +6,7 @@ from aqt.qt import * import aqt from aqt.utils import showInfo, openHelp, getOnlyText, shortcut, restoreGeom, saveGeom from anki.hooks import addHook, remHook +from anki.lang import _ class StudyDeck(QDialog): def __init__(self, mw, names=None, accept=None, title=None, diff --git a/aqt/sync.py b/aqt/sync.py index 17e76a0ca..5299bb13a 100644 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -12,7 +12,7 @@ from anki.sync import Syncer, RemoteServer, FullSyncer, MediaSyncer, \ RemoteMediaServer from anki.hooks import addHook, remHook from aqt.utils import tooltip, askUserDialog, showWarning, showText, showInfo - +from anki.lang import _ # Sync manager ###################################################################### diff --git a/aqt/toolbar.py b/aqt/toolbar.py index baab74614..f935fc8ca 100644 --- a/aqt/toolbar.py +++ b/aqt/toolbar.py @@ -3,6 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from aqt.qt import * +from anki.lang import _ class Toolbar: diff --git a/aqt/update.py b/aqt/update.py index 37b525235..68f7057f3 100644 --- a/aqt/update.py +++ b/aqt/update.py @@ -9,6 +9,7 @@ from aqt.qt import * import aqt from aqt.utils import openLink, showText from anki.utils import platDesc, versionWithBuild +from anki.lang import _ class LatestVersionFinder(QThread): diff --git a/aqt/utils.py b/aqt/utils.py index c1c508249..955c10cd9 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -8,6 +8,7 @@ import aqt from anki.sound import stripSounds from anki.utils import isWin, isMac, invalidFilename, noBundledLibs, \ versionWithBuild +from anki.lang import _ def openHelp(section): link = aqt.appHelpSite diff --git a/aqt/webview.py b/aqt/webview.py index 093e74915..815ba5caa 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -8,6 +8,7 @@ from anki.hooks import runHook from aqt.qt import * from aqt.utils import openLink, showWarning, tooltip from anki.utils import isMac, isWin, isLin, devMode +from anki.lang import _ # Page for debug messages ##########################################################################