def __init__(self, preferences): """ Constructor. @param repositoryManager: The central preferences. @type repositoryManager: L{PreferencesHandler<datafinder.core.configuration.preferences.PreferencesHandler>} """ HistoryModel.__init__(self) self._headers = list() self._headerIds = list() self._repository = None self._actionHandler = None self._preferences = preferences self._iconProvider = None self._emptyQVariant = QtCore.QVariant() self._emptyQModelIndex = QtCore.QModelIndex() self._placeHolderCollection = ItemBase("...") self._placeHolderCollection._isCollection = True self._placeHolderLeaf = ItemBase("...") self._childrenPopulator = _ChildrenPopulator(self) self._lockedItems = list()
def setUp(self): # A tree walker that operates Pre-order (mode=-1) self.preorderWalker = _TestItemTreeWalker() self.preorderWalker.reset() # A tree walker that applies Post-order scheme (mode=1) self.postorderWalker = _TestItemTreeWalker(mode=1) self.postorderWalker.reset() # A root for testing self.testRoot = ItemRoot("root") self.testRoot._fileStorer = SimpleMock(list()) self.testRoot.itemFactory = SimpleMock(SimpleMock(list())) self.testRoot.path = "" # A collection for testing self.testNode = ItemCollection("collection") self.testNode._fileStorer = SimpleMock(list()) self.testNode.itemFactory = SimpleMock(SimpleMock(list())) self.testNode.parent = self.testRoot # A leaf for testing self.testLeaf = ItemLeaf("leaf") self.testLeaf._fileStorer = SimpleMock(list()) self.testLeaf.itemFactory = SimpleMock(SimpleMock(list())) self.testLeaf.parent = self.testNode # A base item for testing self.testBase = ItemBase("base") self.testBase._fileStorer = SimpleMock(list()) self.testBase.itemFactory = SimpleMock(SimpleMock(list())) self.testBase.parent = self.testNode # A link for testing self.testLink = ItemLink("link") self.testLink._fileStorer = SimpleMock(list()) self.testLink.itemFactory = SimpleMock(SimpleMock(list())) self.testLink.parent = self.testNode