Skip to content

Commit 6daa796

Browse files
committed
Remove step-progressbar and move the header to different column container to keep it attachted to the top
1 parent 7c808ad commit 6daa796

9 files changed

Lines changed: 33 additions & 60 deletions

File tree

openandroidinstaller/app_state.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,15 @@ def __init__(
2727
platform: str,
2828
config_path: Path,
2929
bin_path: Path,
30-
progressbar: ProgressBar,
31-
num_steps: int,
3230
test: bool = False,
3331
test_config: str = None,
3432
):
3533
self.platform = platform
3634
self.config_path = config_path
3735
self.bin_path = bin_path
38-
self.progressbar = progressbar
39-
self.num_steps = num_steps # keep track of the steps already taken
4036
self.test = test
4137
self.test_config = test_config
4238

43-
# initialize the progress bar at 0
44-
self.progressbar.value = 0
45-
4639
# placeholders
4740
self.advanced = False
4841
self.config = None
@@ -60,12 +53,4 @@ def load_config(self, device_code: str):
6053
self.config.unlock_bootloader
6154
+ self.config.flash_recovery
6255
+ self.config.install_os
63-
)
64-
self.num_total_steps = len(self.steps)
65-
66-
def increment_progressbar(self):
67-
"""Increment the progressbar and step counter."""
68-
self.progressbar.value = (self.num_steps - 1) / (
69-
self.num_total_steps + 3
70-
) # don't show on the first step
71-
self.num_steps += 1 # increase the step counter
56+
)

openandroidinstaller/openandroidinstaller.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ def __init__(self):
7171
platform=PLATFORM,
7272
config_path=CONFIG_PATH,
7373
bin_path=BIN_PATH,
74-
progressbar=ProgressBar(
75-
width=600, color="#00d886", bgcolor="#eeeeee", bar_height=16
76-
),
77-
num_steps=2,
7874
test=DEVELOPMENT,
7975
test_config=DEVELOPMENT_CONFIG,
8076
)
@@ -119,9 +115,6 @@ def confirm(self, e):
119115
"""Confirmation event handler to use in views."""
120116
# remove all elements from column view
121117
self.view.controls = []
122-
# if a config is loaded, display a progress bar
123-
if self.state.config:
124-
self.state.increment_progressbar()
125118
# if there are default views left, display them first
126119
if self.default_views:
127120
self.view.controls.append(self.default_views.pop())
@@ -160,8 +153,8 @@ def main(page: Page):
160153
logger.info(100 * "-")
161154
# Configure the application base page
162155
page.title = "OpenAndroidInstaller"
163-
page.window_height = 820
164-
page.window_width = int(1.77 * page.window_height)
156+
page.window_height = 900
157+
page.window_width = int(1.5 * page.window_height)
165158
page.window_top = 100
166159
page.window_left = 120
167160
page.scroll = "adaptive"

openandroidinstaller/views/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ class BaseView(UserControl):
2828
def __init__(self, state: AppState, image: str = "placeholder.png"):
2929
super().__init__()
3030
self.state = state
31+
32+
# configs
33+
column_width = 600
3134
# right part of the display, add content here.
32-
self.right_view = Column(expand=True)
35+
self.right_view_header = Column(width=column_width, height=100, spacing=30)
36+
self.right_view = Column(alignment="center", width=column_width, height=650)
3337
# left part of the display: used for displaying the images
3438
self.left_view = Column(
35-
width=600,
39+
width=column_width,
3640
controls=[Image(src=f"/assets/imgs/{image}", height=600)],
3741
expand=True,
3842
horizontal_alignment="center",
3943
)
4044
# main view row
4145
self.view = Row(
42-
[self.left_view, VerticalDivider(), self.right_view],
46+
[self.left_view, VerticalDivider(), Column(expand=True, controls=[self.right_view_header, self.right_view])],
4347
alignment="spaceEvenly",
4448
)

openandroidinstaller/views/requirements_view.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ def build(self):
105105
)
106106

