Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/main/java/utils/AvailabilityChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class AvailabilityChecker {
*/
public static boolean checkPythonEnvironment(String pythonInterpreter) throws IOException, InterruptedException {
String pythonScript = """
import tobii_research as tr
from screeninfo import get_monitors
import pyautogui
import time
Expand All @@ -41,13 +40,17 @@ public static boolean checkPythonEnvironment(String pythonInterpreter) throws IO
*/
public static boolean checkEyeTracker(String pythonInterpreter) throws IOException, InterruptedException {
String pythonScript = """
import tobii_research as tr
try:
import tobii_research as tr

found_eyetrackers = tr.find_all_eyetrackers()
if found_eyetrackers == ():
found_eyetrackers = tr.find_all_eyetrackers()
if found_eyetrackers == ():
print('Not Found')
else:
print('Found')

except ImportError:
print('Not Found')
else:
print('Found')
""";

String line = runPythonScript(pythonInterpreter, pythonScript);
Expand All @@ -62,13 +65,17 @@ public static boolean checkEyeTracker(String pythonInterpreter) throws IOExcepti
*/
public static String getEyeTrackerName(String pythonInterpreter) throws IOException, InterruptedException {
String pythonScript = """
import tobii_research as tr
try:
import tobii_research as tr

found_eyetrackers = tr.find_all_eyetrackers()
if found_eyetrackers == ():
found_eyetrackers = tr.find_all_eyetrackers()
if found_eyetrackers == ():
print('Not Found')
else:
print(found_eyetrackers[0].device_name)

except ImportError:
print('Not Found')
else:
print(found_eyetrackers[0].device_name)
""";

return runPythonScript(pythonInterpreter, pythonScript);
Expand Down