Skip to content
Snippets Groups Projects
Commit c06d00f1 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Merge branch 'rf/idle' into 'master'

Rf/idle

See merge request fsl/fslpy!172
parents 47067c1d 36fb9813
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,37 @@ This document contains the ``fslpy`` release history in reverse chronological
order.
2.7.0 (Under development)
-------------------------
Added
^^^^^
* New ``until`` option to the :func:`.idle.block` function.
* New :meth:`.Idle.neverQueue` setting, which can be used to force all
tasks passed to :func:`.idle.idle` to be executed synchronously.
Changed
^^^^^^^
* Internal reorganisation inm the :mod:`.idle` module.
Deprecated
^^^^^^^^^^
* :func:`.idle.inIdle` - replaced by :meth:`.IdleLoop.inIdle`.
* :func:`.idle.cancelIdle` - replaced by :meth:`.IdleLoop.cancelIdle`.
* :func:`.idle.idleReser` - replaced by :meth:`.IdleLoop.idleReset`.
* :func:`.idle.getIdleTimeout` - replaced by :meth:`.IdleLoop.callRate`.
* :func:`.idle.setIdleTimeout` - replaced by :meth:`.IdleLoop.callRate`.
2.6.2 (Monday 7th October 2019)
-------------------------------
......
This diff is collapsed.
......@@ -159,7 +159,14 @@ class Platform(notifier.Notifier):
@property
def haveGui(self):
"""``True`` if we are running with a GUI, ``False`` otherwise. """
"""``True`` if we are running with a GUI, ``False`` otherwise.
This currently equates to testing whether a display is available
(see :meth:`canHaveGui`) and whether a ``wx.App`` exists. It
previously also tested whether an event loop was running, but this
is not compatible with execution from IPython/Jupyter notebook, where
the event loop is called periodically, and so is not always running.
"""
try:
import wx
app = wx.GetApp()
......
......@@ -62,7 +62,7 @@ def _run_with_wx(func, *args, **kwargs):
time.sleep(1)
idle.idleReset()
idle.idleLoop.reset()
if raised[0] and propagateRaise:
raise raised[0]
......@@ -146,15 +146,15 @@ def _test_run():
@pytest.mark.wxtest
def test_idleTimeout_with_gui(): _run_with_wx( _test_idleTimeout)
def test_idleTimeout_without_gui(): _run_without_wx(_test_idleTimeout)
def _test_idleTimeout():
idle.idleReset()
default = idle.getIdleTimeout()
idle.setIdleTimeout(999)
assert idle.getIdleTimeout() == 999
idle.setIdleTimeout()
assert idle.getIdleTimeout() == default
def test_callRate_with_gui(): _run_with_wx( _test_callRate)
def test_callRate_without_gui(): _run_without_wx(_test_callRate)
def _test_callRate():
idle.idleLoop.reset()
default = idle.idleLoop.callRate
idle.idleLoop.callRate = 999
assert idle.idleLoop.callRate == 999
idle.idleLoop.callRate = None
assert idle.idleLoop.callRate == default
@pytest.mark.wxtest
......@@ -214,7 +214,7 @@ def test_idle():
def errtask(arg, kwarg1=None):
raise Exception('Task which was supposed to crash crashed!')
assert idle.getIdleTimeout() > 0
assert idle.idleLoop.callRate > 0
# Run directly
_run_without_wx(idle.idle, task, 1, kwarg1=2, name='direct')
......@@ -246,7 +246,7 @@ def test_inidle():
def queuetask():
idle.idle(task, after=0.01, name=name)
assert idle.inIdle(name)
assert idle.idleLoop.inIdle(name)
_run_with_wx(queuetask)
......@@ -265,7 +265,7 @@ def test_cancelidle():
def queuetask():
idle.idle(task, after=0.01, name=name)
idle.cancelIdle(name)
idle.idleLoop.cancelIdle(name)
_run_with_wx(queuetask)
......@@ -453,7 +453,7 @@ def test_idleWhen():
def task():
called[0] = True
idle.setIdleTimeout(1)
idle.idleLoop.callRate = 1
_run_with_wx(idle.idleWhen, task, condition, pollTime=0.001)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment