Update AnkiConnect.py
This commit is contained in:
parent
8c3390106a
commit
0fe61050c9
@ -509,19 +509,18 @@ class AnkiConnect:
|
|||||||
|
|
||||||
@api()
|
@api()
|
||||||
def loadProfile(self, name):
|
def loadProfile(self, name):
|
||||||
|
if name not in self.window().pm.profiles():
|
||||||
|
return False
|
||||||
if not self.window().isVisible():
|
if not self.window().isVisible():
|
||||||
self.window().pm.load(name)
|
self.window().pm.load(name)
|
||||||
self.window().loadProfile()
|
self.window().loadProfile()
|
||||||
self.window().profileDiag.closeWithoutQuitting()
|
self.window().profileDiag.closeWithoutQuitting()
|
||||||
return "Loaded profile {}.".format(name)
|
|
||||||
else:
|
else:
|
||||||
cur_profile = self.window().pm.name
|
cur_profile = self.window().pm.name
|
||||||
if cur_profile != name:
|
if cur_profile != name:
|
||||||
self.window().unloadProfileAndShowProfileManager()
|
self.window().unloadProfileAndShowProfileManager()
|
||||||
self.loadProfile(name)
|
self.loadProfile(name)
|
||||||
return "Switched from profile {} to profile {}.".format(cur_profile, name)
|
return True
|
||||||
else:
|
|
||||||
return "Profile {} already loaded.".format(name)
|
|
||||||
|
|
||||||
|
|
||||||
@api()
|
@api()
|
||||||
|
Loading…
Reference in New Issue
Block a user