def row_from_item(input_tuple): """ Return the table row from an input item """ metabolite, stoichiometry = input_tuple id_item = LinkedItem(metabolite.id, metabolite) id_item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) id_item.setToolTip("Formula: {}\nCharge: {}".format( metabolite.formula, metabolite.charge)) value_item = LinkedItem(link=metabolite) value_item.setData(stoichiometry, 2) return [id_item, value_item]
def row_from_item(reaction): """ Return a table row from the input reaction """ id = LinkedItem(reaction.id, reaction) name = LinkedItem(reaction.name, reaction) reaction_str = LinkedItem(reaction.reaction, reaction) subsystem = LinkedItem(reaction.subsystem, reaction) lower_bound = LinkedItem(link=reaction) lower_bound.setData(reaction.lower_bound, 2) upper_bound = LinkedItem(link=reaction) upper_bound.setData(reaction.upper_bound, 2) obj_coeff = LinkedItem(link=reaction) obj_coeff.setData(reaction.objective_coefficient, 2) return [ id, name, reaction_str, subsystem, lower_bound, upper_bound, obj_coeff ]