This commit is contained in:
2026-03-08 23:24:33 -04:00
parent bfbcfcc2af
commit fde0f29e72
16 changed files with 348 additions and 88 deletions

View File

@@ -13,9 +13,27 @@ try:
with urllib.request.urlopen(req) as response:
with zipfile.ZipFile(io.BytesIO(response.read())) as z:
for info in z.infolist():
if info.filename.endswith("Inter-Regular.ttf") or info.filename.endswith("Inter-Bold.ttf"):
info.filename = os.path.basename(info.filename)
targets = ["Inter-Regular.ttf", "Inter-Bold.ttf", "Inter-Italic.ttf", "Inter-BoldItalic.ttf"]
filename = os.path.basename(info.filename)
if filename in targets:
info.filename = filename
z.extract(info, "assets/fonts/")
print(f"Extracted {info.filename}")
except Exception as e:
print(f"Failed to get Inter: {e}")
maple_url = "https://github.com/subframe7536/maple-font/releases/download/v6.4/MapleMono-ttf.zip"
print(f"Downloading Maple Mono from {maple_url}")
try:
req = urllib.request.Request(maple_url, headers={'User-Agent': 'Mozilla/5.0'})
with urllib.request.urlopen(req) as response:
with zipfile.ZipFile(io.BytesIO(response.read())) as z:
for info in z.infolist():
targets = ["MapleMono-Regular.ttf", "MapleMono-Bold.ttf", "MapleMono-Italic.ttf", "MapleMono-BoldItalic.ttf"]
filename = os.path.basename(info.filename)
if filename in targets:
info.filename = filename
z.extract(info, "assets/fonts/")
print(f"Extracted {info.filename}")
except Exception as e:
print(f"Failed to get Maple Mono: {e}")

View File

@@ -0,0 +1,35 @@
import os
import subprocess
import shutil
from pathlib import Path
def test_link():
project_root = Path(os.getcwd())
temp_workspace = project_root / "tests" / "artifacts" / "test_link_workspace"
if temp_workspace.exists():
shutil.rmtree(temp_workspace)
temp_workspace.mkdir(parents=True, exist_ok=True)
src_assets = project_root / "assets"
dest_assets = temp_workspace / "assets"
print(f"Linking {src_assets} to {dest_assets}")
if os.name == 'nt':
res = subprocess.run(["cmd", "/c", "mklink", "/D", str(dest_assets), str(src_assets)], capture_output=True, text=True)
print(f"Exit code: {res.returncode}")
print(f"Stdout: {res.stdout}")
print(f"Stderr: {res.stderr}")
else:
os.symlink(src_assets, dest_assets)
if dest_assets.exists():
print("Link exists")
if (dest_assets / "fonts" / "Inter-Regular.ttf").exists():
print("Font file accessible via link")
else:
print("Font file NOT accessible")
else:
print("Link does NOT exist")
if __name__ == "__main__":
test_link()

View File

@@ -0,0 +1,40 @@
from imgui_bundle import imgui, immapp, imgui_md
import sys
def gui():
imgui.text("Markdown Test")
imgui.separator()
md = """
# Header 1
## Header 2
This is **bold** and *italic*.
* List item 1
* List list 2
[Google](https://google.com)
```python
def hello():
print("world")
```
<div class="test-div">This is inside a div</div>
"""
imgui_md.render(md)
def on_html_div(div_class: str, opening: bool):
print(f"HTML DIV: class={div_class}, opening={opening}")
if opening:
imgui.push_style_color(imgui.Col_.text.value, imgui.ImColor(255, 0, 0, 255).value)
else:
imgui.pop_style_color()
def main():
options = imgui_md.MarkdownOptions()
options.callbacks.on_html_div = on_html_div
immapp.run(gui, with_markdown_options=options, window_size=(600, 600))
if __name__ == "__main__":
main()