cartertemm / AI-content-describer

NVDA add-on that provides descriptions for controls and images, powered by GPT4
GNU General Public License v2.0
48 stars 24 forks source link

Addon doesn't work with a Braille Display #15

Closed Marc2p closed 8 months ago

Marc2p commented 8 months ago

Hi, I have tried this addon with a person who uses a Braille display. It turns out that when the Braille display is connected to the computer, the addon does not work, whether the option 'Open each result in a browseable dialog; Markdown will be rendered if possible' is checked or not. When the Braille display is disconnected, the addon works perfectly. The display is a Focus 40 Blue (Freedom Scientifics) and NVDA version is 2023.3.4.

cartertemm commented 8 months ago

@Marc2p

Thank you for the report. Would you be able to clarify what you mean when you say the add-on "does not work?"

I do not currently have a braille display in my possession, but I will reach out to users that do and get their experiences. Hopefully in doing that I will be able to dig into what might be causing the problem.

Marc2p commented 8 months ago

I'm sorry. I meant to say that when the Braille display is connected and I try to describe the image with the addon, NVDA says "Retrieving description" and beeps, but it doesn't do anything else afterwards. It doesn't display any kind of error generating the description nor does the "Timed out" message appear. I send the log generated by NVDA NVDALog.txt

cartertemm commented 8 months ago

@Marc2p

When I try to click on that link, I get a 404 error even though I am logged into GitHub. If you prefer, would you mind trying to send it to me via email, cartertemm (at) gmail (dot) com?

Thank you!

bramd commented 8 months ago

I have the same problem, relevant log at the end of this comment. This is using latest NVDA alpha, I suspect some new code in core is breaking ui.message when it is called from another thread (which should just work as far as I know), so this might be a core bug and not an issue with your add-on.

IO - inputCore.InputManager.executeGesture (15:22:18.406) - winInputHook (20548):
Input: kb(laptop):NVDA+shift+u
IO - tones.beep (15:22:18.459) - Thread-22 (describe_image) (24020):
Beep at pitch 300, for 200 ms, left volume 50, right volume 50
IO - speech.speech.speak (15:22:18.460) - Thread-22 (describe_image) (24020):
Speaking [LangChangeCommand ('en_GB'), 'Retrieving description...']
IO - braille.BrailleBuffer.update (15:22:18.461) - Thread-22 (describe_image) (24020):
Braille regions text: ['Retrieving description...']
IO - braille.BrailleHandler.update (15:22:18.461) - Thread-22 (describe_image) (24020):
Braille window dots: 12357 15 2345 1235 24 15 1236 24 1345 1245 - 145 15 234 14 1235 24 1234 2345 24 135 1345 46 46 46
ERROR - logHandler._threadExceptHook (15:22:18.462) - Thread-22 (describe_image) (24020):
Exception in thread Thread-22 (describe_image):
Traceback (most recent call last):
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "C:\Users\bram\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\__init__.py", line 230, in describe_image
    ui.message(_("Retrieving description..."))
  File "ui.pyc", line 148, in message
  File "braille.pyc", line 2399, in message
  File "braille.pyc", line 2411, in _resetMessageTimer
  File "wx\core.pyc", line 3492, 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
cartertemm commented 8 months ago

Hello @bramd and @Marc2p,

I believe I have fixed this issue. I'm uploading the next release here if you wouldn't mind testing it out and reporting back before I push to the addon store just to ensure I haven't missed anything.

Thanks!

cartertemm commented 8 months ago

GitHub isn't letting me upload this type of file, so I've published the release. You can find it here: https://github.com/cartertemm/AI-content-describer/releases/download/v2024.03.13/AIContentDescriber-2024.03.13.nvda-addon

bramd commented 8 months ago

@cartertemm Thanks, I can confirm this works now in the new release

Marc2p commented 8 months ago

My friend confirms that the issue has fixed. Thank you very much for the quick solution!

bramd commented 8 months ago

After some testing, it seems that the error conditions (such as time out) still fail, but the successful response works fine in the releae you provided.