[wingide-users] running script on save?

Wingware Support support at wingware.com
Mon Jan 10 09:39:45 MST 2011

On 1/10/11 10:28 AM, Marcin Krol wrote:
> Hash: SHA1
> Hello everyone,
> I can't get this to work, here's my editor-extensions.py:

This version works for me (I tried it in Wing 4.0beta5):

def _connect_to_savepoint(doc):
   def _on_savepoint(saved):
     ed = wingapi.gApplication.OpenEditor(doc.GetFilename())
     if saved:
       print "EDITOR SAVED", ed
   connect_id = doc.Connect('save-point', _on_savepoint)

def _init_savepoint():
   wingapi.gApplication.Connect('document-open', _connect_to_savepoint)
   for doc in wingapi.gApplication.GetOpenDocuments():


(the args in _on_savepoint were wrong and you need to call the init 
call, which I've renamed and made independent of the presave example)

Note that _on_savepoint will also be called with saved=False when a file 
is first edited (it leaves the save point).


Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list