Skip to content

Conversation

@jnareb
Copy link
Contributor

@jnareb jnareb commented Sep 10, 2025

Because of how AvailibilityChecker.checkPythonEnvironment() was set up, the tobii_research module had to be installed in the selected Python environment even when one wanted to use Mouse emulation.

Installing tobii_research is more difficult than installing pyautogui because tobii_research requires specific Python version, namely Python 3.10 (or Python 3.8, but with more work). Switching to non-default version of Python is more work.

I have tested that mouse emulation work with these changes, but I was not able to check if tracking with Tobii still works.

This field is to be used in the cases where eye-tracker hardware
(or eye-tracker emulation) returns position in pixels, rather than
normalized position in the 0.0..1.0 that needs to be rescaled.
Now tobii_research [1][2] module does not need to be installed
to be able to use mouse emulation.

[1]: https://developer.tobiipro.com/python.html
[2]: https://pypi.org/project/tobii-research/

This change removes 'import tobii_research as tr' from
checkPythonEnvironment() method, and adjusts checkEyeTracker() and
getEyeTrackerName() to work correctly even if tobii_research is not
installed.

Not tested yet.

The problem with requiring tobii_research is that it requires specific
Python version to be able to be installed: 3.8 or 3.10 [3][4][5]

[3]: https://www.tobii.com/products/software/applications-and-developer-kits/tobii-pro-sdk
[4]: https://developer.tobiipro.com/tobiiprosdk/platform-and-language.html
[5]: https://codegrits.github.io/CodeGRITS/usage-guide/#python-environment
@TTangNingzhi
Copy link
Member

Hi, thanks so much for your development and PR! I'm currently quite busy with a paper deadline this week. After that, I will review the PR and integrate it soon.

This should fix the sporadic RuntimeExceptionWithAttachments exception
in CodeGRITS plugin that happens on some projects when running eye
tracker.

  com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments:
  Read access is allowed from inside read-action only (see Application.runReadAction());
  If you access or modify model on EDT consider wrapping your code in WriteIntentReadAction ;
  see https://jb.gg/ij-platform-threading for details
  [...]
    at trackers.EyeTracker.getASTStructureElement(EyeTracker.java:450)
    at trackers.EyeTracker.lambda$processRawData$1(EyeTracker.java:306)

This fix is based on the  https://stackoverflow.com/q/76809649 and
the discussion in issue codegrits#17 .
@jnareb
Copy link
Contributor Author

jnareb commented Sep 16, 2025

I should re-do this pull request using a separate branch to avoid introducing unrelated commits.

I have forgot how pull requests in GitHub work, namely that they automatically update to most recent version of the branch...

@jnareb
Copy link
Contributor Author

jnareb commented Sep 16, 2025

Replaced by PR #19

@jnareb jnareb closed this Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants