Bug fixes
authorJakob Cornell <jakob+gpg@jcornell.net>
Sun, 12 Jan 2020 20:16:31 +0000 (14:16 -0600)
committerJakob Cornell <jakob+gpg@jcornell.net>
Sun, 12 Jan 2020 20:16:31 +0000 (14:16 -0600)
main.py

diff --git a/main.py b/main.py
index 69abf53701aca63880ecf7949cd4ee18da546490..0aacfebd894ca88365cc426cfc0f0d40eb81a5fb 100644 (file)
--- a/main.py
+++ b/main.py
@@ -312,6 +312,8 @@ class MainView(View):
 
                def on_gen_table():
                        from xml.etree import ElementTree
+                       Elem = ElementTree.Element
+                       SubElem = ElementTree.SubElement
 
                        name = self.controller.state['student']
                        head = list(DataEditModel.Record.DISPLAY_NAMES)
@@ -326,17 +328,17 @@ class MainView(View):
                                for row in rows
                        ]
 
-                       table = Et.Element('table')
-                       thead = Et.SubElement(table, 'thead')
+                       table = Elem('table')
+                       thead = SubElem(table, 'thead')
                        for v in head:
-                               Et.SubElement(thead, 'th').text = v
-                       tbody = Et.SubElement(table, 'tbody')
+                               SubElem(thead, 'th').text = v
+                       tbody = SubElem(table, 'tbody')
                        for row in rows:
-                               tr = Et.SubElement(tbody, 'tr')
+                               tr = SubElem(tbody, 'tr')
                                for v in row:
-                                       Et.SubElement(tr, 'td').text = v
+                                       SubElem(tr, 'td').text = v
 
-                       win_write_clipboard_html(Et.dump(table))
+                       win_write_clipboard_html(ElementTree.tostring(table))
                self.gen_table_btn = ttk.Button(actions_frame, text = "Copy table to clipboard", command = on_gen_table)
 
                self.student_sel.pack(**TK_PAD, side = tk.LEFT)