From: Thadeu Lima de Souza Cascardo Date: Mon, 13 May 2013 11:51:28 +0000 (-0300) Subject: Rendimentos PJ: permite adicionar fonte pagadora X-Git-Url: http://git.cascardo.info/?p=cascardo%2Firpf-gui.git;a=commitdiff_plain;h=bfef3f772c6c787190004dea89caf1e3acddbf84 Rendimentos PJ: permite adicionar fonte pagadora Uma nova fonte pagadora pode ser criada, ter seus atributos definidos, e adicionada à lista de rendimentos de PJ. --- diff --git a/src/rendimentoPJ.py b/src/rendimentoPJ.py index ddd3318..64d5844 100644 --- a/src/rendimentoPJ.py +++ b/src/rendimentoPJ.py @@ -18,8 +18,11 @@ import xml.dom.minidom from contribuinte import Contribuinte class RendimentoPJ: - def __init__(self, el): - self.rendimento = el + def __init__(self, el = None): + if el == None: + self.rendimento = xml.dom.minidom.Element("item") + else: + self.rendimento = el def get_attr(self, attr): if attr in self.rendimento.attributes.keys(): @@ -27,7 +30,7 @@ class RendimentoPJ: return None def set_attr(self, attr, val): - self.rendimento.attributes[attr].nodeValue = val + self.rendimento.setAttribute(attr, val) class RendimentosPJ: def __init__(self, contribuinte): @@ -53,6 +56,10 @@ class RendimentosPJ: def set_colecao(self, attr, val): self._set_attr(self.colecao, attr, val) + def add_item(self, item): + self.items.append(item) + self.colecao.appendChild(item.rendimento) + if __name__ == '__main__': import sys