diff --git a/Tabs.py b/Tabs.py index fdacf48..63c2bb4 100644 --- a/Tabs.py +++ b/Tabs.py @@ -18,11 +18,12 @@ def __init__(self): self.text = "Franquicias" self.mi_data_table = ft.DataTable( columns=[ - ft.DataColumn(ft.Text("Tipo de Vehículo", weight=ft.FontWeight.BOLD), tooltip="Tipo de Vehículo"), - ft.DataColumn(ft.Text("% Suma Asegurada", weight=ft.FontWeight.BOLD), tooltip="% Suma Asegurada"), - ft.DataColumn(ft.Text("Monto mínimo de Franquicia", weight=ft.FontWeight.BOLD), tooltip="Monto mínimo de Franquicia"), + ft.DataColumn(ft.Text(expand=True,value="Tipo de Vehículo", weight=ft.FontWeight.BOLD), tooltip="Tipo de Vehículo"), + ft.DataColumn(ft.Text(expand=True,value="% Suma Asegurada", weight=ft.FontWeight.BOLD), tooltip="% Suma Asegurada"), + ft.DataColumn(ft.Text(expand=True,value="Monto mínimo de Franquicia", weight=ft.FontWeight.BOLD), tooltip="Monto mínimo de Franquicia"), ], rows=[], + expand=True, ) for i, franquicia in enumerate(self.franquicias): diff --git a/Widgets.py b/Widgets.py index eaa9f2a..a9368df 100644 --- a/Widgets.py +++ b/Widgets.py @@ -5,6 +5,7 @@ class CalculadoraPremio(ft.Container): def update_premio(self, e): # Aplicar el descuento del 15% + self.sonido.play() if self.text_field_premio.value == '': self.valor_final.value = "0" self.valor_final.update() @@ -27,19 +28,27 @@ def slider_handle(self, e): self.slider.label = "Descuento: " + str(int(self.slider.value)) + "%" self.slider.update() self.update_premio(e) + self.sonido.play() def copy_premio(self, e): + self.copy_sound.play() self.page.set_clipboard(self.valor_final.value) self.sb_copiado.open = True self.page.update() def did_mount(self): self.page.overlay.append(self.sb_copiado) + self.page.overlay.append(self.sonido) + self.page.overlay.append(self.copy_sound) + self.page.update() return super().did_mount() def __init__(self): super().__init__() + self.sonido = ft.Audio(src="bamboo.mp3") + self.copy_sound = ft.Audio(src="copy.mp3") + self.sb_copiado = ft.SnackBar( content=ft.Text("Copiado al portapapeles"), bgcolor=ft.colors.GREEN @@ -56,13 +65,18 @@ def __init__(self): label="Descuento: 15%", ) - self.valor_final = ft.Text("0", size=30) + self.valor_final = ft.Text("0", size=40, expand=True, text_align=ft.TextAlign.CENTER) self.text_field_premio = ft.TextField( label="Premio", prefix_icon=ft.icons.ATTACH_MONEY_ROUNDED, hint_text="Ingresa el premio", - on_change=self.update_premio + on_change=self.update_premio, + input_filter=ft.InputFilter( + regex_string=r"[0-9]", + allow=True, + replacement_string="", + ) ) self.boton_copiar = ft.ElevatedButton( content=ft.Row( diff --git a/assets/bamboo.mp3 b/assets/bamboo.mp3 new file mode 100644 index 0000000..a1ad34a Binary files /dev/null and b/assets/bamboo.mp3 differ diff --git a/assets/copy.mp3 b/assets/copy.mp3 new file mode 100644 index 0000000..1a0bdd5 Binary files /dev/null and b/assets/copy.mp3 differ diff --git a/assets/copy.wav b/assets/copy.wav new file mode 100644 index 0000000..2841ba5 Binary files /dev/null and b/assets/copy.wav differ diff --git a/main.py b/main.py index 333125c..a76c9c4 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,7 @@ def change_color(): page.add( ft.Tabs( - [ + tabs=[ ft.Tab( text="Federación Patronal", content=ft.Tabs( @@ -67,4 +67,4 @@ def change_color(): -ft.app(main, assets_dir="assets", view=ft.AppView.WEB_BROWSER) \ No newline at end of file +ft.app(main, assets_dir="assets") \ No newline at end of file