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). 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?).ib_2025_updates
parent
4f8dc7693b
commit
e265a98456
|
@ -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(
|
||||||
|
|
|
@ -73,10 +73,10 @@ dependencies = [
|
||||||
"websockets ==12.0",
|
"websockets ==12.0",
|
||||||
"msgspec>=0.19.0,<0.20",
|
"msgspec>=0.19.0,<0.20",
|
||||||
"tractor",
|
"tractor",
|
||||||
"asyncvnc",
|
|
||||||
"tomlkit",
|
"tomlkit",
|
||||||
"trio-typing>=0.10.0",
|
"trio-typing>=0.10.0",
|
||||||
"numba>=0.61.0",
|
"numba>=0.61.0",
|
||||||
|
"pyvnc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
@ -107,17 +107,32 @@ uis = [
|
||||||
# console ehancements and eventually remote debugging extras/helpers.
|
# console ehancements and eventually remote debugging extras/helpers.
|
||||||
# use `uv --dev` to enable
|
# use `uv --dev` to enable
|
||||||
dev = [
|
dev = [
|
||||||
"pytest >=6.0.0, <7.0.0",
|
"pytest",
|
||||||
"elasticsearch >=8.9.0, <9.0.0",
|
"elasticsearch >=8.9.0, <9.0.0",
|
||||||
'xonsh',
|
|
||||||
"prompt-toolkit ==3.0.40",
|
"prompt-toolkit ==3.0.40",
|
||||||
"cython >=3.0.0, <4.0.0",
|
"cython >=3.0.0, <4.0.0",
|
||||||
"greenback >=1.1.1, <2.0.0",
|
"greenback >=1.1.1, <2.0.0",
|
||||||
"ruff>=0.9.6",
|
"ruff>=0.9.6",
|
||||||
"pyperclip>=1.9.0",
|
"pyperclip>=1.9.0",
|
||||||
"i3ipc>=2.2.1",
|
"i3ipc>=2.2.1",
|
||||||
|
|
||||||
|
# ?from git, see below.
|
||||||
|
"xonsh",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
# https://docs.pytest.org/en/stable/reference/reference.html#configuration-options
|
||||||
|
testpaths = [
|
||||||
|
"tests",
|
||||||
|
]
|
||||||
|
# https://docs.pytest.org/en/stable/reference/reference.html#confval-console_output_style
|
||||||
|
console_output_style = 'progress'
|
||||||
|
|
||||||
|
# https://docs.pytest.org/en/stable/how-to/plugins.html#disabling-plugins-from-autoloading
|
||||||
|
# https://docs.pytest.org/en/stable/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name
|
||||||
|
addopts = '-p no:xonsh'
|
||||||
|
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
piker = "piker.cli:cli"
|
piker = "piker.cli:cli"
|
||||||
pikerd = "piker.cli:pikerd"
|
pikerd = "piker.cli:pikerd"
|
||||||
|
@ -138,8 +153,8 @@ python-downloads = 'manual'
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
pyqtgraph = { git = "https://github.com/pikers/pyqtgraph.git" }
|
pyqtgraph = { git = "https://github.com/pikers/pyqtgraph.git" }
|
||||||
asyncvnc = { git = "https://github.com/pikers/asyncvnc.git", branch = "main" }
|
|
||||||
tomlkit = { git = "https://github.com/pikers/tomlkit.git", branch ="piker_pin" }
|
tomlkit = { git = "https://github.com/pikers/tomlkit.git", branch ="piker_pin" }
|
||||||
|
pyvnc = { git = "https://github.com/regulad/pyvnc.git" }
|
||||||
|
|
||||||
# TODO, long term we should be synced to upstream `main` branch!
|
# TODO, long term we should be synced to upstream `main` branch!
|
||||||
# tractor = { git = "https://github.com/goodboy/tractor.git", branch ="piker_pin" }
|
# tractor = { git = "https://github.com/goodboy/tractor.git", branch ="piker_pin" }
|
||||||
|
|
Loading…
Reference in New Issue