本文整理汇总了Python中anki.sync.SyncClient.prepareOneWaySync方法的典型用法代码示例。如果您正苦于以下问题:Python SyncClient.prepareOneWaySync方法的具体用法?Python SyncClient.prepareOneWaySync怎么用?Python SyncClient.prepareOneWaySync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anki.sync.SyncClient
的用法示例。
在下文中一共展示了SyncClient.prepareOneWaySync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from anki.sync import SyncClient [as 别名]
# 或者: from anki.sync.SyncClient import prepareOneWaySync [as 别名]
changes = False
if not deck:
self.setStatus(_("No changes found."))
# check sources
srcChanged = False
if self.sourcesToCheck:
start = time.time()
self.setStatus(_("<br><br>Checking deck subscriptions..."))
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