1
1
import flet as ft
2
+ import os
3
+ import services .lectura_fichero as lf
2
4
class vista :
3
-
4
-
5
- def __init__ (self ) -> None :
5
+ def __init__ (self ,page :ft .Page ) -> None :
6
+ self .page = page
6
7
# self.text = ft.TextField(width=200,height=200,multiline=True)
7
8
# self.table = ft.DataTable(columns=[ft.Text("1"),ft.Text("2")])
8
9
#Botones :
9
- self .btn_dec_asig = ft .ElevatedButton (text = "Declaración y asignación" ,width = 250 ,on_click = self .hola )
10
- self .btn_io = ft .ElevatedButton ("IO" ,width = 250 )
11
- self .btn_lexico = ft .ElevatedButton ("Analisis Lexico" ,width = 250 )
12
- self .btn_borrar = ft .ElevatedButton ("Borrar" ,width = 250 )
13
- self .btn_archivo = ft .ElevatedButton ("Cargar archivo" ,width = 250 )
10
+ self .btn_dec_asig = ft .ElevatedButton (text = "Declaración y asignación" ,width = 250 ,on_click = self .action_btn_dec_asig )
11
+ self .btn_io = ft .ElevatedButton ("IO" ,width = 250 , on_click = self . action_btn_io )
12
+ self .btn_lexico = ft .ElevatedButton ("Analisis Lexico" ,width = 250 , on_click = self . action_analisis_lexico )
13
+ self .btn_borrar = ft .ElevatedButton ("Borrar" ,width = 250 , on_click = self . action_borrar )
14
+ self .btn_archivo = ft .ElevatedButton ("Cargar archivo" ,width = 250 , on_click = self . action_carga_archivo )
14
15
15
16
16
17
#TextAreas
@@ -50,25 +51,41 @@ def __init__(self) -> None:
50
51
margin = 5 ,
51
52
padding = 5
52
53
)
53
- ft .app (self .main )
54
-
54
+ self .main ()
55
55
56
- def main (self , page : ft . Page ) -> None :
57
- page .window_resizable = False
58
- page .window_height = 700
59
- page .window_width = 1500
60
- page .add (self .c_buttons )
61
- page .add (
56
+ def main (self ) -> None :
57
+ self . page .window_resizable = False
58
+ self . page .window_height = 700
59
+ self . page .window_width = 1500
60
+ self . page .add (self .c_buttons )
61
+ self . page .add (
62
62
ft .Row (
63
63
[
64
64
self .c_text_input ,
65
65
self .c_text_output
66
66
]
67
67
)
68
68
)
69
- page .title = "Analizador lexico"
70
- page .update ()
69
+ self . page .title = "Analizador lexico"
70
+ self . page .update ()
71
71
72
- #funciones de eventos
73
- def hola (self ,e )-> None :
74
- print ("hola" )
72
+ #funciones de eventos ----------------------------------------------------------
73
+
74
+ def action_btn_dec_asig (self ,e )-> None :
75
+ res = lf .leer_fichero ("src/resources/prueba2.txt" )
76
+ self .text_input .value = res
77
+ self .page .update ()
78
+ def action_btn_io (self ,e )-> None :
79
+ print ("IO" )
80
+
81
+ def action_analisis_lexico (self ,e )-> None :
82
+ print ("analisis lexico" )
83
+
84
+ def action_borrar (self ,e )-> None :
85
+ print ("borrar" )
86
+
87
+ def action_carga_archivo (self ,e )-> None :
88
+ print ("carga archivo" )
89
+ #fin fucniones de eventos ------------------------------------------------------------
90
+
91
+
0 commit comments