示例#1
0
    def __updateFilter(self):

        newFilter = self.__path.getFilter()
        if self.__filter is not None and self.__filter.isSame(newFilter):
            return

        # update the directory path filter to include
        # the new filter, but with the additional removal
        # of leaf paths. block the signal because otherwise
        # we'd end up truncating the main path in __dirPathChanged.
        with Gaffer.BlockedConnection(self.__dirPathChangedConnection):
            if newFilter is not None:
                self.__dirPath.setFilter(
                    Gaffer.CompoundPathFilter([
                        Gaffer.LeafPathFilter(),
                        newFilter,
                    ]))
            else:
                self.__dirPath.setFilter(Gaffer.LeafPathFilter())

        # update ui for displaying the filter
        newFilterUI = None
        if newFilter is not None:
            newFilterUI = GafferUI.PathFilterWidget.create(newFilter)

        self.__filterFrame.setChild(newFilterUI)
        self.__filterFrame.setVisible(newFilterUI is not None)

        self.__filter = newFilter
    def _filter(self):

        result = GafferCortexUI.PathParameterValueWidget._filter(self)
        result.addFilter(
            Gaffer.LeafPathFilter(userData={"UI": {
                "visible": False,
            }}))
        return result
示例#3
0
	def test( self ) :

		p = Gaffer.DictPath(
			{
				"a" : "a",
				"b" : "b",
				"d" : {}
			},
			"/",
		)

		self.assertEqual( set( [ str( c ) for c in p.children() ] ), set( [ "/a", "/b", "/d" ] ) )

		p.setFilter( Gaffer.LeafPathFilter() )
		self.assertEqual( set( [ str( c ) for c in p.children() ] ), set( [ "/d" ] ) )