Revision history [back]
You want the save-point signal on the CAPIDocument. Something like this:
import wingapi
def _connect_to_document(doc):
def _on_modified(savepoint):
if not savepoint:
return
# Execute yapf here, possibly with wingapi.gApplication.AsyncExecuteCommandLine
connect_id = doc.Connect('save-point', _on_modified)
def _init():
wingapi.gApplication.Connect('document-open', _connect_to_document)
for doc in wingapi.gApplication.GetOpenDocuments():
_connect_to_document(doc)
_init()
You want the save-point signal on the CAPIDocument. Something like this:this:
import wingapi
import wingapi
def _connect_to_document(doc): def _on_modified(savepoint): if not savepoint: return # Execute yapf here, possibly with wingapi.gApplication.AsyncExecuteCommandLine connect_id = doc.Connect('save-point',
_on_modified)_on_modified)def _init(): wingapi.gApplication.Connect('document-open', _connect_to_document) for doc in wingapi.gApplication.GetOpenDocuments():
_connect_to_document(doc)_connect_to_document(doc)
_init()