From bff625725e35c5369a002d505cbfa05558751300 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 24 May 2022 08:53:47 -0400 Subject: [PATCH] Implement reset hacks via our patched `asyncvnc` client --- piker/brokers/ib.py | 27 +++++++++++++++++++++++++++ requirements.txt | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index bf66485b..b1d1cc42 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -2531,6 +2531,33 @@ async def data_reset_hack( - integration with ``ib-gw`` run in docker + Xorg? ''' + + async def vnc_click_hack( + reset_type: str = 'data' + ) -> None: + ''' + Reset the data or netowork connection for the VNC attached + ib gateway using magic combos. + + ''' + key = {'data': 'f', 'connection': 'r'}[reset_type] + + import asyncvnc + + async with asyncvnc.connect( + 'localhost', + port=5900, + force_video_mode='rgba', + ) as client: + + client.mouse.click() + client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked + + await tractor.to_asyncio.run_task(vnc_click_hack) + + # we don't really need the ``xdotool`` approach any more B) + return + # TODO: see if we can find which window is mapped to which process? # for eg. if we can launch a paper account with docker and then find # the pid of it, can we send keycommands to that container somehow? diff --git a/requirements.txt b/requirements.txt index 78255d32..64dd78c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,7 @@ # ``trimeter`` for asysnc history fetching -e git+https://github.com/python-trio/trimeter.git@master#egg=trimeter + + +# ``asyncvnc`` for sending interactions to ib-gw inside docker +-e git+https://github.com/pikers/asyncvnc.git@vid_passthrough#egg=asyncvnc