diff options
Diffstat (limited to 'lib/taurus/qt/qtcore/util')
-rw-r--r-- | lib/taurus/qt/qtcore/util/__init__.py | 1 | ||||
-rw-r--r-- | lib/taurus/qt/qtcore/util/emitter.py | 11 | ||||
-rw-r--r-- | lib/taurus/qt/qtcore/util/properties.py | 14 | ||||
-rw-r--r-- | lib/taurus/qt/qtcore/util/signal.py | 24 |
4 files changed, 37 insertions, 13 deletions
diff --git a/lib/taurus/qt/qtcore/util/__init__.py b/lib/taurus/qt/qtcore/util/__init__.py index 64ccc147..b3017304 100644 --- a/lib/taurus/qt/qtcore/util/__init__.py +++ b/lib/taurus/qt/qtcore/util/__init__.py @@ -27,5 +27,6 @@ from __future__ import absolute_import from .tauruslog import * +from .signal import baseSignal __docformat__ = 'restructuredtext' diff --git a/lib/taurus/qt/qtcore/util/emitter.py b/lib/taurus/qt/qtcore/util/emitter.py index 2105a53a..205e1351 100644 --- a/lib/taurus/qt/qtcore/util/emitter.py +++ b/lib/taurus/qt/qtcore/util/emitter.py @@ -91,9 +91,6 @@ class QEmitter(Qt.QObject): class TaurusEmitterThread(Qt.QThread): """ - The TaurusEmitterThread Class - ========================== - This object get items from a python Queue and performs a thread safe operation on them. It is useful to serialize Qt tasks in a background thread. @@ -106,8 +103,7 @@ class TaurusEmitterThread(Qt.QThread): :param cursor: if True or QCursor a custom cursor is set while the Queue is not empty - How TaurusEmitterThread works - -------------------------- + How TaurusEmitterThread works: TaurusEmitterThread is a worker thread that processes a queue of iterables passed as arguments to the specified method every time that @@ -126,7 +122,7 @@ class TaurusEmitterThread(Qt.QThread): to ``self.todo queue`` + every time that a *somethingDone* signal arrives ``next()`` is called. + ``next()`` can be called also externally to ensure that the main queue - is being processed. + is being processed. + the queue can be accessed externally using ``getQueue()`` + ``getQueue().qsize()`` returns number of remaining objects in queue. + while there are objects in queue the ``.next()`` method will @@ -139,8 +135,7 @@ class TaurusEmitterThread(Qt.QThread): - if an object is found, it is sent in a *doSomething* signal. - if *"exit"* is found the loop exits. - Usage example - ------------- + Usage example: .. code-block:: python diff --git a/lib/taurus/qt/qtcore/util/properties.py b/lib/taurus/qt/qtcore/util/properties.py index b7b225ed..7c70e834 100644 --- a/lib/taurus/qt/qtcore/util/properties.py +++ b/lib/taurus/qt/qtcore/util/properties.py @@ -117,17 +117,21 @@ COMMON_PROPERTIES = ( ) -def set_property_methods(obj, name, type_="QString", default=None, getter=None, setter=None, reset=None, get_callback=None, set_callback=None, reset_callback=None, qt=False, config=False): +def set_property_methods(obj, name, type_="QString", default=None, getter=None, + setter=None, reset=None, get_callback=None, + set_callback=None, reset_callback=None, qt=False, + config=False): """ - This method allows to add QProperties dynamically with calls like: - <pre> + This method allows to add QProperties dynamically with calls like:: + set_property_methods(self,'Filters','QString',default='', set_callback=lambda s=self:s.loadTree(s.getFilters(),clear=True), reset_callback=lambda s=self:s.loadTree('',clear=True) ) - </pre> - @TODO: This method should be refactored using python descriptors/properties and types.MethodType + + .. todo: This method should be refactored using python + descriptors/properties and types.MethodType """ klass = obj.__class__ mname = '%s%s' % (name[0].upper(), name[1:]) diff --git a/lib/taurus/qt/qtcore/util/signal.py b/lib/taurus/qt/qtcore/util/signal.py index af3e2bfe..ec197b74 100644 --- a/lib/taurus/qt/qtcore/util/signal.py +++ b/lib/taurus/qt/qtcore/util/signal.py @@ -1,3 +1,27 @@ +############################################################################# +## +# This file is part of Taurus +## +# http://taurus-scada.org +## +# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain +## +# Taurus is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +## +# Taurus is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +## +# You should have received a copy of the GNU Lesser General Public License +# along with Taurus. If not, see <http://www.gnu.org/licenses/>. +## +############################################################################# + + """Provide a Signal class for non-QObject objects""" from __future__ import print_function |