diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-11-16 20:45:03 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-11-16 20:45:03 -0600 |
commit | 4b562e5608bde5b2a25be62cd2013683b1216bb1 (patch) | |
tree | ce9ee30f936faed3c3b9091581df5a1953e4fa22 /interfaz/main.py | |
parent | d810c8779b6417dcf418d9837bb5b04376eaa7f9 (diff) | |
download | javanol-4b562e5608bde5b2a25be62cd2013683b1216bb1.tar.gz javanol-4b562e5608bde5b2a25be62cd2013683b1216bb1.tar.bz2 javanol-4b562e5608bde5b2a25be62cd2013683b1216bb1.zip |
Se mejora la impresión de errores
Diffstat (limited to 'interfaz/main.py')
-rw-r--r-- | interfaz/main.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/interfaz/main.py b/interfaz/main.py index 9867e9e..24f96d1 100644 --- a/interfaz/main.py +++ b/interfaz/main.py @@ -94,7 +94,6 @@ class MainWindow(Gtk.ApplicationWindow): notebook.append_page(scrolled, Gtk.Label.new('Símbolos')) def abrir_archivo(self, button): - print('abrir_archivo()') self.open_dialog = Gtk.FileChooserNative.new( title='Abrir archivo', parent=self, @@ -122,25 +121,29 @@ class MainWindow(Gtk.ApplicationWindow): def correr(self, button): self.guardar_archivo(None) + self.limpiar_tabla() if self.input_file: result = subprocess.run([ 'python', compilador_dir, '-i', self.input_file, '-o', self.output_file, '-t' - ], stdout=subprocess.PIPE) + ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output = result.stdout.decode('utf-8') self.msgbuf.set_text(output) - # Tabla de símbolos - with open(self.input_file + '.tab', 'r') as f: - data = f.read() - self.llenar_tabla(data) + if result.returncode == 0: + # Tabla de símbolos + with open(self.input_file + '.tab', 'r') as f: + data = f.read() + self.llenar_tabla(data) - def llenar_tabla(self, data): - tabla = json.loads(data) + def limpiar_tabla(self): for i in range(4): self.tablagrid.remove_column(0) + + def llenar_tabla(self, data): + tabla = json.loads(data) label_linea = Gtk.Label.new(None) label_linea.set_markup('<b>Línea</b>') label_nombre = Gtk.Label.new(None) |