Skip to content

Commit 35a610e

Browse files
committed
WIP restructure select-view
1 parent 5478ab3 commit 35a610e

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

openandroidinstaller/views/select_view.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Markdown,
2525
Row,
2626
Text,
27+
IconButton,
2728
colors,
2829
icons,
2930
TextButton,
@@ -104,24 +105,20 @@ def build(self):
104105
# attach hidden dialogues
105106
self.right_view.controls.append(self.pick_image_dialog)
106107
self.right_view.controls.append(self.pick_recovery_dialog)
108+
109+
# create help/info button to show the help dialog
110+
info_button = IconButton(
111+
icon=icons.HELP_OUTLINE_OUTLINED,
112+
icon_color="blue400",
113+
icon_size=20,
114+
on_click=self.open_explain_images_dlg,
115+
tooltip="What is an OS image and a recovery file?",
116+
)
107117
# add title and progressbar
108118
self.right_view.controls.append(
109-
get_title("Now pick an OS image and a recovery file:")
119+
get_title("Now pick an OS image and a recovery file:", info_button=info_button)
110120
)
111121
self.right_view.controls.append(self.state.progressbar)
112-
# button to show the explainaition dialoge
113-
self.right_view.controls.append(
114-
Row(
115-
[
116-
ElevatedButton(
117-
"What is an OS image and a recovery file?",
118-
on_click=self.open_explain_images_dlg,
119-
expand=True,
120-
tooltip="Get some details about those files and why you need them.",
121-
)
122-
]
123-
)
124-
)
125122

126123
# text row to show infos during the process
127124
self.info_field = Row()
@@ -154,26 +151,22 @@ def build(self):
154151
),
155152
]
156153
),
157-
Markdown(
158-
f"""
159-
The image file should look something like `lineage-19.1-20221101-nightly-{self.state.config.metadata.get('devicecode')}-signed.zip`
160-
and the recovery like `twrp-3.6.2_9-0-{self.state.config.metadata.get('devicecode')}.img`. Note that this tool only supports TWRP recoveries for now.
161-
"""
162-
),
163154
Divider(),
164155
]
165156
)
166157
)
167158
# attach the controls for uploading image and recovery
168159
self.right_view.controls.extend(
169160
[
170-
Text(
171-
"Now select the operating system image and recovery (note, that only TWRP recoveries are supported):"
161+
Text("Select an OS image:", style="titleSmall"),
162+
Markdown(
163+
f"""
164+
The image file should look something like `lineage-19.1-20221101-nightly-{self.state.config.metadata.get('devicecode')}-signed.zip`."""
172165
),
173166
Row(
174167
[
175168
ElevatedButton(
176-
"Pick image file",
169+
"Pick OS image",
177170
icon=icons.UPLOAD_FILE,
178171
on_click=lambda _: self.pick_image_dialog.pick_files(
179172
allow_multiple=False,
@@ -185,6 +178,13 @@ def build(self):
185178
]
186179
),
187180
self.selected_image,
181+
Divider(),
182+
Text("Select a recovery image:", style="titleSmall"),
183+
Markdown(
184+
f"""
185+
The recovery image should look something like `twrp-3.6.2_9-0-{self.state.config.metadata.get('devicecode')}.img`.
186+
Note that this tool only supports TWRP recoveries for now."""
187+
),
188188
Row(
189189
[
190190
ElevatedButton(

openandroidinstaller/widgets.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
from functools import partial
1818
from typing import Callable
1919

20-
from flet import Container, ElevatedButton, Row, Text, alignment, icons
20+
from flet import Container, ElevatedButton, Row, Text, alignment, icons, IconButton
2121

2222

23-
def get_title(title: str):
23+
def get_title(title: str, info_button: IconButton=None) -> Container:
24+
if info_button:
25+
content = [Text(f"{title}", style="titleMedium"), info_button]
26+
else:
27+
content = [Text(f"{title}", style="titleMedium")]
2428
return Container(
25-
content=Row(
26-
[
27-
Text(f"{title}", style="titleMedium"),
28-
]
29-
),
29+
content=Row(content),
3030
margin=0,
3131
padding=0,
3232
alignment=alignment.center,

0 commit comments

Comments
 (0)