diff --git a/piker/brokers/ib/_util.py b/piker/brokers/ib/_util.py index 2941284a..cb3affc7 100644 --- a/piker/brokers/ib/_util.py +++ b/piker/brokers/ib/_util.py @@ -197,15 +197,20 @@ async def vnc_click_hack( ) -> None: ''' Reset the data or network connection for the VNC attached - ib gateway using magic combos. + ib-gateway using a (magic) keybinding combo. ''' try: - import asyncvnc + from pyvnc import ( + AsyncVNCClient, + VNCConfig, + Point, + MOUSE_BUTTON_LEFT, + ) except ModuleNotFoundError: log.warning( "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 @@ -216,24 +221,27 @@ async def vnc_click_hack( 'connection': 'r' }[reset_type] - async with asyncvnc.connect( - host, - port=port, - - # TODO: doesn't work? - # see, https://github.com/barneygale/asyncvnc/issues/7 - password='doggy', - - ) as client: - - # move to middle of screen - # 640x1800 - client.mouse.move( - x=500, - y=500, + with tractor.devx.open_crash_handler(): + client = await AsyncVNCClient.connect( + VNCConfig( + host=host, + port=port, + password='doggy', + ) ) - client.mouse.click() - client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked + async with client: + # 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( diff --git a/pyproject.toml b/pyproject.toml index 78ac0eb2..d76f05d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,10 +73,10 @@ dependencies = [ "websockets ==12.0", "msgspec>=0.19.0,<0.20", "tractor", - "asyncvnc", "tomlkit", "trio-typing>=0.10.0", "numba>=0.61.0", + "pyvnc", ] [project.optional-dependencies] @@ -107,17 +107,32 @@ uis = [ # console ehancements and eventually remote debugging extras/helpers. # use `uv --dev` to enable dev = [ - "pytest >=6.0.0, <7.0.0", + "pytest", "elasticsearch >=8.9.0, <9.0.0", - 'xonsh', "prompt-toolkit ==3.0.40", "cython >=3.0.0, <4.0.0", "greenback >=1.1.1, <2.0.0", "ruff>=0.9.6", "pyperclip>=1.9.0", "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] piker = "piker.cli:cli" pikerd = "piker.cli:pikerd" @@ -138,8 +153,8 @@ python-downloads = 'manual' [tool.uv.sources] 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" } +pyvnc = { git = "https://github.com/regulad/pyvnc.git" } # TODO, long term we should be synced to upstream `main` branch! # tractor = { git = "https://github.com/goodboy/tractor.git", branch ="piker_pin" }