ib: passthrough host arg to vnc client for click hack
parent
e06f9dc5c0
commit
7ff8aa1ba0
|
@ -19,13 +19,21 @@
|
||||||
runnable script-programs.
|
runnable script-programs.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
from typing import Literal
|
from __future__ import annotations
|
||||||
|
from functools import partial
|
||||||
|
from typing import (
|
||||||
|
Literal,
|
||||||
|
TYPE_CHECKING,
|
||||||
|
)
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
from .._util import log
|
from .._util import log
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .api import MethodProxy
|
||||||
|
|
||||||
|
|
||||||
_reset_tech: Literal[
|
_reset_tech: Literal[
|
||||||
'vnc',
|
'vnc',
|
||||||
|
@ -39,7 +47,9 @@ _reset_tech: Literal[
|
||||||
|
|
||||||
|
|
||||||
async def data_reset_hack(
|
async def data_reset_hack(
|
||||||
|
proxy: MethodProxy,
|
||||||
reset_type: str = 'data',
|
reset_type: str = 'data',
|
||||||
|
**kwargs,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
'''
|
'''
|
||||||
|
@ -71,10 +81,17 @@ async def data_reset_hack(
|
||||||
'''
|
'''
|
||||||
global _reset_tech
|
global _reset_tech
|
||||||
|
|
||||||
|
client: 'IBCLIENTTHING' = proxy._aio_ns.ib.client
|
||||||
|
|
||||||
match _reset_tech:
|
match _reset_tech:
|
||||||
case 'vnc':
|
case 'vnc':
|
||||||
try:
|
try:
|
||||||
await tractor.to_asyncio.run_task(vnc_click_hack)
|
await tractor.to_asyncio.run_task(
|
||||||
|
partial(
|
||||||
|
vnc_click_hack,
|
||||||
|
host=client.host,
|
||||||
|
)
|
||||||
|
)
|
||||||
except OSError:
|
except OSError:
|
||||||
_reset_tech = 'i3ipc_xdotool'
|
_reset_tech = 'i3ipc_xdotool'
|
||||||
try:
|
try:
|
||||||
|
@ -94,10 +111,11 @@ async def data_reset_hack(
|
||||||
|
|
||||||
|
|
||||||
async def vnc_click_hack(
|
async def vnc_click_hack(
|
||||||
|
host: str = 'localhost',
|
||||||
reset_type: str = 'data'
|
reset_type: str = 'data'
|
||||||
) -> None:
|
) -> None:
|
||||||
'''
|
'''
|
||||||
Reset the data or netowork connection for the VNC attached
|
Reset the data or network connection for the VNC attached
|
||||||
ib gateway using magic combos.
|
ib gateway using magic combos.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -106,7 +124,7 @@ async def vnc_click_hack(
|
||||||
import asyncvnc
|
import asyncvnc
|
||||||
|
|
||||||
async with asyncvnc.connect(
|
async with asyncvnc.connect(
|
||||||
'localhost',
|
host,
|
||||||
port=3003,
|
port=3003,
|
||||||
# password='ibcansmbz',
|
# password='ibcansmbz',
|
||||||
) as client:
|
) as client:
|
||||||
|
|
Loading…
Reference in New Issue