2323from flet import (AlertDialog , AppBar , Banner , Checkbox , Column , Container ,
2424 Divider , ElevatedButton , FilePicker , FilePickerResultEvent ,
2525 FilledButton , Icon , Image , Page , ProgressBar , ProgressRing ,
26- Row , Text , TextButton , TextField , UserControl ,
26+ Row , Text , TextButton , TextField , UserControl , FloatingActionButton ,
2727 VerticalDivider , colors , icons )
2828from installer_config import InstallerConfig , Step , _load_config
2929from loguru import logger
@@ -48,7 +48,7 @@ def __init__(self, image: str = "placeholder.png"):
4848 super ().__init__ ()
4949 self .right_view = Column (expand = True )
5050 self .left_view = Column (
51- width = 480 ,
51+ width = 600 ,
5252 controls = [Image (src = IMAGE_PATH .joinpath (Path (image )))],
5353 expand = True ,
5454 horizontal_alignment = "center" ,
@@ -361,11 +361,11 @@ def __init__(self):
361361 self .state = AppState ()
362362 # initialize the progress bar indicator
363363 self .progress_bar = ProgressBar (
364- width = 480 , color = "#00d886" , bgcolor = "#eeeeee" , bar_height = 16
364+ width = 600 , color = "#00d886" , bgcolor = "#eeeeee" , bar_height = 16
365365 )
366366 self .progress_bar .value = 0
367367 # create the main columns
368- self .view = Column (expand = True , width = 800 )
368+ self .view = Column (expand = True , width = 1200 )
369369 # initialize global stuff
370370 # file pickers
371371 self .pick_image_dialog = FilePicker (on_result = self .pick_image_result )
@@ -578,10 +578,10 @@ def main(page: Page):
578578 logger .info (f"Running OpenAndroidInstaller on { PLATFORM } " )
579579 # Configure the application base page
580580 page .title = "OpenAndroidInstaller"
581- page .window_height = 720
582- page .window_width = int (1.5 * page .window_height )
581+ page .window_height = 780
582+ page .window_width = int (1.77 * page .window_height )
583583 page .window_top = 100
584- page .window_left = 720
584+ page .window_left = 120
585585 page .scroll = "adaptive"
586586 page .horizontal_alignment = "center"
587587
@@ -632,6 +632,21 @@ def close_banner(e):
632632 # create application instance
633633 app = MainView ()
634634
635+ # add a button that restarts the process
636+ def restart_process (e ):
637+ logger .info ("Restarted the process. Reset everything." )
638+ page .controls .pop ()
639+ app = MainView ()
640+ page .add (app )
641+ page .update ()
642+
643+ page .floating_action_button = FloatingActionButton (
644+ text = "Restart the process" ,
645+ icon = icons .RESTART_ALT_OUTLINED ,
646+ tooltip = "You can safely restart if you missed a step or didn't make it." ,
647+ on_click = restart_process ,
648+ )
649+
635650 # add application's root control to the page
636651 page .add (app )
637652
0 commit comments