diff options
Diffstat (limited to 'experiments/graph_shot.py')
| -rw-r--r-- | experiments/graph_shot.py | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/experiments/graph_shot.py b/experiments/graph_shot.py index e024809..e3eb209 100644 --- a/experiments/graph_shot.py +++ b/experiments/graph_shot.py @@ -6,6 +6,7 @@ The pane a person runs this in is usually too small to judge the layout, and the pilot lays out synchronously at whatever size you ask for -- so this is the way to actually look at the thing. """ + import asyncio import os import shutil @@ -29,21 +30,23 @@ for e in ".i64 .id0 .id1 .id2 .nam .til".split(): except OSError: pass -from idatui.app import IdaTui, GraphView # noqa: E402 -from idatui._sync import wait_for # noqa: E402 -from idatui.rpc import screen_text # noqa: E402 +from idatui._sync import wait_for # noqa: E402 +from idatui.app import GraphView, IdaTui # noqa: E402 +from idatui.rpc import screen_text # noqa: E402 async def main() -> None: app = IdaTui(tmp, keepalive=False) async with app.run_test(size=(cols, rows)) as pilot: - await wait_for(lambda: app.program is not None and app._cur is not None, - pilot.pause, 120) + await wait_for( + lambda: app.program is not None and app._cur is not None, pilot.pause, 120 + ) ea = app.program.resolve(func) fn = app.program.function_of(ea) app._open_function(fn.addr, fn.name) - await wait_for(lambda: app._cur is not None and app._cur.ea == fn.addr, - pilot.pause, 60) + await wait_for( + lambda: app._cur is not None and app._cur.ea == fn.addr, pilot.pause, 60 + ) await pilot.pause(0.2) await pilot.press("space") gv = app.query_one(GraphView) @@ -51,8 +54,9 @@ async def main() -> None: gv._engine = engine gv._relayout() app._graph_status() - ok = await wait_for(lambda: app._active == "graph" and gv.lay is not None, - pilot.pause, 90) + ok = await wait_for( + lambda: app._active == "graph" and gv.lay is not None, pilot.pause, 90 + ) if not ok: print("graph never opened:", app.query_one("#status").render()) return @@ -63,8 +67,14 @@ async def main() -> None: print(screen_text(app)["text"]) print() print("status:", app.query_one("#status").render()) - print("stats :", gv.lay.stats, "canvas", - f"{gv.lay.width}x{gv.lay.height}", "zoom", gv.ZOOMS[gv._zoom]) + print( + "stats :", + gv.lay.stats, + "canvas", + f"{gv.lay.width}x{gv.lay.height}", + "zoom", + gv.ZOOMS[gv._zoom], + ) app._save_on_exit = False |
