Changeset 2500

Show
Ignore:
Timestamp:
11/13/08 22:50:26 (8 weeks ago)
Author:
bzr
Message:

scriptHandler: cache the im_func of scripts (instance methods) as the actual instance method disappears. This fixes the problem where running scripts more than once in quick succession was not producing the right results. Closes track ticket #226.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk

    • Property bzr:revision-info
      •  

        old new  
        1 timestamp: 2008-11-13 22:10:55.158999920 +1100 
         1timestamp: 2008-11-14 09:48:46.532000065 +1100 
        22committer: Michael Curran <mick@kulgan.net> 
        33properties:  
    • Property bzr:revision-id:v3-list-QlpoOTFBWSZTWbrL2vUAAB1VgAAQABCAQDrrnqAgAFCgaaGRkxBoTIJ6mmaNRwhndFAoNhZjh_YY4a01fOg1ulgNNC2UrzPdXXEnDpX8XckU4UJC6y9r1A..
      •  

        old new  
        2692692297 mick@kulgan.net-20081113054049-kmiq89owi6y0b0bv 
        2702702298 mick@kulgan.net-20081113111055-g2uf0b5ytgivaiir 
         2712299 mick@kulgan.net-20081113224846-xq2tw48ag6wyw1om 
    • Property bzr:file-ids
      •  

        old new  
        1 source/appModules/_default.py   92@dbe06fc7-9119-0410-a01d-9dbf589ecbba:trunk:source%2FappModules%2F_default.py 
         1source/scriptHandler.py 362@dbe06fc7-9119-0410-a01d-9dbf589ecbba:trunk:source%2FscriptHandler.py 
  • trunk/source/scriptHandler.py

    r2498 r2500  
    8484        lastScriptRef=_lastScriptRef() if _lastScriptRef else None 
    8585        #We don't allow the same script to be executed from with in itself, but we still should pass the key through 
    86         if _isScriptRunning and lastScriptRef==script: 
     86        if _isScriptRunning and lastScriptRef==script.im_func: 
    8787                return sendKey(keyPress) 
    8888        _isScriptRunning=True 
    8989        try: 
    9090                scriptTime=time.time() 
    91                 scriptRef=weakref.ref(script) 
    92                 if (scriptTime-_lastScriptTime)<=0.5 and script==lastScriptRef: 
     91                scriptRef=weakref.ref(script.im_func) 
     92                if (scriptTime-_lastScriptTime)<=0.5 and script.im_func==lastScriptRef: 
    9393                        _lastScriptCount+=1 
    9494                else: