Example #1
0
    def __selectionChanged(self, pathListing):

        assert (pathListing is self.__pathListing)

        with Gaffer.BlockedConnection(self._contextChangedConnection()):
            ContextAlgo.setSelectedPaths(self.getContext(),
                                         pathListing.getSelection())
Example #2
0
	def __selectionChanged( self, pathListing ) :

		assert( pathListing is self.__pathListing )

		paths = pathListing.getSelectedPaths()
		paths = GafferScene.PathMatcher( [ str(p) for p in paths ] )
		with Gaffer.BlockedConnection( self._contextChangedConnection() ) :
			ContextAlgo.setSelectedPaths( self.getContext(), paths )
Example #3
0
	def __expansionChanged( self, pathListing ) :

		assert( pathListing is self.__pathListing )

		paths = pathListing.getExpandedPaths()
		paths = GafferScene.PathMatcher( [ "/" ] + [ str( path ) for path in paths ] )
		with Gaffer.BlockedConnection( self._contextChangedConnection() ) :
			ContextAlgo.setExpandedPaths( self.getContext(), paths )
Example #4
0
    def __selectionChanged(self, pathListing):

        assert (pathListing is self.__pathListing)

        paths = pathListing.getSelectedPaths()
        paths = GafferScene.PathMatcher([str(p) for p in paths])
        with Gaffer.BlockedConnection(self._contextChangedConnection()):
            ContextAlgo.setSelectedPaths(self.getContext(), paths)
Example #5
0
    def __expansionChanged(self, pathListing):

        assert (pathListing is self.__pathListing)

        paths = pathListing.getExpandedPaths()
        paths = GafferScene.PathMatcher(["/"] + [str(path) for path in paths])
        with Gaffer.BlockedConnection(self._contextChangedConnection()):
            ContextAlgo.setExpandedPaths(self.getContext(), paths)
Example #6
0
	def _updateFromContext( self, modifiedItems ) :

		if any( ContextAlgo.affectsSelectedPaths( x ) for x in modifiedItems ) :
			self.__transferSelectionFromContext()
		elif any( ContextAlgo.affectsExpandedPaths( x ) for x in modifiedItems ) :
			self.__transferExpansionFromContext()

		for item in modifiedItems :
			if not item.startswith( "ui:" ) :
				# When the context has changed, the hierarchy of the scene may
				# have too so we should update our PathListingWidget.
				self.__setPathListingPath()
				break
Example #7
0
    def __transferSelectionFromContext(self):

        selection = ContextAlgo.getSelectedPaths(self.getContext())
        with Gaffer.BlockedConnection(self.__selectionChangedConnection):
            self.__pathListing.setSelection(selection,
                                            scrollToFirst=True,
                                            expandNonLeaf=False)
Example #8
0
	def __transferExpansionFromContext( self ) :

		expandedPaths = ContextAlgo.getExpandedPaths( self.getContext() )
		if expandedPaths is None :
			return

		with Gaffer.BlockedConnection( self.__expansionChangedConnection ) :
			self.__pathListing.setExpansion( expandedPaths )
Example #9
0
	def __transferExpansionFromContext( self ) :

		expandedPaths = ContextAlgo.getExpandedPaths( self.getContext() )
		if expandedPaths is None :
			return

		p = self.__pathListing.getPath()
		expandedPaths = [ p.copy().setFromString( s ) for s in expandedPaths.paths() ]
		with Gaffer.BlockedConnection( self.__expansionChangedConnection ) :
			self.__pathListing.setExpandedPaths( expandedPaths )
Example #10
0
    def __transferExpansionFromContext(self):

        expandedPaths = ContextAlgo.getExpandedPaths(self.getContext())
        if expandedPaths is None:
            return

        p = self.__pathListing.getPath()
        expandedPaths = [
            p.copy().setFromString(s) for s in expandedPaths.paths()
        ]
        with Gaffer.BlockedConnection(self.__expansionChangedConnection):
            self.__pathListing.setExpandedPaths(expandedPaths)
Example #11
0
	def __transferSelectionFromContext( self ) :

		selection = ContextAlgo.getSelectedPaths( self.getContext() ).paths()
		with Gaffer.BlockedConnection( self.__selectionChangedConnection ) :
			## \todo Qt is dog slow with large non-contiguous selections,
			# so we're only mirroring single selections currently. Rewrite
			# PathListingWidget so it manages selection itself using a PathMatcher
			# and we can refer to the same data structure everywhere, and reenable
			# mirroring of multi-selection.
			if len( selection ) == 1 :
				p = self.__pathListing.getPath()
				selection = [ p.copy().setFromString( s ) for s in selection ]
				self.__pathListing.setSelectedPaths( selection, scrollToFirst=True, expandNonLeaf=False )
			else :
				self.__pathListing.setSelectedPaths( [] )
Example #12
0
    def __transferSelectionFromContext(self):

        selection = ContextAlgo.getSelectedPaths(self.getContext()).paths()
        with Gaffer.BlockedConnection(self.__selectionChangedConnection):
            ## \todo Qt is dog slow with large non-contiguous selections,
            # so we're only mirroring single selections currently. Rewrite
            # PathListingWidget so it manages selection itself using a PathMatcher
            # and we can refer to the same data structure everywhere, and reenable
            # mirroring of multi-selection.
            if len(selection) == 1:
                p = self.__pathListing.getPath()
                selection = [p.copy().setFromString(s) for s in selection]
                self.__pathListing.setSelectedPaths(selection,
                                                    scrollToFirst=True,
                                                    expandNonLeaf=False)
            else:
                self.__pathListing.setSelectedPaths([])
Example #13
0
	def __transferSelectionFromContext( self ) :

		selection = ContextAlgo.getSelectedPaths( self.getContext() )
		with Gaffer.BlockedConnection( self.__selectionChangedConnection ) :
			self.__pathListing.setSelection( selection, scrollToFirst=True, expandNonLeaf=False )
Example #14
0
	def __selectionChanged( self, pathListing ) :

		assert( pathListing is self.__pathListing )

		with Gaffer.BlockedConnection( self._contextChangedConnection() ) :
			ContextAlgo.setSelectedPaths( self.getContext(), pathListing.getSelection() )