Skip to content

Commit 4d595d3

Browse files
authored
Allow Markdow to format text content of device configs (#149)
Addresses #106 You can add emphasis by making text bold (** or __), italic (* or _) or both (*** or ___) now. (asterisk is preferred) To add paragraphs of lists you need to add two or one empty lines inbetween. Example ```yaml - type: call_button content: > As a first step, you need to unlock the bootloader. A bootloader is the piece of software, that tells your phone - how to start and run an operating system (like Android). Your device should be turned on. - Press 'Confirm and run' to reboot into the bootloader. command: adb_reboot_bootloader ```
2 parents 540df59 + d1e445f commit 4d595d3

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

openandroidinstaller/installer_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def from_file(cls, path):
9898

9999
def _find_config_file(device_code: str, config_path: Path) -> Optional[Path]:
100100
"""Find the config file which is supported by the given device code."""
101-
for path in config_path.rglob("*.yaml"):
101+
for path in config_path.glob("*.yaml"):
102102
with open(path, "r", encoding="utf-8") as stream:
103103
try:
104104
raw_config = dict(yaml.safe_load(stream))

openandroidinstaller/styles.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ class Markdown(ft.Markdown):
2727
"""Markdown element to replace the markdown element from flet but is selectable."""
2828

2929
def __init__(self, *args, **kwargs):
30-
super().__init__(selectable=True, *args, **kwargs)
30+
super().__init__(
31+
selectable=True,
32+
on_tap_link=lambda e: self.page.launch_url(e.data),
33+
*args,
34+
**kwargs
35+
)

openandroidinstaller/views/select_view.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def init_visuals(
8484
replacing the firmware of the device with a completely custom ROM.
8585
8686
OpenAndroidInstaller works with the [TWRP recovery project](https://twrp.me/about).""",
87-
on_tap_link=lambda e: self.page.launch_url(e.data),
8887
),
8988
actions=[
9089
TextButton("Close", on_click=self.close_close_explain_images_dlg),

openandroidinstaller/views/step_view.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
from styles import (
3333
Text,
34+
Markdown,
3435
)
3536

3637
from views import BaseView
@@ -119,7 +120,7 @@ def check_advanced_switch(e):
119120
)
120121
]
121122
self.right_view.controls = [
122-
Text(f"{self.step.content}"),
123+
Markdown(f"{self.step.content}"),
123124
]
124125
# basic view depending on step.type
125126
logger.info(f"Starting step of type {self.step.type}.")

0 commit comments

Comments
 (0)