diff --git a/fsl/__init__.py b/fsl/__init__.py index b971741178b61219a22fc31cd630f159c2595c2f..38d74dc7a1a00e82871211e36e64684a1f802603 100644 --- a/fsl/__init__.py +++ b/fsl/__init__.py @@ -165,7 +165,10 @@ def runTool(toolName, args, **kwargs): """ args = [toolName] + args - + + if log.getEffectiveLevel() == logging.DEBUG: + args = ['-vvv'] + args + # If we are running from a compiled fsleyes # executable, we need to prepend command line # arguments with 'cmd' - see the wrapper script diff --git a/fsl/fsleyes/gl/glmodel.py b/fsl/fsleyes/gl/glmodel.py index 77ec93e5eec4db19623588c058abba2ac9160e04..0dd61055d9b2631825d14e2eab06a83d2104b9b2 100644 --- a/fsl/fsleyes/gl/glmodel.py +++ b/fsl/fsleyes/gl/glmodel.py @@ -106,6 +106,12 @@ class GLModel(globject.GLObject): self.opts = None + def ready(self): + """Overrides :meth:`.GLObject.ready`. Always returns ``True``. + """ + return True + + def addListeners(self): """Called by :meth:`__init__`. Adds some property listeners to the :class:`.Display` and :class:`.ModelOpts` instances so the OpenGL diff --git a/fsl/utils/async.py b/fsl/utils/async.py index 65ebf1caed68909847df8a38814fdcdfe37f4ef4..6d098f30db021a03d8bbbc33545f06f7ab62e56a 100644 --- a/fsl/utils/async.py +++ b/fsl/utils/async.py @@ -59,13 +59,18 @@ def run(task, onFinish=None, name=None): :arg name: An optional name to use for this task in log statements. - .. note:: If a ``wx`` application is not running, the ``onFinish`` - function is called directly from the task thread. + :returns: A reference to the ``Thread`` that was created. + + .. note:: If a ``wx`` application is not running, the ``task`` and + ``onFinish`` functions will simply be called directly, and + the return value will be ``None``. """ if name is None: name = 'async task' + haveWX = _haveWX() + def wrapper(): log.debug('Running task "{}"...'.format(name)) @@ -73,24 +78,26 @@ def run(task, onFinish=None, name=None): log.debug('Task "{}" finished'.format(name)) - if onFinish is not None: - - if _haveWX(): - import wx + if (onFinish is not None): - log.debug('Scheduling task "{}" finish handler ' - 'on wx.MainLoop'.format(name)) + import wx - wx.CallAfter(onFinish) - else: - log.debug('Running task "{}" finish handler'.format(name)) - onFinish() - + log.debug('Scheduling task "{}" finish handler ' + 'on wx.MainLoop'.format(name)) - thread = threading.Thread(target=wrapper) - thread.start() + wx.CallAfter(onFinish) - return thread + if haveWX: + thread = threading.Thread(target=wrapper) + thread.start() + return thread + + else: + log.debug('Running task "{}" directly'.format(name)) + task() + log.debug('Running task "{}" finish handler'.format(name)) + onFinish() + return None _idleRegistered = False