mo29cg / nvda-chatGPT

15 stars 7 forks source link

Doesn't work if braille display is connected #2

Closed mo29cg closed 1 year ago

mo29cg commented 1 year ago

seems like ui.message doesn't work with braille display?

I put the secret key, but when I press nvda-shift-l for example, I obtain this from the log:

ERROR - stderr (14:14:44.895) - Thread-12 (13368):
Exception in thread Thread-12:
Traceback (most recent call last):
  File "threading.pyc", line 926, in _bootstrap_inner
  File "threading.pyc", line 870, in run
  File "D:\Users\MI09424\Desktop\xnvda\userConfig\addons\nvdaChatGPT\globalPlugins\nvdaChatGPT\__init__.py", line 110, in askChatGPT
    ui.message(functionStartMessage)
  File "ui.pyc", line 133, in message
  File "braille.pyc", line 2307, in message
  File "braille.pyc", line 2321, in _resetMessageTimer
  File "wx\core.pyc", line 3451, in __init__
  File "wx\core.pyc", line 3472, in Start
wx._core.wxAssertionError: C++ assertion "wxThread::IsMain()" failed at ..\..\src\common\timerimpl.cpp(57) in wxTimerImpl::Start(): timer can only be started from the main thread
mo29cg commented 1 year ago
4. Regarding the bug with braille:
Maybe ui.message cannot be called from another thread than main thread? If this is the case, you may call instead:
core.callLater(0, lambda: ui.message("sending the sentence to chatGPT"))
I do not know if this limitation is old or has appeared with NVDA 2023.1; I know that Leonard has done some braille rework for 2023.1 so I do not know if it is linked.
mo29cg commented 1 year ago

probably fixed in https://github.com/mo29cg/nvda-chatGPT/commit/08cc00cd2dd392f3b32d7fa4ff0e278984104b0a