Skip to content

Commit 9c09b5f

Browse files
committed
Use switches in welcome view
1 parent c537f97 commit 9c09b5f

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

openandroidinstaller/openandroidinstaller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
import webbrowser
1919
from pathlib import Path
2020

21-
import flet
21+
import flet as ft
2222
from app_state import AppState
2323
from flet import (
2424
AppBar,
2525
Banner,
2626
Column,
2727
Container,
2828
ElevatedButton,
29+
CircleAvatar,
2930
FloatingActionButton,
3031
Icon,
3132
Image,
@@ -217,4 +218,4 @@ def restart_process(e):
217218
page.add(app)
218219

219220

220-
flet.app(target=main, assets_dir="assets")
221+
ft.app(target=main, assets_dir="assets")

openandroidinstaller/views.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
AlertDialog,
2424
alignment,
2525
Checkbox,
26+
Switch,
2627
Column,
2728
Container,
2829
Divider,
@@ -251,10 +252,10 @@ def build(self):
251252
],
252253
actions_alignment="end",
253254
)
254-
# checkbox to allow skipping unlocking the bootloader
255+
# toggleswitch to allow skipping unlocking the bootloader
255256
def check_bootloader_unlocked(e):
256257
"""Enable skipping unlocking the bootloader if selected."""
257-
if self.bootloader_checkbox.value:
258+
if self.bootloader_switch.value:
258259
logger.info("Skipping bootloader unlocking.")
259260
self.state.steps = (
260261
self.state.config.flash_recovery + self.state.config.install_os
@@ -269,25 +270,25 @@ def check_bootloader_unlocked(e):
269270
)
270271
self.state.num_total_steps = len(self.state.steps)
271272

272-
self.bootloader_checkbox = Checkbox(
273+
self.bootloader_switch = Switch(
273274
label="Bootloader is already unlocked.",
274275
on_change=check_bootloader_unlocked,
275276
disabled=True,
276277
)
277278

278-
# checkbox to enable advanced output - here it means show terminal input/output in tool
279-
def check_advanced_box(e):
279+
# switch to enable advanced output - here it means show terminal input/output in tool
280+
def check_advanced_switch(e):
280281
"""Check the box to enable advanced output."""
281-
if self.advanced_checkbox.value:
282+
if self.advanced_switch.value:
282283
logger.info("Enable advanced output.")
283284
self.state.advanced = True
284285
else:
285286
logger.info("Disable advanced output.")
286287
self.state.advanced = False
287288

288-
self.advanced_checkbox = Checkbox(
289+
self.advanced_switch = Switch(
289290
label="Advanced output",
290-
on_change=check_advanced_box,
291+
on_change=check_advanced_switch,
291292
disabled=False,
292293
)
293294

@@ -347,7 +348,7 @@ def check_advanced_box(e):
347348
Column(
348349
[
349350
self.device_detection_infobox,
350-
Row([self.bootloader_checkbox, self.advanced_checkbox]),
351+
Row([self.bootloader_switch, self.advanced_switch]),
351352
]
352353
),
353354
Row(
@@ -421,7 +422,7 @@ def search_devices(self, e):
421422
# display success in the application
422423
if device_name:
423424
self.continue_button.disabled = False
424-
self.bootloader_checkbox.disabled = False
425+
self.bootloader_switch.disabled = False
425426
# overwrite the text field with the real name from the config
426427
self.device_name.value = f"{device_name} (code: {device_code})"
427428
self.device_name.color = colors.GREEN

0 commit comments

Comments
 (0)