Exemplo n.º 1
0
def iterate_tree(standard_item, data_item):
    for n, element in enumerate(
            sorted(data_item.children, key=lambda x: x.name)):
        gene_item = LinkedItem(element.name, element)
        gene_item.setEditable(False)
        standard_item.setChild(n, gene_item)
        iterate_tree(gene_item, element)
Exemplo n.º 2
0
    def add_gene(self, gene):
        """ Buffer the addition of a gene to the genegroup and change the model"""
        table_item, model_item = self.get_selected_item()

        new_item = LinkedItem(text=gene.id, link=gene)
        new_item.setEditable(False)
        table_item.appendRow(new_item)
        self.cached_actions.append((model_item, "addition", gene))
        self.changed.emit()
Exemplo n.º 3
0
def iterate_tree(standard_item, data_item):
    for n, element in enumerate(data_item._children):
        if isinstance(element, Gene):
            gene_item = LinkedItem(element.id, element)
            gene_item.setEditable(False)
            standard_item.setChild(n, gene_item)
        elif isinstance(element, GeneGroup):
            new_item = LinkedItem(str(element.type).upper(), element)
            new_item.setEditable(False)
            iterate_tree(new_item, element)
            standard_item.setChild(n, new_item)
Exemplo n.º 4
0
    def add_genegroup(self):
        """ Buffer the addition of a genegroup to the genegroup and change the model"""
        # Get current item
        table_item, model_item = self.get_selected_item()

        new_group = GeneGroup()
        new_item = LinkedItem(text=str(new_group.type).upper(), link=new_group)
        new_item.setEditable(False)
        table_item.appendRow(new_item)

        # Buffer the function call for when user accepts dialog
        self.cached_actions.append((model_item, "addition", new_group))
        self.changed.emit()