4141from views import BaseView
4242from app_state import AppState
4343from widgets import get_title , confirm_button
44- from utils import get_download_link , image_works_with_device , recovery_works_with_device , image_sdk_level
44+ from utils import (
45+ get_download_link ,
46+ image_works_with_device ,
47+ recovery_works_with_device ,
48+ image_sdk_level ,
49+ )
4550
4651
4752class SelectFilesView (BaseView ):
@@ -104,9 +109,15 @@ def init_visuals(
104109
105110 self .selected_image = Text ("Selected image: " )
106111 self .selected_recovery = Text ("Selected recovery: " )
107- self .selected_dtbo = Checkbox (fill_color = colors .RED , value = None , disabled = True , tristate = True )
108- self .selected_vbmeta = Checkbox (fill_color = colors .RED , value = None , disabled = True , tristate = True )
109- self .selected_super_empty = Checkbox (fill_color = colors .RED , value = None , disabled = True , tristate = True )
112+ self .selected_dtbo = Checkbox (
113+ fill_color = colors .RED , value = None , disabled = True , tristate = True
114+ )
115+ self .selected_vbmeta = Checkbox (
116+ fill_color = colors .RED , value = None , disabled = True , tristate = True
117+ )
118+ self .selected_super_empty = Checkbox (
119+ fill_color = colors .RED , value = None , disabled = True , tristate = True
120+ )
110121
111122 # initialize and manage button state.
112123 self .confirm_button = confirm_button (self .on_confirm )
@@ -133,13 +144,15 @@ def build(self):
133144 )
134145
135146 # attach hidden dialogues
136- self .right_view .controls .extend ([
137- self .pick_image_dialog ,
138- self .pick_recovery_dialog ,
139- self .pick_dtbo_dialog ,
140- self .pick_vbmeta_dialog ,
141- self .pick_super_empty_dialog
142- ])
147+ self .right_view .controls .extend (
148+ [
149+ self .pick_image_dialog ,
150+ self .pick_recovery_dialog ,
151+ self .pick_dtbo_dialog ,
152+ self .pick_vbmeta_dialog ,
153+ self .pick_super_empty_dialog ,
154+ ]
155+ )
143156
144157 # create help/info button to show the help dialog
145158 info_button = OutlinedButton (
@@ -264,14 +277,17 @@ def toggle_additional_image_selection(self):
264277 # attach the controls for uploading others partitions, like dtbo, vbmeta & super_empty
265278 additional_image_selection = []
266279 if self .state .config .metadata ["additional_steps" ]:
267- additional_image_selection .extend ([
280+ additional_image_selection .extend (
281+ [
268282 Text ("Select required additional images:" , style = "titleSmall" ),
269- Markdown ("""
283+ Markdown (
284+ """
270285Your selected device and ROM requires flashing of additional partitions. Please select the required images below.
271286
272287Make sure the file is for **your exact phone model!**""" ,
273- )
274- ])
288+ ),
289+ ]
290+ )
275291 if "dtbo" in self .state .config .metadata ["additional_steps" ]:
276292 self .selected_dtbo .value = False
277293 additional_image_selection .extend (
@@ -372,7 +388,10 @@ def pick_image_result(self, e: FilePickerResultEvent):
372388 else :
373389 self .selected_image .color = colors .RED
374390 # if the image works and the sdk level is 33 or higher, show the additional image selection
375- if self .selected_image .color == colors .GREEN and image_sdk_level (self .state .image_path ) >= 33 :
391+ if (
392+ self .selected_image .color == colors .GREEN
393+ and image_sdk_level (self .state .image_path ) >= 33
394+ ):
376395 self .toggle_additional_image_selection ()
377396 else :
378397 self .additional_image_selection .controls = []
@@ -485,7 +504,14 @@ def enable_button_if_ready(self, e):
485504 return
486505
487506 # check if the additional images work with the device
488- if any (v == False for v in [self .selected_dtbo .value , self .selected_vbmeta .value , self .selected_super_empty .value ]):
507+ if any (
508+ v == False
509+ for v in [
510+ self .selected_dtbo .value ,
511+ self .selected_vbmeta .value ,
512+ self .selected_super_empty .value ,
513+ ]
514+ ):
489515 logger .error (
490516 "Some additional images don't match. Please select different ones."
491517 )
0 commit comments