Avoid crash when no vnc server running
parent
a3d46f713e
commit
b9fbbeb44e
|
@ -301,7 +301,13 @@ async def get_bars(
|
||||||
else:
|
else:
|
||||||
|
|
||||||
log.warning('Sending CONNECTION RESET')
|
log.warning('Sending CONNECTION RESET')
|
||||||
await data_reset_hack(reset_type='connection')
|
res = await data_reset_hack(reset_type='connection')
|
||||||
|
if not res:
|
||||||
|
log.warning(
|
||||||
|
'NO VNC DETECTED!\n'
|
||||||
|
'Manually press ctrl-alt-f on your IB java app'
|
||||||
|
)
|
||||||
|
# break
|
||||||
|
|
||||||
with trio.move_on_after(timeout) as cs:
|
with trio.move_on_after(timeout) as cs:
|
||||||
for name, ev in [
|
for name, ev in [
|
||||||
|
@ -842,7 +848,10 @@ async def data_reset_hack(
|
||||||
client.mouse.click()
|
client.mouse.click()
|
||||||
client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked
|
client.keyboard.press('Ctrl', 'Alt', key) # keys are stacked
|
||||||
|
|
||||||
await tractor.to_asyncio.run_task(vnc_click_hack)
|
try:
|
||||||
|
await tractor.to_asyncio.run_task(vnc_click_hack)
|
||||||
|
except OSError:
|
||||||
|
return False
|
||||||
|
|
||||||
# we don't really need the ``xdotool`` approach any more B)
|
# we don't really need the ``xdotool`` approach any more B)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue