Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/toad/qt/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ def __init__(self, window: QWidget) -> None:
@classmethod
def of(cls, widget: QWidget) -> QtMenu:
"""The pop-up menu of the window `widget` is in: the window's own direct child."""
return widget.window().findChild(cls, "toad-menu", Qt.FindChildOption.FindDirectChildrenOnly)
return QWidget.window(widget).findChild(cls, "toad-menu", Qt.FindChildOption.FindDirectChildrenOnly)

@staticmethod
def anchor_of(widget: QWidget) -> QRect:
"""`widget`'s rectangle in its window, as `show_entries` takes an anchor."""
return QRect(widget.mapTo(widget.window(), widget.rect().topLeft()), widget.size())
return QRect(widget.mapTo(QWidget.window(widget), widget.rect().topLeft()), widget.size())

def paint(self, renderer: QtLineRenderer) -> None:
"""One surface in the renderer's theme: the float tone (a tier above what it floats
Expand Down
4 changes: 3 additions & 1 deletion src/toad/qt/presented_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def presentation_host(self) -> QWidget:
if parent is None:
raise TypeError(f"{type(self).__qualname__} is shown without the window it opens over "
"as its parent")
return parent.window()
# QWidget.window, not parent.window(): a conversation view names its scroll surface
# `window` (the shared contract Textual also answers), shadowing the Qt method.
return QWidget.window(parent)

def page_header(self) -> QWidget:
"""The ← header a filled window shows above its content, built the first time."""
Expand Down
10 changes: 6 additions & 4 deletions tools/android/shipped_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,17 @@ def main(runtime: Path, app: Path, site_packages: Path) -> int:
for candidate in site_packages.glob(f"{name}*"):
if not (recipes / candidate.name).exists():
(recipes / candidate.name).symlink_to(candidate)
settings = work / "kept" / "config" / "toad" / "toad.json"
# qt_drive keeps its settings and state under its OUTDIR (`out/config`, `out/state`)
# whatever the environment holds, so the saved theme and the error files live there.
out = work / "out"
settings = out / "config" / "toad" / "toad.json"
settings.parent.mkdir(parents=True)
settings.write_text(json.dumps({"ui": {"theme": UNOFFERED_THEME}}))
trust = work / "trust.pem"
trust.write_text((app / "cacert.pem").read_text() + (work / "cert.pem").read_text())
out = work / "out"
result = shipped_qt(shipped, recipes, trust, profile, out)
print(result.stdout[-6000:])
errors = sorted((work / "kept" / "state").rglob("errors/*.txt"))
errors = sorted((out / "state").rglob("errors/*.txt"))
failed = (result.returncode != 0 or "ModuleNotFoundError" in result.stdout + result.stderr or errors)
if failed:
print(result.stderr[-8000:], file=sys.stderr)
Expand All @@ -217,7 +219,7 @@ def main(runtime: Path, app: Path, site_packages: Path) -> int:
f"{len(errors)} error file(s)); TOAD_SHIPPED_KEEP=1 keeps its scratch folder", file=sys.stderr)
return 1
print("shipped app ran every view kind and bound key on a scratch bus")
fault = fault_trace_failure(work / "kept" / "state", shipped, recipes)
fault = fault_trace_failure(out / "state", shipped, recipes)
if fault:
print(f"error: the shipped app's fault trace: {fault}", file=sys.stderr)
return 1
Expand Down
Loading