Merge pull request #792 from nwwt/skip-addons-argument

Add command-line argument to skip addons
This commit is contained in:
Damien Elmes 2020-10-14 09:45:59 +10:00 committed by GitHub
commit 73f2042bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -51,7 +51,7 @@ Andrew Gaul <andrew@gaul.org>
kenden kenden
Nickolay Yudin <kelciour@gmail.com> Nickolay Yudin <kelciour@gmail.com>
neitrinoweb <github.com/neitrinoweb/> neitrinoweb <github.com/neitrinoweb/>
Andreas Reis <github.com/rathsky> Andreas Reis <github.com/nwwt>
Matt Krump <github.com/mkrump> Matt Krump <github.com/mkrump>
Alexander Presnyakov <flagist0@gmail.com> Alexander Presnyakov <flagist0@gmail.com>
abdo <github.com/abdnh> abdo <github.com/abdnh>

View File

@ -319,6 +319,9 @@ def parseArgs(argv):
parser.add_argument("-p", "--profile", help="profile name to load", default="") parser.add_argument("-p", "--profile", help="profile name to load", default="")
parser.add_argument("-l", "--lang", help="interface language (en, de, etc)") parser.add_argument("-l", "--lang", help="interface language (en, de, etc)")
parser.add_argument("-v", "--version", help="print the Anki version and exit") parser.add_argument("-v", "--version", help="print the Anki version and exit")
parser.add_argument(
"-s", "--safemode", help="disable addons and automatic syncing"
)
return parser.parse_known_args(argv[1:]) return parser.parse_known_args(argv[1:])

View File

@ -112,7 +112,9 @@ class AnkiQt(QMainWindow):
self.app = app self.app = app
self.pm = profileManager self.pm = profileManager
# init rest of app # init rest of app
self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier self.safeMode = (
self.app.queryKeyboardModifiers() & Qt.ShiftModifier
) or self.opts.safemode
try: try:
self.setupUI() self.setupUI()
self.setupAddons(args) self.setupAddons(args)