예제 #1
0
    def convertTaskToModel(self) -> list:
        """
        task节点转tableview model.

        :return: list数组,元素为dict类型
        """
        # 定位tasks节点
        node = xml.findFirstNode(self.xmlTree, ".//tasks")
        return [subNode.attrib for subNode in list(node)]
예제 #2
0
    def convertFunctionToModel(self) -> list:
        """
        function节点转tableview model.

        :return: list数组,元素为dict类型
        """
        # 定位functions节点
        node = xml.findFirstNode(self.xmlTree, ".//functions")
        return [subNode.attrib for subNode in list(node)]
예제 #3
0
    def delNodeNode(self, id: str):
        """
        删除节点节点.

        :param id: 要删除的节点id
        :return:
        """
        node = xml.findFirstNode(self.xmlTree, r".//nodes")
        self.__delNode(node, {"rowId": id})
예제 #4
0
    def delFunctionNode(self, id: str):
        """
        删除功能节点.

        :param id: 要删除的节点id
        :return:
        """
        node = xml.findFirstNode(self.xmlTree, r".//functions")
        self.__delNode(node, {"rowId": id})
예제 #5
0
    def delThreadNode(self, id: str):
        """
        删除线程节点.

        :param id: 要删除的节点id
        :return:
        """
        node = xml.findFirstNode(self.xmlTree, r".//threads")
        self.__delNode(node, {"rowId": id})
예제 #6
0
    def __addNode(self, nodeTag: str, chidNodeTag: str, attrsMap: dict = {}):
        """
        添加子节点.

        :param nodeTag: 当前节点标签
        :param chidNodeTag: 子节点标签
        :param attrsMap: 子节点属性
        :return:
        """
        # 查找节点
        node = xml.findFirstNode(self.xmlTree, r".//%s" % nodeTag)

        # 新建子节点
        childNode = xml.createNode(chidNodeTag, attrsMap)

        # 添加thread节点
        xml.addChildNode(node, childNode)

        # 保存xml文件
        self.saveXml()