Switch to `pyvnc` for IB reset hackz
It actually works for vncAuth(2) (thank god!) which the previous `asyncvnc` **did not**, and seems to be mostly based on the work from the `asyncvnc` author anyway (so all my past efforts don't seem to have been in vain XD). NOTE, the below deats ended up being factored in earlier into the `pyproject.toml` alongside nix(os) support needed for testing and landing this history. As the such, the comments are the originals but the changes are not. Deats, - switch to `pyvnc` async API (using `asyncio` again obvi) in `.ib._util._vnc_click_hack()`. - add `pyvnc` as src installed dep from GH. - drop `asyncvnc` as dep. Other, - update `pytest` version range to avoid weird auto-load plugin exposed by `xonsh`? - add a `tool.pytest.ini_options` to project file with vars to, - disable that^ `xonsh` plug using `addopts = '-p no:xonsh'`. - set a `testpaths` to avoid running anything but that subdir. - try out the `'progress'` style console output (does it work?).brokers_refinery
parent
6501f04ace
commit
6d6afbde8f
|
|
@ -197,15 +197,20 @@ async def vnc_click_hack(
|
||||||
) -> None:
|
) -> None:
|
||||||
'''
|
'''
|
||||||
Reset the data or network connection for the VNC attached
|
Reset the data or network connection for the VNC attached
|
||||||
ib gateway using magic combos.
|
ib-gateway using a (magic) keybinding combo.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
import asyncvnc
|
from pyvnc import (
|
||||||
|
AsyncVNCClient,
|
||||||
|
VNCConfig,
|
||||||
|
Point,
|
||||||
|
MOUSE_BUTTON_LEFT,
|
||||||
|
)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
log.warning(
|
log.warning(
|
||||||
"In order to leverage `piker`'s built-in data reset hacks, install "
|
"In order to leverage `piker`'s built-in data reset hacks, install "
|
||||||
"the `asyncvnc` project: https://github.com/barneygale/asyncvnc"
|
"the `pyvnc` project: https://github.com/regulad/pyvnc.git"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -216,24 +221,27 @@ async def vnc_click_hack(
|
||||||
'connection': 'r'
|
'connection': 'r'
|
||||||
}[reset_type]
|
}[reset_type]
|
||||||
|
|
||||||
async with asyncvnc.connect(
|
with tractor.devx.open_crash_handler():
|
||||||
host,
|
client = await AsyncVNCClient.connect(
|
||||||
port=port,
|
VNCConfig(
|
||||||
|
host=host,
|
||||||
# TODO: doesn't work?
|
port=port,
|
||||||
# see, https://github.com/barneygale/asyncvnc/issues/7
|
password='doggy',
|
||||||
password='doggy',
|
)
|
||||||
|
|
||||||
) as client:
|
|
||||||
|
|
||||||
# move to middle of screen
|
|
||||||
# 640x1800
|
|
||||||
client.mouse.move(
|
|
||||||
x=500,
|
|
||||||
y=500,
|
|
||||||
)
|
)
|
||||||
client.mouse.click()
|
async with client:
|
||||||
client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked
|
# move to middle of screen
|
||||||
|
# 640x1800
|
||||||
|
await client.move(
|
||||||
|
Point(
|
||||||
|
500,
|
||||||
|
500,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
# ensure the ib-gw window is active
|
||||||
|
await client.click(MOUSE_BUTTON_LEFT)
|
||||||
|
# send the hotkeys combo B)
|
||||||
|
await client.press('Ctrl', 'Alt', key) # keys are stacked
|
||||||
|
|
||||||
|
|
||||||
def i3ipc_fin_wins_titled(
|
def i3ipc_fin_wins_titled(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue