Skip to content

Commit 250f80c

Browse files
committed
Upgrade to flet 0.26.0
1 parent f1f9987 commit 250f80c

18 files changed

+169
-1837
lines changed

flatpak/generated-poetry-sources.json

Lines changed: 0 additions & 334 deletions
This file was deleted.

flatpak/org.openandroidinstaller.OpenAndroidInstaller.appdata.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

flatpak/org.openandroidinstaller.OpenAndroidInstaller.desktop

Lines changed: 0 additions & 11 deletions
This file was deleted.
-22.9 KB
Binary file not shown.

openandroidinstaller/openandroidinstaller.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
Image,
3131
Page,
3232
TextButton,
33-
UserControl,
34-
colors,
35-
icons,
33+
Colors,
34+
Icons,
3635
)
3736
from loguru import logger
3837
from styles import Text
@@ -61,7 +60,7 @@
6160
BIN_PATH = Path(__file__).parent.joinpath(Path("bin")).resolve()
6261

6362

64-
class MainView(UserControl):
63+
class MainView(Column):
6564
def __init__(self, state: AppState):
6665
super().__init__()
6766
self.state = state
@@ -73,6 +72,8 @@ def __init__(self, state: AppState):
7372
on_confirm=self.to_next_view,
7473
state=self.state,
7574
)
75+
self.state.page.add(welcome_view)
76+
7677
start_view = StartView(
7778
on_confirm=self.to_next_view,
7879
on_back=self.to_previous_view,
@@ -221,7 +222,6 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
221222

222223
# configure the page
223224
configure(page)
224-
225225
# header
226226
page.appbar = AppBar(
227227
leading=Image(src="/logo-192x192.png", height=40, width=40, border_radius=40),
@@ -236,7 +236,7 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
236236
actions=[
237237
Container(
238238
content=ElevatedButton(
239-
icon=icons.QUESTION_MARK_ROUNDED,
239+
icon=Icons.QUESTION_MARK_ROUNDED,
240240
text="FAQ",
241241
on_click=lambda _: webbrowser.open(
242242
"https://openandroidinstaller.org/faq.html"
@@ -247,7 +247,7 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
247247
),
248248
Container(
249249
content=ElevatedButton(
250-
icon=icons.FEEDBACK_OUTLINED,
250+
icon=Icons.FEEDBACK_OUTLINED,
251251
text="Give feedback",
252252
on_click=lambda _: webbrowser.open(
253253
"https://openandroidinstaller.org/feedback.html"
@@ -258,7 +258,7 @@ def main(page: Page, test: bool = False, test_config: str = "sargo"):
258258
),
259259
Container(
260260
content=ElevatedButton(
261-
icon=icons.BUG_REPORT_OUTLINED,
261+
icon=Icons.BUG_REPORT_OUTLINED,
262262
text="Report a bug",
263263
on_click=lambda _: webbrowser.open(
264264
"https://github.com/openandroidinstaller-dev/openandroidinstaller/issues"
@@ -276,8 +276,8 @@ def close_banner(e):
276276
page.update()
277277

278278
banner = Banner(
279-
bgcolor=colors.AMBER_100,
280-
leading=Icon(icons.WARNING_AMBER_ROUNDED, color=colors.AMBER, size=40),
279+
bgcolor=Colors.AMBER_100,
280+
leading=Icon(Icons.WARNING_AMBER_ROUNDED, color=Colors.AMBER, size=40),
281281
content=Text(
282282
"These instructions only work if you follow every section and step precisely. Do not continue after something fails!"
283283
),
@@ -287,7 +287,6 @@ def close_banner(e):
287287
)
288288
page.overlay.append(banner)
289289
banner.open = True
290-
page.update()
291290

292291
# create the State object
293292
state = AppState(
@@ -300,7 +299,6 @@ def close_banner(e):
300299
state.page = page
301300
# create application instance
302301
app = MainView(state=state)
303-
304302
# add application's root control to the page
305303
page.add(app)
306304

openandroidinstaller/views/addon_view.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
OutlinedButton,
2626
Row,
2727
TextButton,
28-
colors,
29-
icons,
28+
Colors,
29+
Icons,
3030
)
3131
from flet_core.buttons import ContinuousRectangleBorder
3232
from loguru import logger
@@ -100,8 +100,8 @@ def build(self):
100100
"What kind of addons?",
101101
on_click=self.open_explain_addons_dlg,
102102
expand=True,
103-
icon=icons.HELP_OUTLINE_OUTLINED,
104-
icon_color=colors.DEEP_ORANGE_500,
103+
icon=Icons.HELP_OUTLINE_OUTLINED,
104+
icon_color=Colors.DEEP_ORANGE_500,
105105
tooltip="Get more details on what addons are supported.",
106106
)
107107

@@ -126,7 +126,7 @@ def build(self):
126126
[
127127
ElevatedButton(
128128
"Download F-Droid App-Store",
129-
icon=icons.DOWNLOAD_OUTLINED,
129+
icon=Icons.DOWNLOAD_OUTLINED,
130130
on_click=lambda _: webbrowser.open(
131131
"https://f-droid.org/en/packages/org.fdroid.fdroid.privileged.ota/"
132132
),
@@ -141,7 +141,7 @@ def build(self):
141141
[
142142
ElevatedButton(
143143
"Download Google Apps",
144-
icon=icons.DOWNLOAD_OUTLINED,
144+
icon=Icons.DOWNLOAD_OUTLINED,
145145
on_click=lambda _: webbrowser.open(
146146
"https://wiki.lineageos.org/gapps#downloads"
147147
),
@@ -154,7 +154,7 @@ def build(self):
154154
[
155155
ElevatedButton(
156156
"Download MicroG",
157-
icon=icons.DOWNLOAD_OUTLINED,
157+
icon=Icons.DOWNLOAD_OUTLINED,
158158
on_click=lambda _: webbrowser.open(
159159
"https://github.com/FriendlyNeighborhoodShane/MinMicroG-abuse-CI/releases"
160160
),
@@ -174,7 +174,7 @@ def build(self):
174174
[
175175
FilledButton(
176176
"Pick the addons you want to install",
177-
icon=icons.UPLOAD_FILE,
177+
icon=Icons.UPLOAD_FILE,
178178
on_click=lambda _: self.pick_addons_dialog.pick_files(
179179
allow_multiple=True,
180180
file_type="custom",

openandroidinstaller/views/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
# If not, see <https://www.gnu.org/licenses/>."""
1212
# Author: Tobias Sterbak
1313
from app_state import AppState
14-
from flet import Column, Container, Image, Row, UserControl, VerticalDivider, margin
14+
from flet import Column, Container, Image, Row, VerticalDivider, margin
1515

1616

17-
class BaseView(UserControl):
17+
class BaseView(Column):
1818
def __init__(self, state: AppState, image: str = "placeholder.png"):
1919
super().__init__()
2020
self.state = state

openandroidinstaller/views/install_addons_view.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from typing import Callable
1616

1717
from app_state import AppState
18-
from flet import Column, ElevatedButton, Row, Switch, colors, icons
18+
from flet import Column, ElevatedButton, Row, Switch, Colors, Icons
1919
from loguru import logger
2020
from styles import Markdown, Text
2121
from tooling import adb_reboot, adb_twrp_finish_install_addons, adb_twrp_install_addon
@@ -35,7 +35,7 @@ def __init__(
3535
def build(self):
3636
"""Create the content of the view."""
3737
# error text
38-
self.error_text = Text("", color=colors.RED)
38+
self.error_text = Text("", color=Colors.RED)
3939
# text field to inform about the currently installing addon
4040
self.addon_info_text = Text("", weight="bold")
4141

@@ -90,7 +90,7 @@ def check_advanced_switch(e):
9090
"Confirm and install addons",
9191
on_click=self.run_install_addons,
9292
expand=True,
93-
icon=icons.DIRECTIONS_RUN_OUTLINED,
93+
icon=Icons.DIRECTIONS_RUN_OUTLINED,
9494
)
9595
# build the view
9696
self.right_view.controls.extend(
@@ -117,7 +117,7 @@ def check_advanced_switch(e):
117117
ElevatedButton(
118118
"Skip",
119119
on_click=self.on_confirm,
120-
icon=icons.NEXT_PLAN_OUTLINED,
120+
icon=Icons.NEXT_PLAN_OUTLINED,
121121
expand=True,
122122
),
123123
]

openandroidinstaller/views/install_view.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from typing import Callable
1515

1616
from app_state import AppState
17-
from flet import Column, ElevatedButton, Row, Switch, colors, icons
17+
from flet import Column, ElevatedButton, Row, Switch, Colors, Icons
1818
from loguru import logger
1919
from styles import Markdown, Text
2020
from tooling import adb_twrp_wipe_and_install
@@ -34,7 +34,7 @@ def __init__(
3434
def build(self):
3535
"""Create the content of the view."""
3636
# error text
37-
self.error_text = Text("", color=colors.GREEN)
37+
self.error_text = Text("", color=Colors.GREEN)
3838

3939
# switch to enable advanced output - here it means show terminal input/output in tool
4040
def check_advanced_switch(e):
@@ -115,7 +115,7 @@ def check_addons_switch(e):
115115
"Confirm and install",
116116
on_click=self.run_install,
117117
expand=True,
118-
icon=icons.DIRECTIONS_RUN_OUTLINED,
118+
icon=Icons.DIRECTIONS_RUN_OUTLINED,
119119
)
120120
# build the view
121121
self.right_view.controls.extend(
@@ -142,7 +142,7 @@ def check_addons_switch(e):
142142
ElevatedButton(
143143
"Skip",
144144
on_click=self.on_confirm,
145-
icon=icons.NEXT_PLAN_OUTLINED,
145+
icon=Icons.NEXT_PLAN_OUTLINED,
146146
expand=True,
147147
),
148148
]
@@ -160,7 +160,7 @@ def run_install(self, e):
160160
self.install_button.disabled = True
161161
self.install_addons_switch.disabled = True
162162
self.error_text.value = "Please be patient, it may take a few minutes."
163-
self.error_text.color = colors.GREEN
163+
self.error_text.color = Colors.GREEN
164164
# reset the progress indicators
165165
self.progress_indicator.clear()
166166
# reset terminal output
@@ -190,7 +190,7 @@ def run_install(self, e):
190190
self.install_button.disabled = False
191191
# also remove the last error text if it happened
192192
self.error_text.value = "Installation failed! Try again or make sure everything is setup correctly."
193-
self.error_text.color = colors.RED
193+
self.error_text.color = Colors.RED
194194
else:
195195
sleep(5) # wait to make sure everything is fine
196196
self.progress_indicator.set_progress_bar(100)

openandroidinstaller/views/requirements_view.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
OutlinedButton,
2525
Row,
2626
TextButton,
27-
colors,
28-
icons,
27+
Colors,
28+
Icons,
2929
)
3030
from flet_core.buttons import ContinuousRectangleBorder
3131
from loguru import logger
@@ -60,15 +60,15 @@ def init_visuals(
6060
self.continue_button = ElevatedButton(
6161
"Continue",
6262
on_click=self.on_confirm,
63-
icon=icons.NEXT_PLAN_OUTLINED,
63+
icon=Icons.NEXT_PLAN_OUTLINED,
6464
disabled=True,
6565
expand=True,
6666
)
6767
# back button
6868
self.back_button = ElevatedButton(
6969
"Back",
7070
on_click=self.on_back,
71-
icon=icons.ARROW_BACK,
71+
icon=Icons.ARROW_BACK,
7272
expand=True,
7373
)
7474

@@ -105,8 +105,8 @@ def build(self):
105105
"How to Find the version",
106106
on_click=self.open_find_version_dlg,
107107
expand=False,
108-
icon=icons.HELP_OUTLINE_OUTLINED,
109-
icon_color=colors.DEEP_ORANGE_500,
108+
icon=Icons.HELP_OUTLINE_OUTLINED,
109+
icon_color=Colors.DEEP_ORANGE_500,
110110
tooltip="How to find the firmware and android version of your device.",
111111
)
112112

0 commit comments

Comments
 (0)