Skip to content

Commit 150700d

Browse files
committed
Make all text and markdown elements selectable
1 parent 916386e commit 150700d

File tree

12 files changed

+75
-17
lines changed

12 files changed

+75
-17
lines changed

openandroidinstaller/openandroidinstaller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@
3131
Icon,
3232
Image,
3333
Page,
34-
Text,
3534
TextButton,
3635
UserControl,
3736
colors,
3837
icons,
3938
)
4039
from loguru import logger
4140

41+
from styles import (
42+
Text,
43+
)
4244
from app_state import AppState
4345
from views import (
4446
SelectFilesView,

openandroidinstaller/styles.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""This module contains different pre-configured style elements for building the application."""
2+
3+
# This file is part of OpenAndroidInstaller.
4+
# OpenAndroidInstaller is free software: you can redistribute it and/or modify it under the terms of
5+
# the GNU General Public License as published by the Free Software Foundation,
6+
# either version 3 of the License, or (at your option) any later version.
7+
8+
# OpenAndroidInstaller is distributed in the hope that it will be useful, but WITHOUT ANY
9+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11+
12+
# You should have received a copy of the GNU General Public License along with OpenAndroidInstaller.
13+
# If not, see <https://www.gnu.org/licenses/>."""
14+
# Author: Tobias Sterbak
15+
16+
import flet as ft
17+
18+
19+
class Text(ft.Text):
20+
"""Text element to replace the default text element from flet but is selectable."""
21+
22+
def __init__(self, *args, **kwargs):
23+
super().__init__(selectable=True, *args, **kwargs)
24+
25+
26+
class Markdown(ft.Markdown):
27+
"""Markdown element to replace the markdown element from flet but is selectable."""
28+
29+
def __init__(self, *args, **kwargs):
30+
super().__init__(selectable=True, *args, **kwargs)

openandroidinstaller/views/addon_view.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
ElevatedButton,
2424
OutlinedButton,
2525
FilledButton,
26-
Markdown,
2726
Row,
28-
Text,
2927
colors,
3028
icons,
3129
TextButton,
@@ -35,6 +33,10 @@
3533
)
3634
from flet.buttons import CountinuosRectangleBorder
3735

36+
from styles import (
37+
Text,
38+
Markdown,
39+
)
3840
from views import BaseView
3941
from app_state import AppState
4042
from widgets import get_title, confirm_button

openandroidinstaller/views/install_addons_view.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
Column,
2222
ElevatedButton,
2323
Row,
24-
Text,
2524
icons,
2625
Switch,
2726
colors,
27+
)
28+
29+
from styles import (
30+
Text,
2831
Markdown,
2932
)
3033

openandroidinstaller/views/install_view.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
Column,
2222
ElevatedButton,
2323
Row,
24-
Text,
2524
icons,
2625
Switch,
2726
colors,
27+
)
28+
29+
from styles import (
30+
Text,
2831
Markdown,
2932
)
3033

openandroidinstaller/views/requirements_view.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222
Container,
2323
Divider,
2424
ElevatedButton,
25-
Markdown,
2625
Row,
2726
colors,
2827
OutlinedButton,
29-
Text,
3028
icons,
3129
TextButton,
3230
AlertDialog,
3331
)
3432
from flet.buttons import CountinuosRectangleBorder
3533

34+
from styles import (
35+
Text,
36+
Markdown,
37+
)
3638
from views import BaseView
3739
from app_state import AppState
3840
from widgets import get_title

openandroidinstaller/views/select_view.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
ElevatedButton,
2424
OutlinedButton,
2525
FilledButton,
26-
Markdown,
2726
Row,
28-
Text,
2927
colors,
3028
icons,
3129
TextButton,
@@ -35,6 +33,10 @@
3533
)
3634
from flet.buttons import CountinuosRectangleBorder
3735

36+
from styles import (
37+
Text,
38+
Markdown,
39+
)
3840
from views import BaseView
3941
from app_state import AppState
4042
from widgets import get_title, confirm_button

openandroidinstaller/views/start_view.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
ElevatedButton,
2626
OutlinedButton,
2727
FilledButton,
28-
Markdown,
2928
Row,
30-
Text,
3129
TextButton,
3230
colors,
3331
icons,
3432
)
3533
from flet.buttons import CountinuosRectangleBorder
3634

35+
from styles import (
36+
Text,
37+
Markdown,
38+
)
3739
from views import BaseView
3840
from app_state import AppState
3941
from widgets import get_title

openandroidinstaller/views/step_view.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@
2222
Column,
2323
ElevatedButton,
2424
Row,
25-
Text,
2625
icons,
2726
TextField,
2827
Switch,
2928
colors,
3029
)
3130

31+
32+
from styles import (
33+
Text,
34+
)
35+
3236
from views import BaseView
3337
from installer_config import Step
3438
from app_state import AppState

openandroidinstaller/views/success_view.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
from flet import (
1818
ElevatedButton,
1919
Row,
20+
)
21+
22+
from styles import (
2023
Text,
2124
Markdown,
2225
)
23-
2426
from views import BaseView
2527
from app_state import AppState
2628
from widgets import get_title

0 commit comments

Comments
 (0)