mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
add a 'safe mode' (#797)
This commit is contained in:
parent
a492e95aed
commit
205c6d4c38
2 changed files with 9 additions and 2 deletions
|
@ -26,6 +26,7 @@ class AddonManager(object):
|
||||||
if isWin:
|
if isWin:
|
||||||
self.clearAddonCache()
|
self.clearAddonCache()
|
||||||
sys.path.insert(0, self.addonsFolder())
|
sys.path.insert(0, self.addonsFolder())
|
||||||
|
if not self.mw.safeMode:
|
||||||
self.loadAddons()
|
self.loadAddons()
|
||||||
|
|
||||||
def files(self):
|
def files(self):
|
||||||
|
|
|
@ -37,12 +37,17 @@ class AnkiQt(QMainWindow):
|
||||||
self.pm.meta['firstRun'] = False
|
self.pm.meta['firstRun'] = False
|
||||||
self.pm.save()
|
self.pm.save()
|
||||||
# init rest of app
|
# init rest of app
|
||||||
|
self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier
|
||||||
try:
|
try:
|
||||||
self.setupUI()
|
self.setupUI()
|
||||||
self.setupAddons()
|
self.setupAddons()
|
||||||
except:
|
except:
|
||||||
showInfo(_("Error during startup:\n%s") % traceback.format_exc())
|
showInfo(_("Error during startup:\n%s") % traceback.format_exc())
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
# must call this after ui set up
|
||||||
|
if self.safeMode:
|
||||||
|
tooltip(_("Shift key was held down. Skipping automatic "
|
||||||
|
"syncing and add-on loading."))
|
||||||
# were we given a file to import?
|
# were we given a file to import?
|
||||||
if args and args[0]:
|
if args and args[0]:
|
||||||
self.onAppMsg(unicode(args[0], "utf8", "ignore"))
|
self.onAppMsg(unicode(args[0], "utf8", "ignore"))
|
||||||
|
@ -536,7 +541,8 @@ title="%s">%s</button>''' % (
|
||||||
|
|
||||||
def onSync(self, auto=False, reload=True):
|
def onSync(self, auto=False, reload=True):
|
||||||
if not auto or (self.pm.profile['syncKey'] and
|
if not auto or (self.pm.profile['syncKey'] and
|
||||||
self.pm.profile['autoSync']):
|
self.pm.profile['autoSync'] and
|
||||||
|
not self.safeMode):
|
||||||
from aqt.sync import SyncManager
|
from aqt.sync import SyncManager
|
||||||
if not self.unloadCollection():
|
if not self.unloadCollection():
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue