diff options
Diffstat (limited to 'silx/gui/widgets/ThreadPoolPushButton.py')
-rw-r--r-- | silx/gui/widgets/ThreadPoolPushButton.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/silx/gui/widgets/ThreadPoolPushButton.py b/silx/gui/widgets/ThreadPoolPushButton.py index 4dba488..949b6ef 100644 --- a/silx/gui/widgets/ThreadPoolPushButton.py +++ b/silx/gui/widgets/ThreadPoolPushButton.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016 European Synchrotron Radiation Facility +# Copyright (c) 2016-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -201,17 +201,20 @@ class ThreadPoolPushButton(WaitingPushButton): return self.__runnerStarted() runner = self._createRunner(self.__callable, self.__args, self.__kwargs) - qt.QThreadPool.globalInstance().start(runner) + qt.silxGlobalThreadPool().start(runner) self.__runnerSet.add(runner) def __releaseRunner(self, runner): self.__runnerSet.remove(runner) + def hasPendingOperations(self): + return len(self.__runnerSet) > 0 + def _createRunner(self, function, args, kwargs): """Create a QRunnable from a callable object. :param callable function: A callable Python object. - :param list args: List of arguments to call the function. + :param List args: List of arguments to call the function. :param dict kwargs: Dictionary of arguments used to call the function. :rtpye: qt.QRunnable """ @@ -227,7 +230,7 @@ class ThreadPoolPushButton(WaitingPushButton): WARNING: The callable will be called in a separate thread. :param callable function: A callable Python object - :param list args: List of arguments to call the function. + :param List args: List of arguments to call the function. :param dict kwargs: Dictionary of arguments used to call the function. """ self.__callable = function |