[wingide-users] PyLint on Save

Marcus.CM marcus at internetnowasp.net
Tue Aug 12 04:13:03 MDT 2008


Hi,

But after some observation its true, whenever i get this msg, the Pylint 
doesnt get executed even though i purposely type in some changes after 
that and click on save. The only way is to
reload the scripts again. It seems that "document-open" does not cause 
the connected function to be called when you open a document, so only 
those documents that are already opened when the script is loaded will 
call Pylint correctly.

See my attached script , did i miss something.

Marcus.



Wingware Support wrote:
> Marcus.CM wrote:
>> Hi,
>>
>> I manage to get PyLint to be executed everytime i save the module if 
>> the modules are already open when the extension_ide scripts are loaded.
>> But the problem is if i open a module (.py) and press save, then i 
>> will get an error "tried to execute an unavailable command 
>> .internal.gui.save". I find that if i reload the scripts everytime i 
>> open
>> a module then i wont get this problem and the extension works as 
>> expected. If i open a module from my project without asking Wing to 
>> reloadscripts, then i will get this error.
>
> The "tried to execute an unavailable command .internal.gui.save" 
> message is not an error -- it indicates a save request was made when a 
> file didn't need to be saved.  It is confusing and we'll suppress the 
> message in future releases.
>
> Cheers,
>
> John
>

-------------- next part --------------
def _connect_to_savepoint(doc):      
  def _on_savepoint(val):    
    if val == 0 :
      return       

    ed = wingapi.gApplication.GetActiveDocument()
    if ed == None :
      return      
    wingapi.gApplication.ExecuteCommand('pylint-execute')    
  connect_id = doc.Connect('save-point', _on_savepoint)  
  
def _savepointinit():
  wingapi.gApplication.Connect('document-open', _connect_to_savepoint)
  for doc in wingapi.gApplication.GetOpenDocuments():
    _connect_to_savepoint(doc)

_savepointinit()


More information about the wingide-users mailing list