aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-15 08:08:06 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-15 08:08:06 -0600
commitc78465010691d45f5e5bfa6a36a96800d30962ac (patch)
tree93521b0c9788712823937e4c48212bc02f0b04b5 /main.py
parenta3097d32c66cbdff04de14481923c7464b0a8a29 (diff)
downloadjavanol-c78465010691d45f5e5bfa6a36a96800d30962ac.tar.gz
javanol-c78465010691d45f5e5bfa6a36a96800d30962ac.tar.bz2
javanol-c78465010691d45f5e5bfa6a36a96800d30962ac.zip
Se elimina código de interfaz y se reorganizan directorios
Diffstat (limited to 'main.py')
-rw-r--r--main.py92
1 files changed, 0 insertions, 92 deletions
diff --git a/main.py b/main.py
deleted file mode 100644
index c541b16..0000000
--- a/main.py
+++ /dev/null
@@ -1,92 +0,0 @@
-import sys, getopt
-from tkinter import *
-from tkinter import ttk, filedialog
-from lexer import *
-
-class Main:
- input_file = None
- output_file = None
-
- # GUI widgets
- text = None
- msgarea = None
- symbols = None
-
- def abrir_archivo(self):
- self.input_file = filedialog.askopenfilename()
- with open(self.input_file) as f:
- data = f.read()
- self.text.insert(END, data)
-
- def guardar_archivo(self):
- data = self.text.get('1.0', 'end-1c')
- with open(self.input_file, "r+") as f:
- f.truncate(0)
- f.write(data)
-
- def compilar_programa(self):
- self.output_file = filedialog.asksaveasfilename()
- data = self.text.get('1.0', 'end-1c')
- Lexer(data).inicio()
-
- def ejecutar_programa(self):
- print('ejecutar_programa()')
-
- def salir(self):
- exit(0)
-
- def main_gui(self, argv):
- root = Tk()
- root.title ("Javañol")
- root.columnconfigure(0, weight=1)
- root.rowconfigure(0, weight=1)
- root.option_add('*tearOff', FALSE)
-
- mainframe = ttk.Frame(root, padding="3 3 12 12")
- mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
- mainframe.columnconfigure(0, weight=1)
- mainframe.rowconfigure(0, weight=1)
- mainframe.rowconfigure(1, weight=0)
-
- # Menú
- menubar = Menu(root)
- root['menu'] = menubar
-
- menu_file = Menu(menubar)
- menubar.add_cascade(menu=menu_file, label='Archivo')
- menu_file.add_command(label='Abrir', command=self.abrir_archivo)
- menu_file.add_command(label='Guardar', command=self.guardar_archivo)
- menu_file.add_command(label='Salir', command=self.salir)
-
- menu_program = Menu(menubar)
- menubar.add_cascade(menu=menu_program, label='Programa')
- menu_program.add_command(label='Compilar', command=self.compilar_programa)
- menu_program.add_command(label='Ejecutar', command=self.ejecutar_programa)
-
- # Editor de código
- self.text = Text(mainframe)
- self.text.grid(column=0, row=0, sticky=(N, W, E, S))
-
- # Área de mensajes
- msgarealf = LabelFrame(mainframe, text='Área de mensajes', height=10)
- msgarealf.grid(column=0, row=1, sticky=(W, E, S))
-
- self.msgarea = Text(msgarealf, height=10)
- self.msgarea.grid(column=0, row=0, sticky=(N, W, E, S))
- self.msgarea.rowconfigure(0, weight=1)
- self.msgarea.columnconfigure(0, weight=1)
-
- # Tabla de símbolos
- symbolslf = LabelFrame(mainframe, text='Símbolos', width=100)
- symbolslf.grid(column=1, row=0, rowspan=2, sticky=(N, W, E, S))
-
- self.symbols = Text(symbolslf, width=20)
- self.symbols.grid(column=0, row=0, sticky=(N, W, E, S))
- self.msgarea.rowconfigure(0, weight=1)
- self.msgarea.columnconfigure(0, weight=1)
-
- root.mainloop()
-
-if __name__ == "__main__":
- main = Main()
- main.main_gui(sys.argv)