taurus.qt.qtcore.util.properties

properties.py: Methods for adding QProperties to QObjects

A call 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) )

Would replace all these lines:

def setFilters(self,filters):

self._filters = filters self.loadTree(self._filters,clear=True)

def getFilters(self):

return self._filters

def resetFilters(self):

self._filters=”” self.loadTree(self._filters)

filters = QtCore.pyqtProperty(“QString”, getFilters, setFilters, resetFilters)

Not tested yet with the classical declaration:

#model = QtCore.pyqtProperty(“QString”, TaurusBaseWidget.getModel,

#TaurusBaseWidget.setModel, #TaurusBaseWidget.resetModel)

Functions

djoin(a, b)[source]

This method merges dictionaries and/or lists

get_property(obj, name, callback=None)[source]
get_property_attribute(name)[source]
join(*seqs)[source]

It returns a list containing the objects of all given sequences.

reset_property(obj, name, default=None, callback=None)[source]
set_property(obj, name, value, callback=None)[source]
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)[source]

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)
    )