Classes para listas de quadros, com itens valorados.
[cascardo/irpf-gui.git] / src / quadros.py
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