Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve resizing/scaling support #402

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openandroidinstaller/openandroidinstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, state: AppState):
super().__init__()
self.state = state
# create the main columns
self.view = Column(expand=True, width=1200)
self.view = Column(expand=True) # , width=1200)

# create default starter views
welcome_view = WelcomeView(
Expand Down Expand Up @@ -216,7 +216,7 @@ def log_version_infos(bin_path):
]
try:
logger.info(f"Heimdall version: {hdversion[1].strip()}")
except:
except IndexError:
logger.info(f"Issue with heimdall: {hdversion}")


Expand Down
38 changes: 20 additions & 18 deletions openandroidinstaller/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@

from app_state import AppState

from flet import (
Column,
Image,
Row,
UserControl,
VerticalDivider,
)
from flet import Column, Container, Image, Row, UserControl, VerticalDivider, margin


class BaseView(UserControl):
Expand All @@ -30,27 +24,35 @@ def __init__(self, state: AppState, image: str = "placeholder.png"):
self.state = state

# configs
self.column_width = 600
# self.column_width = 600
# right part of the display, add content here.
self.right_view_header = Column(width=self.column_width, height=120, spacing=30)
self.right_view_header = Column(
spacing=30
) # , width=self.column_width, height=120)
self.right_view = Column(
alignment="center", width=self.column_width, height=650, scroll="adaptive"
alignment="center",
scroll="adaptive", # , width=self.column_width, height=650
)
# left part of the display: used for displaying the images
self.left_view = Column(
width=self.column_width,
# width=self.column_width,
controls=[Image(src=f"/imgs/{image}", height=600)],
expand=True,
horizontal_alignment="center",
)
# main view row
self.view = Row(
[
self.left_view,
VerticalDivider(),
Column(expand=True, controls=[self.right_view_header, self.right_view]),
],
alignment="spaceEvenly",
self.view = Container(
content=Row(
[
self.left_view,
VerticalDivider(),
Column(
expand=True, controls=[self.right_view_header, self.right_view]
),
],
alignment="spaceEvenly",
),
margin=margin.only(left=10, top=0, right=50, bottom=5),
)

def clear(
Expand Down
2 changes: 1 addition & 1 deletion openandroidinstaller/views/requirements_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def build(self):
required_android_version = self.state.config.requirements.get("android")
if required_android_version:
android_checkbox = Checkbox(
label="The required android version is installed. (Or I know the risk of continuing)",
label="The required android version is installed.\n(Or I know the risk of continuing)",
on_change=self.enable_continue_button,
)
android_version_check = Card(
Expand Down
5 changes: 4 additions & 1 deletion openandroidinstaller/views/start_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
OutlinedButton,
FilledButton,
Row,
ResponsiveRow,
TextButton,
colors,
icons,
Expand Down Expand Up @@ -106,6 +107,7 @@ def check_bootloader_unlocked(e):
disabled=True,
inactive_thumb_color=colors.YELLOW,
active_color=colors.GREEN,
col={"xl": 6},
)

# toggleswitch to allow skipping flashing recovery
Expand All @@ -119,6 +121,7 @@ def check_recovery_already_flashed(e):
disabled=True,
inactive_thumb_color=colors.YELLOW,
active_color=colors.GREEN,
col={"xl": 6},
)

# inform the user about the device detection
Expand Down Expand Up @@ -202,7 +205,7 @@ def build(self):
alignment="center",
),
Divider(),
Row([self.bootloader_switch, self.recovery_switch]),
ResponsiveRow([self.bootloader_switch, self.recovery_switch]),
]
)
return self.view
Expand Down