def __init__(self, repoTreeModel, collector, parent=None):
        """ Constructor.

            Maintains a reference to a collector. The repo tree view updates the collector when
            the currentIndex changes.
        """
        super(RepoTreeView, self).__init__(treeModel=repoTreeModel, parent=parent)

        self._collector = collector
        self._config = self._createConfig()

        treeHeader = self.header()
        treeHeader.resizeSection(RepoTreeModel.COL_NODE_NAME, COL_NODE_NAME_WIDTH)
        treeHeader.resizeSection(RepoTreeModel.COL_SHAPE, COL_SHAPE_WIDTH)
        treeHeader.resizeSection(RepoTreeModel.COL_ELEM_TYPE, COL_ELEM_TYPE_WIDTH)
        treeHeader.setStretchLastSection(True)

        headerNames = self.model().horizontalHeaders
        enabled = dict((name, True) for name in headerNames)
        enabled[headerNames[RepoTreeModel.COL_NODE_NAME]] = False # Cannot be unchecked
        checked = dict((name, False) for name in headerNames)
        checked[headerNames[RepoTreeModel.COL_NODE_NAME]] = True
        checked[headerNames[RepoTreeModel.COL_SHAPE]] = False
        checked[headerNames[RepoTreeModel.COL_ELEM_TYPE]] = False
        self.addHeaderContextMenu(checked=checked, enabled=enabled, checkable={})

        self.setContextMenuPolicy(Qt.DefaultContextMenu) # will call contextMenuEvent
        self.setUniformRowHeights(True)
        #self.setIconSize(QtCore.QSize(16, 16))

        # Add actions
        self.topLevelItemActionGroup = QtWidgets.QActionGroup(self) # TODO: not used anymore?
        self.topLevelItemActionGroup.setExclusive(False)
        self.currentItemActionGroup = QtWidgets.QActionGroup(self)
        self.currentItemActionGroup.setExclusive(False)

        removeFileAction = QtWidgets.QAction("Remove from Tree", self.currentItemActionGroup,
                                         shortcut=QtGui.QKeySequence.Delete,
                                         triggered=self.removeCurrentItem)
        self.addAction(removeFileAction)

        reloadFileAction = QtWidgets.QAction("Reload File", self.currentItemActionGroup,
                                         shortcut=QtGui.QKeySequence.Refresh,   #"Ctrl+R",
                                         triggered=self.reloadFileOfCurrentItem)
        self.addAction(reloadFileAction)

        self.openItemAction = QtWidgets.QAction("Open Item", self,
                                       #shortcut="Ctrl+Shift+C",
                                       triggered=self.openCurrentItem)
        self.addAction(self.openItemAction)

        self.closeItemAction = QtWidgets.QAction("Close Item", self,
                                        #shortcut="Ctrl+C", # Ctrl+C already taken for Copy
                                        triggered=self.closeCurrentItem)
        self.addAction(self.closeItemAction)

        # Connect signals
        selectionModel = self.selectionModel() # need to store reference to prevent crash in PySide
        selectionModel.currentChanged.connect(self.currentItemChanged)

        self.model().sigItemChanged.connect(self.repoTreeItemChanged)
def __init__ ( self , repoTreeModel , collector , parent = None ) : super ( RepoTreeView , self ) . __init__ ( treeModel = repoTreeModel , parent = parent ) self . _collector = collector self . _config = self . _createConfig ( ) treeHeader = self . header ( ) treeHeader . resizeSection ( RepoTreeModel . COL_NODE_NAME , COL_NODE_NAME_WIDTH ) treeHeader . resizeSection ( RepoTreeModel . COL_SHAPE , COL_SHAPE_WIDTH ) treeHeader . resizeSection ( RepoTreeModel . COL_ELEM_TYPE , COL_ELEM_TYPE_WIDTH ) treeHeader . setStretchLastSection ( True ) headerNames = self . model ( ) . horizontalHeaders enabled = dict ( ( name , True ) for name in headerNames ) enabled [ headerNames [ RepoTreeModel . COL_NODE_NAME ] ] = False checked = dict ( ( name , False ) for name in headerNames ) checked [ headerNames [ RepoTreeModel . COL_NODE_NAME ] ] = True checked [ headerNames [ RepoTreeModel . COL_SHAPE ] ] = False checked [ headerNames [ RepoTreeModel . COL_ELEM_TYPE ] ] = False self . addHeaderContextMenu ( checked = checked , enabled = enabled , checkable = { } ) self . setContextMenuPolicy ( Qt . DefaultContextMenu ) self . setUniformRowHeights ( True ) self . topLevelItemActionGroup = QtWidgets . QActionGroup ( self ) self . topLevelItemActionGroup . setExclusive ( False ) self . currentItemActionGroup = QtWidgets . QActionGroup ( self ) self . currentItemActionGroup . setExclusive ( False ) removeFileAction = QtWidgets . QAction ( "Remove from Tree" , self . currentItemActionGroup , shortcut = QtGui . QKeySequence . Delete , triggered = self . removeCurrentItem ) self . addAction ( removeFileAction ) reloadFileAction = QtWidgets . QAction ( "Reload File" , self . currentItemActionGroup , shortcut = QtGui . QKeySequence . Refresh , triggered = self . reloadFileOfCurrentItem ) self . addAction ( reloadFileAction ) self . openItemAction = QtWidgets . QAction ( "Open Item" , self , triggered = self . openCurrentItem ) self . addAction ( self . openItemAction ) self . closeItemAction = QtWidgets . QAction ( "Close Item" , self , triggered = self . closeCurrentItem ) self . addAction ( self . closeItemAction ) selectionModel = self . selectionModel ( ) selectionModel . currentChanged . connect ( self . currentItemChanged ) self . model ( ) . sigItemChanged . connect ( self . repoTreeItemChanged )
Constructor.

            Maintains a reference to a collector. The repo tree view updates the collector when
            the currentIndex changes.