本文整理汇总了Python中anki.sync.SyncClient.applyOneWayPayload方法的典型用法代码示例。如果您正苦于以下问题:Python SyncClient.applyOneWayPayload方法的具体用法?Python SyncClient.applyOneWayPayload怎么用?Python SyncClient.applyOneWayPayload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anki.sync.SyncClient
的用法示例。
在下文中一共展示了SyncClient.applyOneWayPayload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from anki.sync import SyncClient [as 别名]
# 或者: from anki.sync.SyncClient import applyOneWayPayload [as 别名]
srcChanged = False
for source in self.sourcesToCheck:
proxy.deckName = str(source)
msg = "%s:" % client.syncOneWayDeckName()
if not proxy.hasDeck(str(source)):
self.setStatus(_(" * %s no longer exists.") % msg)
continue
if not client.prepareOneWaySync():
self.setStatus(_(" * %s no changes found.") % msg)
continue
srcChanged = True
self.setStatus(_(" * %s fetching payload...") % msg)
payload = proxy.genOneWayPayload(client.deck.lastSync)
self.setStatus(msg + _(" applied %d modified cards.") %
len(payload['cards']))
client.applyOneWayPayload(payload)
self.setStatus(_("Check complete."))
self.deck.s.flush()
self.deck.s.commit()
# close and send signal to main thread
self.deck.close()
if not deck:
taken = time.time() - start
if (changes or srcChanged) and taken < 2.5:
time.sleep(2.5 - taken)
else:
time.sleep(0.25)
self.emit(SIGNAL("syncFinished"))
except Exception, e:
self.ok = False
#traceback.print_exc()