Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
c06d00f1
Commit
c06d00f1
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Plain Diff
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
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.rst
+31
-0
31 additions, 0 deletions
CHANGELOG.rst
fsl/utils/idle.py
+509
-400
509 additions, 400 deletions
fsl/utils/idle.py
fsl/utils/platform.py
+8
-1
8 additions, 1 deletion
fsl/utils/platform.py
tests/test_idle.py
+14
-14
14 additions, 14 deletions
tests/test_idle.py
with
562 additions
and
415 deletions
CHANGELOG.rst
+
31
−
0
View file @
c06d00f1
...
...
@@ -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.
Click to expand it.
fsl/utils/idle.py
+
509
−
400
View file @
c06d00f1
This diff is collapsed.
Click to expand it.
fsl/utils/platform.py
+
8
−
1
View file @
c06d00f1
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_idle.py
+
14
−
14
View file @
c06d00f1
...
...
@@ -62,7 +62,7 @@ def _run_with_wx(func, *args, **kwargs):
time
.
sleep
(
1
)
idle
.
idle
R
eset
()
idle
.
idle
Loop
.
r
eset
()
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
.
idle
R
eset
()
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
.
idle
Loop
.
r
eset
()
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment