3838from views import BaseView
3939from app_state import AppState
4040from widgets import get_title , confirm_button
41- from utils import (
42- get_download_link ,
43- image_works_with_device ,
44- recovery_works_with_device
45- )
41+ from utils import get_download_link , image_works_with_device , recovery_works_with_device
4642
4743
4844class SelectFilesView (BaseView ):
@@ -60,7 +56,7 @@ def build(self):
6056 modal = True ,
6157 title = Text ("What is an OS image and recovery and why do I need it?" ),
6258 content = Markdown (
63- """## OS image or ROM
59+ """## OS image or ROM
6460An operating system (OS) is system software that manages computer hardware,
6561software resources, and provides common services for computer programs.
6662Popular, custom operating systems for mobile devices based on Android are
@@ -117,16 +113,20 @@ def build(self):
117113 icon_color = colors .DEEP_ORANGE_500 ,
118114 tooltip = "Get more details on custom operating system images and recoveries." ,
119115 )
120- #info_button = IconButton(
116+ # info_button = IconButton(
121117 # icon=icons.HELP_OUTLINE_OUTLINED,
122118 # icon_color=colors.DEEP_ORANGE_500,
123119 # icon_size=30,
124120 # on_click=self.open_explain_images_dlg,
125121 # tooltip="What is an OS image and a recovery file?",
126- #)
122+ # )
127123 # add title and progressbar
128124 self .right_view .controls .append (
129- get_title ("Now pick an OS image and a recovery file:" , info_button = info_button , step_indicator_img = "steps-header-select.png" )
125+ get_title (
126+ "Now pick an OS image and a recovery file:" ,
127+ info_button = info_button ,
128+ step_indicator_img = "steps-header-select.png" ,
129+ )
130130 )
131131 self .right_view .controls .append (self .state .progressbar )
132132
@@ -195,7 +195,7 @@ def build(self):
195195The recovery image should look something like `twrp-3.6.2_9-0-{ self .state .config .metadata .get ('devicecode' )} .img`.
196196
197197**Note:** This tool **only supports TWRP recoveries**.""" ,
198- extension_set = "gitHubFlavored"
198+ extension_set = "gitHubFlavored" ,
199199 ),
200200 Row (
201201 [
@@ -245,7 +245,9 @@ def pick_image_result(self, e: FilePickerResultEvent):
245245 # check if the image works with the device and show the filename in different colors accordingly
246246 if e .files :
247247 device_code = self .state .config .metadata .get ("devicecode" )
248- if image_works_with_device (device_code = device_code , image_path = self .state .image_path ):
248+ if image_works_with_device (
249+ device_code = device_code , image_path = self .state .image_path
250+ ):
249251 self .selected_image .color = colors .GREEN
250252 else :
251253 self .selected_image .color = colors .RED
@@ -267,7 +269,9 @@ def pick_recovery_result(self, e: FilePickerResultEvent):
267269 # check if the recovery works with the device and show the filename in different colors accordingly
268270 if e .files :
269271 device_code = self .state .config .metadata .get ("devicecode" )
270- if recovery_works_with_device (device_code = device_code , recovery_path = self .state .recovery_path ):
272+ if recovery_works_with_device (
273+ device_code = device_code , recovery_path = self .state .recovery_path
274+ ):
271275 self .selected_recovery .color = colors .GREEN
272276 else :
273277 self .selected_recovery .color = colors .RED
@@ -280,8 +284,13 @@ def enable_button_if_ready(self, e):
280284 ".img" in self .selected_recovery .value
281285 ):
282286 device_code = self .state .config .metadata .get ("devicecode" )
283- if not (image_works_with_device (device_code = device_code , image_path = self .state .image_path )
284- and recovery_works_with_device (device_code = device_code , recovery_path = self .state .recovery_path )
287+ if not (
288+ image_works_with_device (
289+ device_code = device_code , image_path = self .state .image_path
290+ )
291+ and recovery_works_with_device (
292+ device_code = device_code , recovery_path = self .state .recovery_path
293+ )
285294 ):
286295 # if image and recovery work for device allow to move on, otherwise display message
287296 logger .error (
@@ -290,7 +299,8 @@ def enable_button_if_ready(self, e):
290299 self .info_field .controls = [
291300 Text (
292301 "Image and/or recovery don't work with the device. Make sure you use a TWRP-based recovery." ,
293- color = colors .RED , weight = "bold" ,
302+ color = colors .RED ,
303+ weight = "bold" ,
294304 )
295305 ]
296306 self .confirm_button .disabled = True
0 commit comments