107107
# build up the main view
108+
self.right_view_header.controls = [
109+
get_title(
110+
"Check the Requirements",
111+
step_indicator_img="steps-header-requirements.png",
112+
),
113+
]
108114
self.right_view.controls.extend(
109115
[
110-
get_title(
111-
"Check the Requirements",
112-
step_indicator_img="steps-header-requirements.png",
113-
),
114116
Text(
115117
"Before continuing you need to check some requirements to progress. Please read the instructions and check the boxes if everything is fine."
116118
),

openandroidinstaller/views/select_view.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,15 @@ def build(self):
113113
icon_color=colors.DEEP_ORANGE_500,
114114
tooltip="Get more details on custom operating system images and recoveries.",
115115
)
116-
# info_button = IconButton(
117-
# icon=icons.HELP_OUTLINE_OUTLINED,
118-
# icon_color=colors.DEEP_ORANGE_500,
119-
# icon_size=30,
120-
# on_click=self.open_explain_images_dlg,
121-
# tooltip="What is an OS image and a recovery file?",
122-
# )
123-
# add title and progressbar
124-
self.right_view.controls.append(
116+
117+
# add title
118+
self.right_view_header.controls.append(
125119
get_title(
126120
"Now pick an OS image and a recovery file:",
127121
info_button=info_button,
128122
step_indicator_img="steps-header-select.png",
129123
)
130124
)
131-
self.right_view.controls.append(self.state.progressbar)
132125

133126
# text row to show infos during the process
134127
self.info_field = Row()

openandroidinstaller/views/start_view.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,16 @@ def check_bootloader_unlocked(e):
110110
)
111111

112112
# build up the main view
113-
self.right_view.controls.extend(
113+
self.right_view_header.controls.extend(
114114
[
115115
get_title(
116116
"Get the phone ready",
117117
step_indicator_img="steps-header-get-ready.png",
118-
),
118+
)
119+
]
120+
)
121+
self.right_view.controls.extend(
122+
[
119123
Markdown(
120124
"""
121125
To get started you need to

openandroidinstaller/views/step_view.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ def check_advanced_switch(e):
106106
"Flash custom recovery": "steps-header-recovery.png",
107107
"Install OS": "steps-header-install.png",
108108
}
109-
self.right_view.controls = [
109+
self.right_view_header.controls = [
110110
get_title(
111111
f"{self.step.title}",
112112
step_indicator_img=steps_indictor_img_lookup.get(self.step.title),
113-
),
114-
self.state.progressbar,
113+
)
114+
]
115+
self.right_view.controls = [
115116
Text(f"{self.step.content}"),
116117
]
117118
# basic view depending on step.type
@@ -191,12 +192,6 @@ def call_to_phone(self, e, command: str):
191192
# reset terminal output
192193
if self.state.advanced:
193194
self.terminal_box.clear()
194-
# display a progress bar to show something is happening
195-
progress_bar = Row(
196-
[ProgressBar(width=600, color="#00d886", bgcolor="#eeeeee", bar_height=16)],
197-
alignment="center",
198-
)
199-
self.right_view.controls.append(progress_bar)
200195
self.right_view.update()
201196

202197
# get the appropriate function to run for every possible command.
@@ -243,15 +238,11 @@ def call_to_phone(self, e, command: str):
243238
if not success:
244239
# enable call button to retry
245240
self.call_button.disabled = False
246-
# pop the progress bar
247-
self.right_view.controls.remove(progress_bar)
248241
# also remove the last error text if it happened
249242
self.error_text.value = f"Command {command} failed! Try again or make sure everything is setup correctly."
250243
else:
251244
sleep(5) # wait to make sure everything is fine
252245
logger.success(f"Command {command} run successfully. Allow to continue.")
253-
# pop the progress bar
254-
self.right_view.controls.remove(progress_bar)
255246
# emable the confirm buton and disable the call button
256247
self.confirm_button.disabled = False
257248
self.call_button.disabled = True

openandroidinstaller/views/success_view.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ def close_window(e):
3636
logger.success("Success! Close the window.")
3737
self.page.window_close()
3838

39-
self.right_view.controls = [
39+
self.right_view_header.controls = [
4040
get_title("Installation completed successfully!"),
41-
self.state.progressbar,
41+
]
42+
self.right_view.controls = [
4243
Text("Now your devices boots into the new OS. Have fun with it!"),
4344
Row(
4445
[

openandroidinstaller/views/welcome_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def build(self):
4848
)
4949

5050
# build up the main view
51+
self.right_view_header.controls.extend([get_title("Welcome to the OpenAndroidInstaller!")])
5152
self.right_view.controls.extend(
5253
[
53-
get_title("Welcome to the OpenAndroidInstaller!"),
5454
Text(
5555
"We will walk you through the installation process nice and easy."
5656
),

0 commit comments

Comments
 (0)