Skip to content

Commit bb11376

Browse files
committed
Fix bug where image/recovery selected paths are doubled when reselected and warning that image doesnt work is also doubled when files change.
1 parent 28e89d3 commit bb11376

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

openandroidinstaller/openandroidinstaller.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
from widgets import call_button, confirm_button, get_title, link_button
5757

5858
# Toggle to True for development purposes
59-
DEVELOPMENT = False
60-
DEVELOPMENT_CONFIG = "yuga" # "a3y17lte" # "sargo"
59+
DEVELOPMENT = True
60+
DEVELOPMENT_CONFIG = "sargo" # "a3y17lte" # "sargo"
6161

6262

6363
PLATFORM = sys.platform
@@ -370,11 +370,9 @@ def enable_button_if_ready(self, e):
370370
recovery_path=self.state.recovery_path,
371371
):
372372
# if image and recovery work for device allow to move on, otherwise display message
373-
self.info_field.controls.append(
374-
Text(
375-
"Image and recovery don't work with the device. Please select different ones."
376-
)
377-
)
373+
self.info_field.controls = [
374+
Text("Image and recovery don't work with the device. Please select different ones.")
375+
]
378376
self.right_view.update()
379377
return
380378
self.info_field.controls = []
@@ -506,9 +504,8 @@ def load_config(self, device_code: str) -> Optional[str]:
506504
return self.config.metadata.get("devicename", "No device name in config.")
507505

508506
def pick_image_result(self, e: FilePickerResultEvent):
509-
self.selected_image.value += (
510-
", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
511-
)
507+
path = (", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!")
508+
self.selected_image.value = self.selected_image.value.split(":")[0] + f": {path}"
512509
if e.files:
513510
self.image_path = e.files[0].path
514511
self.state.image_path = e.files[0].path
@@ -518,9 +515,8 @@ def pick_image_result(self, e: FilePickerResultEvent):
518515
self.selected_image.update()
519516

520517
def pick_recovery_result(self, e: FilePickerResultEvent):
521-
self.selected_recovery.value += (
522-
", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
523-
)
518+
path = (", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!")
519+
self.selected_recovery.value = self.selected_recovery.value.split(":")[0] + f": {path}"
524520
if e.files:
525521
self.recovery_path = e.files[0].path
526522
self.state.recovery_path = e.files[0].path

0 commit comments

Comments
 (0)