mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -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,7 +26,8 @@ class AddonManager(object):
|
|||
if isWin:
|
||||
self.clearAddonCache()
|
||||
sys.path.insert(0, self.addonsFolder())
|
||||
self.loadAddons()
|
||||
if not self.mw.safeMode:
|
||||
self.loadAddons()
|
||||
|
||||
def files(self):
|
||||
return [f for f in os.listdir(self.addonsFolder())
|
||||
|
|
|
@ -37,12 +37,17 @@ class AnkiQt(QMainWindow):
|
|||
self.pm.meta['firstRun'] = False
|
||||
self.pm.save()
|
||||
# init rest of app
|
||||
self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier
|
||||
try:
|
||||
self.setupUI()
|
||||
self.setupAddons()
|
||||
except:
|
||||
showInfo(_("Error during startup:\n%s") % traceback.format_exc())
|
||||
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?
|
||||
if args and args[0]:
|
||||
self.onAppMsg(unicode(args[0], "utf8", "ignore"))
|
||||
|
@ -536,7 +541,8 @@ title="%s">%s</button>''' % (
|
|||
|
||||
def onSync(self, auto=False, reload=True):
|
||||
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
|
||||
if not self.unloadCollection():
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue