def __selectionChanged(self, pathListing): assert (pathListing is self.__pathListing) with Gaffer.BlockedConnection(self._contextChangedConnection()): ContextAlgo.setSelectedPaths(self.getContext(), pathListing.getSelection())
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 )
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 )
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)
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)
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
def __transferSelectionFromContext(self): selection = ContextAlgo.getSelectedPaths(self.getContext()) with Gaffer.BlockedConnection(self.__selectionChangedConnection): self.__pathListing.setSelection(selection, scrollToFirst=True, expandNonLeaf=False)
def __transferExpansionFromContext( self ) : expandedPaths = ContextAlgo.getExpandedPaths( self.getContext() ) if expandedPaths is None : return with Gaffer.BlockedConnection( self.__expansionChangedConnection ) : self.__pathListing.setExpansion( expandedPaths )
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 )
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)
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( [] )
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([])
def __transferSelectionFromContext( self ) : selection = ContextAlgo.getSelectedPaths( self.getContext() ) with Gaffer.BlockedConnection( self.__selectionChangedConnection ) : self.__pathListing.setSelection( selection, scrollToFirst=True, expandNonLeaf=False )
def __selectionChanged( self, pathListing ) : assert( pathListing is self.__pathListing ) with Gaffer.BlockedConnection( self._contextChangedConnection() ) : ContextAlgo.setSelectedPaths( self.getContext(), pathListing.getSelection() )