Classes para listas de quadros, com itens valorados.
authorThadeu Lima de Souza Cascardo <cascardo@cascardo.info>
Sun, 23 Mar 2014 20:30:55 +0000 (17:30 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@cascardo.info>
Sun, 23 Mar 2014 20:30:55 +0000 (17:30 -0300)
Ao invés de uma lista de itens com um código, rendimentos isentos ou
tributados exclusivamente na fonte possuem vários quadros, representando
diferentes formas de rendimento (poupança, ações, etc), sendo cada
quadro uma lista de itens com especificação e valor apenas.

src/quadros.py [new file with mode: 0644]

diff --git a/src/quadros.py b/src/quadros.py
new file mode 100644 (file)
index 0000000..216f11c
--- /dev/null
@@ -0,0 +1,39 @@
+# coding=utf-8
+#
+#   Copyright 2013 Thadeu Lima de Souza Cascardo <cascardo@cascardo.info>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# -*- mode: python; encoding: utf-8; -*-
+
+import xml.dom.minidom
+import items
+from form import AttrForm
+
+class Quadro(items.Items):
+    def __init__(self, name, el):
+        self.name = name
+        items.Items.__init__(self, el)
+    def form(self, item):
+        f = []
+        f.append(AttrForm(u"Descrição", "especificacao", item))
+        f.append(AttrForm(u"Valor", "valor", item))
+        return f
+
+class Quadros:
+    def __init__(self, el, subels):
+        self.quadros = []
+        for i in subels:
+            self.quadros.append(Quadro(i[0], el.getElementsByTagName(i[1])[0]))
+
+# vim:tabstop=4:expandtab:smartindent