Skip to content

Commit 306ce85

Browse files
authored
UI elements (#45)
This PR adds: - new Images to guide in the process - Restructuring of views - dialog to help finding the android or firmware version - steps indicator header - Remove step-progressbar and move the header to different column container to keep it attached to the top
2 parents 5748ff9 + fad04b4 commit 306ce85

22 files changed

Lines changed: 1395 additions & 1202 deletions

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/assets/configs/sargo.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ steps:
3232
Make sure your device is turned on. You need to reboot into the bootloader again by pressing 'Confirm and run' here. Then continue.
3333
command: adb_reboot_bootloader
3434
- type: call_button
35-
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once it's done continue.
35+
content: Flash a custom recovery (temporarily) by pressing 'Confirm and run'. Once your phone screen looks like the picture on the left, continue.
3636
command: fastboot_flash_recovery
37+
img: twrp-start.jpeg
3738
install_os:
3839
- type: call_button
3940
content: >
137 KB
Loading
123 KB
Loading
123 KB
Loading
131 KB
Loading
124 KB
Loading
125 KB
Loading
80.9 KB
Loading

openandroidinstaller/openandroidinstaller.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,21 @@
3838
from loguru import logger
3939

4040
from app_state import AppState
41-
from views import SelectFilesView, StepView, SuccessView, StartView, RequirementsView
41+
from views import (
42+
SelectFilesView,
43+
StepView,
44+
SuccessView,
45+
StartView,
46+
RequirementsView,
47+
WelcomeView,
48+
)
4249
from tooling import run_command
4350

4451
# where to write the logs
4552
logger.add("openandroidinstaller.log")
4653

4754
# Toggle to True for development purposes
48-
DEVELOPMENT = False
55+
DEVELOPMENT = True
4956
DEVELOPMENT_CONFIG = "sargo" # "a3y17lte" # "sargo"
5057

5158

@@ -64,18 +71,18 @@ def __init__(self):
6471
platform=PLATFORM,
6572
config_path=CONFIG_PATH,
6673
bin_path=BIN_PATH,
67-
progressbar=ProgressBar(
68-
width=600, color="#00d886", bgcolor="#eeeeee", bar_height=16
69-
),
70-
num_steps=2,
7174
test=DEVELOPMENT,
7275
test_config=DEVELOPMENT_CONFIG,
7376
)
7477
# create the main columns
7578
self.view = Column(expand=True, width=1200)
7679

7780
# create default starter views
78-
welcome_view = StartView(
81+
welcome_view = WelcomeView(
82+
on_confirm=self.confirm,
83+
state=self.state,
84+
)
85+
start_view = StartView(
7986
on_confirm=self.confirm,
8087
state=self.state,
8188
)
@@ -88,7 +95,12 @@ def __init__(self):
8895
state=self.state,
8996
)
9097
# ordered to allow for pop
91-
self.default_views = [select_files_view, requirements_view, welcome_view]
98+
self.default_views = [
99+
select_files_view,
100+
requirements_view,
101+
start_view,
102+
welcome_view,
103+
]
92104
# create the final success view
93105
self.final_view = SuccessView(state=self.state)
94106

@@ -103,9 +115,6 @@ def confirm(self, e):
103115
"""Confirmation event handler to use in views."""
104116
# remove all elements from column view
105117
self.view.controls = []
106-
# if a config is loaded, display a progress bar
107-
if self.state.config:
108-
self.state.increment_progressbar()
109118
# if there are default views left, display them first
110119
if self.default_views:
111120
self.view.controls.append(self.default_views.pop())
@@ -144,8 +153,8 @@ def main(page: Page):
144153
logger.info(100 * "-")
145154
# Configure the application base page
146155
page.title = "OpenAndroidInstaller"
147-
page.window_height = 820
148-
page.window_width = int(1.77 * page.window_height)
156+
page.window_height = 900
157+
page.window_width = int(1.5 * page.window_height)
149158
page.window_top = 100
150159
page.window_left = 120
151160
page.scroll = "adaptive"

0 commit comments

Comments
 (0)