moduleManager.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pyree-old 作者: DrLuke 项目源码 文件源码
def checkOrCreateCategory(self, categories, treeWidget):
        """Recursively add category folders to treeWidget unless they already exist"""
        currentItem = None
        currentCatTree = self.categoryTree
        for category in categories:
            if category in currentCatTree:
                currentItem = currentCatTree[category][0]
                currentCatTree = currentCatTree[category][1]
            else:
                newItem = QTreeWidgetItem(1001)     # Type 1001 for categories
                newItem.setText(0, category)
                if currentItem is None:
                    treeWidget.addTopLevelItem(newItem)
                else:
                    currentItem.addChild(newItem)
                currentItem = newItem
                currentCatTree[category] = [newItem, {}]
                currentCatTree = currentCatTree[category][1]
        return currentItem
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号