cleanup
This commit is contained in:
parent
d3627e3060
commit
0efa203095
@ -117,7 +117,6 @@ def verifyStringList(strings):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# AjaxRequest
|
# AjaxRequest
|
||||||
#
|
#
|
||||||
@ -338,6 +337,7 @@ class AnkiNoteParams:
|
|||||||
type(self.tags) == list and verifyStringList(self.tags)
|
type(self.tags) == list and verifyStringList(self.tags)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'DeckName: ' + self.deckName + '. ModelName: ' + self.modelName + '. Fields: ' + str(self.fields) + '. Tags: ' + str(self.tags) + '.'
|
return 'DeckName: ' + self.deckName + '. ModelName: ' + self.modelName + '. Fields: ' + str(self.fields) + '. Tags: ' + str(self.tags) + '.'
|
||||||
|
|
||||||
@ -437,6 +437,7 @@ class AnkiBridge:
|
|||||||
elif duplicateOrEmpty == False:
|
elif duplicateOrEmpty == False:
|
||||||
return note
|
return note
|
||||||
|
|
||||||
|
|
||||||
def updateNoteFields(self, params):
|
def updateNoteFields(self, params):
|
||||||
collection = self.collection()
|
collection = self.collection()
|
||||||
if collection is None:
|
if collection is None:
|
||||||
@ -450,6 +451,7 @@ class AnkiBridge:
|
|||||||
note[name] = value
|
note[name] = value
|
||||||
note.flush()
|
note.flush()
|
||||||
|
|
||||||
|
|
||||||
def addTags(self, notes, tags, add=True):
|
def addTags(self, notes, tags, add=True):
|
||||||
self.startEditing()
|
self.startEditing()
|
||||||
self.collection().tags.bulkAdd(notes, tags, add)
|
self.collection().tags.bulkAdd(notes, tags, add)
|
||||||
@ -479,6 +481,7 @@ class AnkiBridge:
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def isSuspended(self, card):
|
def isSuspended(self, card):
|
||||||
card = self.collection().getCard(card)
|
card = self.collection().getCard(card)
|
||||||
if card.queue == -1:
|
if card.queue == -1:
|
||||||
@ -486,6 +489,7 @@ class AnkiBridge:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def areSuspended(self, cards):
|
def areSuspended(self, cards):
|
||||||
suspended = []
|
suspended = []
|
||||||
for card in cards:
|
for card in cards:
|
||||||
@ -725,6 +729,7 @@ class AnkiBridge:
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def cardsInfo(self,cards):
|
def cardsInfo(self,cards):
|
||||||
result = []
|
result = []
|
||||||
for cid in cards:
|
for cid in cards:
|
||||||
@ -762,6 +767,7 @@ class AnkiBridge:
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def notesInfo(self,notes):
|
def notesInfo(self,notes):
|
||||||
result = []
|
result = []
|
||||||
for nid in notes:
|
for nid in notes:
|
||||||
@ -813,6 +819,7 @@ class AnkiBridge:
|
|||||||
|
|
||||||
return deckId
|
return deckId
|
||||||
|
|
||||||
|
|
||||||
def changeDeck(self, cards, deck):
|
def changeDeck(self, cards, deck):
|
||||||
self.startEditing()
|
self.startEditing()
|
||||||
|
|
||||||
@ -906,6 +913,7 @@ class AnkiBridge:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def guiShowQuestion(self):
|
def guiShowQuestion(self):
|
||||||
if self.guiReviewActive():
|
if self.guiReviewActive():
|
||||||
self.reviewer()._showQuestion()
|
self.reviewer()._showQuestion()
|
||||||
@ -959,6 +967,7 @@ class AnkiBridge:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def guiExitAnki(self):
|
def guiExitAnki(self):
|
||||||
timer = QTimer()
|
timer = QTimer()
|
||||||
def exitAnki():
|
def exitAnki():
|
||||||
@ -967,9 +976,11 @@ class AnkiBridge:
|
|||||||
timer.timeout.connect(exitAnki)
|
timer.timeout.connect(exitAnki)
|
||||||
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
||||||
|
|
||||||
|
|
||||||
def sync(self):
|
def sync(self):
|
||||||
self.window().onSync()
|
self.window().onSync()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# AnkiConnect
|
# AnkiConnect
|
||||||
#
|
#
|
||||||
@ -1134,10 +1145,12 @@ class AnkiConnect:
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def updateNoteFields(self, note):
|
def updateNoteFields(self, note):
|
||||||
return self.anki.updateNoteFields(note)
|
return self.anki.updateNoteFields(note)
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def canAddNotes(self, notes):
|
def canAddNotes(self, notes):
|
||||||
results = []
|
results = []
|
||||||
@ -1230,10 +1243,12 @@ class AnkiConnect:
|
|||||||
def getDecks(self, cards):
|
def getDecks(self, cards):
|
||||||
return self.anki.getDecks(cards)
|
return self.anki.getDecks(cards)
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def createDeck(self, deck):
|
def createDeck(self, deck):
|
||||||
return self.anki.createDeck(deck)
|
return self.anki.createDeck(deck)
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def changeDeck(self, cards, deck):
|
def changeDeck(self, cards, deck):
|
||||||
return self.anki.changeDeck(cards, deck)
|
return self.anki.changeDeck(cards, deck)
|
||||||
@ -1303,14 +1318,17 @@ class AnkiConnect:
|
|||||||
def guiExitAnki(self):
|
def guiExitAnki(self):
|
||||||
return self.anki.guiExitAnki()
|
return self.anki.guiExitAnki()
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def cardsInfo(self, cards):
|
def cardsInfo(self, cards):
|
||||||
return self.anki.cardsInfo(cards)
|
return self.anki.cardsInfo(cards)
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def notesInfo(self, notes):
|
def notesInfo(self, notes):
|
||||||
return self.anki.notesInfo(notes)
|
return self.anki.notesInfo(notes)
|
||||||
|
|
||||||
|
|
||||||
@webApi()
|
@webApi()
|
||||||
def sync(self):
|
def sync(self):
|
||||||
return self.anki.sync()
|
return self.anki.sync()
|
||||||
|
Loading…
Reference in New Issue
Block a user