Skip to content

Commit

Permalink
Allow Markdow to format text content of device configs (#149)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
tsterbak authored May 8, 2023
2 parents 540df59 + d1e445f commit 4d595d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openandroidinstaller/installer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def from_file(cls, path):

def _find_config_file(device_code: str, config_path: Path) -> Optional[Path]:
"""Find the config file which is supported by the given device code."""
for path in config_path.rglob("*.yaml"):
for path in config_path.glob("*.yaml"):
with open(path, "r", encoding="utf-8") as stream:
try:
raw_config = dict(yaml.safe_load(stream))
Expand Down
7 changes: 6 additions & 1 deletion openandroidinstaller/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ class Markdown(ft.Markdown):
"""Markdown element to replace the markdown element from flet but is selectable."""

def __init__(self, *args, **kwargs):
super().__init__(selectable=True, *args, **kwargs)
super().__init__(
selectable=True,
on_tap_link=lambda e: self.page.launch_url(e.data),
*args,
**kwargs
)
1 change: 0 additions & 1 deletion openandroidinstaller/views/select_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def init_visuals(
replacing the firmware of the device with a completely custom ROM.
OpenAndroidInstaller works with the [TWRP recovery project](https://twrp.me/about).""",
on_tap_link=lambda e: self.page.launch_url(e.data),
),
actions=[
TextButton("Close", on_click=self.close_close_explain_images_dlg),
Expand Down
3 changes: 2 additions & 1 deletion openandroidinstaller/views/step_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

from styles import (
Text,
Markdown,
)

from views import BaseView
Expand Down Expand Up @@ -119,7 +120,7 @@ def check_advanced_switch(e):
)
]
self.right_view.controls = [
Text(f"{self.step.content}"),
Markdown(f"{self.step.content}"),
]
# basic view depending on step.type
logger.info(f"Starting step of type {self.step.type}.")
Expand Down

0 comments on commit 4d595d3

Please sign in to comment.