Ignore:
Timestamp:
10/25/15 18:49:24 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
cef
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Added support for a fast timeout handler to speed up operations driver via Selenium (re #279).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/cef.py

    r703 r713  
    2828# Indicate if we should quit
    2929_toQuit = False
     30
     31# Indicate the users of the fast timeout handler. If it reaches zero, the
     32# timeout will be stopped
     33_fastTimeoutUsers = 0
    3034
    3135# The Selenium thread
     
    402406#------------------------------------------------------------------------------
    403407
     408def startFastTimeout():
     409    """Start the fast timeout handler."""
     410    global _fastTimeoutUsers
     411
     412    if _fastTimeoutUsers==0:
     413        _fastTimeoutUsers = 1
     414        gobject.timeout_add(1, _handleFastTimeout)
     415    else:
     416        _fastTimeoutUsers += 1
     417
     418#------------------------------------------------------------------------------
     419
     420def stopFastTimeout():
     421    """Stop the fast timeout handler."""
     422    global _fastTimeoutUsers
     423
     424    assert _fastTimeoutUsers>0
     425    _fastTimeoutUsers -= 1
     426
     427#------------------------------------------------------------------------------
     428
     429def _handleFastTimeout():
     430    """Handle a (fast) timeout by running the CEF message loop."""
     431    if _toQuit or _fastTimeoutUsers==0:
     432        return False
     433    else:
     434        cefpython.MessageLoopWork()
     435        return True
     436
     437#------------------------------------------------------------------------------
     438
    404439def _handleSizeAllocate(widget, sizeAlloc):
    405440    """Handle the size-allocate event."""
Note: See TracChangeset for help on using the changeset viewer.