Changeset 713:64f54381f834 for src/mlx


Ignore:
Timestamp:
10/25/15 18:49:24 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
cef
Phase:
public
Message:

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

Location:
src/mlx/gui
Files:
2 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."""
  • src/mlx/gui/flight.py

    r712 r713  
    19741974            self._wizard.gui.beginBusy("Calling SimBrief...")
    19751975
     1976            cef.startFastTimeout()
    19761977            cef.callSimBrief(plan,
    19771978                             self._getCredentialsCallback,
     
    20462047            self._wizard.gui.updateBusyState(xstr(message))
    20472048        else:
     2049            cef.stopFastTimeout()
    20482050            self._wizard.gui.endBusy()
    20492051
Note: See TracChangeset for help on using the changeset viewer.