Add API endpoint to load a profile
If this needs tests please let me know
This commit is contained in:
parent
aa7b277927
commit
8c3390106a
@ -507,6 +507,23 @@ class AnkiConnect:
|
||||
return False
|
||||
|
||||
|
||||
@api()
|
||||
def loadProfile(self, name):
|
||||
if not self.window().isVisible():
|
||||
self.window().pm.load(name)
|
||||
self.window().loadProfile()
|
||||
self.window().profileDiag.closeWithoutQuitting()
|
||||
return "Loaded profile {}.".format(name)
|
||||
else:
|
||||
cur_profile = self.window().pm.name
|
||||
if cur_profile != name:
|
||||
self.window().unloadProfileAndShowProfileManager()
|
||||
self.loadProfile(name)
|
||||
return "Switched from profile {} to profile {}.".format(cur_profile, name)
|
||||
else:
|
||||
return "Profile {} already loaded.".format(name)
|
||||
|
||||
|
||||
@api()
|
||||
def sync(self):
|
||||
self.window().onSync()
|
||||
|
Loading…
Reference in New Issue
Block a user