Skip to content

Commit dabda1e

Browse files
committed
fixed many bugs
1 parent 9d95fc1 commit dabda1e

File tree

6 files changed

+57
-43
lines changed

6 files changed

+57
-43
lines changed

.idea/workspace.xml

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/faq.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,21 @@ See [Accommodating New Eye Trackers](developer.md#accommodating-new-eye-trackers
2828

2929
See [Accommodating New IDEs](developer.md#accommodating-new-ides).
3030

31-
[//]: # (Update the answer for the efficiency and storage space of CodeGRITS later.)
31+
#### Q5. How efficient is the processing of raw eye gaze data?
32+
33+
In CodeGRITS, the efficiency of the processing of gaze data is negligible. For each gaze, we calculate the average time
34+
from the timestamp in the raw data to the timestamp after all processing is complete. This processing primarily involves
35+
location mapping and upward traversal of the AST. The average delay is 4.32 ms, equating to delays of approximately
36+
12.98% for 30Hz, 25.96% for 60Hz, and 51.92% for 120Hz eye gaze data. With such
37+
a high sampling frequency, meaningful changes in the content of the code editor's page are extremely rare within this
38+
short time frame, which ensures the accuracy of gaze processing. Moreover, compared
39+
to [iTrace](https://www.i-trace.org/), our method of receiving data from the
40+
eye-tracking device is more efficient, ensuring that all sampled gazes are mapped without any loss.
41+
42+
#### Q6. How much storage space does CodeGRITS require?
43+
44+
Generally speaking, a high sample frequency generates a large amount of gaze data. To conserve storage space, we
45+
only perform upward traversal of the AST of the first gaze and record the hierarchy structure, and mark the rest
46+
as `same`. This approach significantly reduces storage space. In a previous debugging study, we set the eye-tracking
47+
device's sample frequency to 60Hz, and during the 20-minute experiment, the eye-tracking data amounted to only about
48+
40MB.

src/main/java/actions/StartStopTrackingAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
5252
return;
5353
}
5454
if (config.getEyeTrackerDevice() != 0 && !AvailabilityChecker.checkEyeTracker(config.getPythonInterpreter())) {
55-
JOptionPane.showMessageDialog(null, "Eye tracker not found. Please use mouse tracker instead.");
55+
JOptionPane.showMessageDialog(null, "Eye tracker not found. Please configure the mouse simulation first.");
5656
return;
5757
}
5858
}

src/main/java/component/AlertDialog.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ public AlertDialog(String label, Icon icon) {
3636
JLabel icon = new JLabel();
3737
label.setIcon(this.icon);
3838

39-
System.out.println(UIManager.getIcon("OptionPane.warningIcon").getIconHeight());
4039
icon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5));
4140
label.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
4241
label.setAlignmentX(Component.CENTER_ALIGNMENT);
4342
icon.setAlignmentX(Component.CENTER_ALIGNMENT);
44-
// dialogPanel.add(icon);
4543
dialogPanel.add(label);
4644

4745
return dialogPanel;

src/main/java/component/ConfigDialog.java

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,27 @@ public ConfigDialog(Project project) throws IOException, InterruptedException {
5252
setSize(500, 500);
5353
setAutoAdjustable(true);
5454
setResizable(false);
55-
if (new File("config.json").exists()) {
56-
loadConfig();
55+
Config config = new Config();
56+
if (config.configExists()) {
57+
config.loadFromJson();
58+
List<Boolean> selected = config.getCheckBoxes();
59+
for (int i = 0; i < selected.size(); i++) {
60+
checkBoxes.get(i).setSelected(selected.get(i));
61+
}
62+
pythonInterpreterTextField.setText(config.getPythonInterpreter());
5763
}
58-
addLabelArea(true);
5964
if (getPythonInterpreter().equals(selectPythonInterpreterPlaceHolder) || getPythonInterpreter().equals("python") || getPythonInterpreter().equals("python3") || getPythonInterpreter().equals("") || getPythonInterpreter().endsWith("python") || getPythonInterpreter().endsWith("python3") || getPythonInterpreter().endsWith("python.exe") || getPythonInterpreter().endsWith("python3.exe")) {
65+
6066
pythonEnvironment = AvailabilityChecker.checkPythonEnvironment(getPythonInterpreter());
6167
if (pythonEnvironment && checkBoxes.get(1).isSelected()) {
6268
eyeTracker = AvailabilityChecker.checkEyeTracker(getPythonInterpreter());
6369
if (eyeTracker) { //eye tracker found, add mouse and eye tracker name, add eye tracker freq
6470
String trackerName = AvailabilityChecker.getEyeTrackerName(getPythonInterpreter());
6571
if (trackerName != null && !trackerName.equals("Not Found")) {
6672
deviceCombo.removeAllItems();
67-
deviceCombo.addItem(trackerName);
6873
deviceCombo.addItem("Mouse");
69-
deviceCombo.setSelectedIndex(0);
74+
deviceCombo.addItem(trackerName);
75+
deviceCombo.setSelectedIndex(1);
7076
}
7177
List<String> freqList = AvailabilityChecker.getFrequencies(getPythonInterpreter());
7278
freqCombo.removeAllItems();
@@ -81,8 +87,7 @@ public ConfigDialog(Project project) throws IOException, InterruptedException {
8187
freqCombo.addItem(60.0);
8288
freqCombo.addItem(120.0);
8389
}
84-
}
85-
if (!checkBoxes.get(1).isSelected() || !pythonEnvironment) {
90+
} else {
8691
freqCombo.setEnabled(false);
8792
deviceCombo.setEnabled(false);
8893
freqCombo.removeAllItems();
@@ -93,11 +98,8 @@ public ConfigDialog(Project project) throws IOException, InterruptedException {
9398
freqCombo.addItem(120.0);
9499
}
95100
}
96-
Config config = new Config();
97-
if (config.configExists()) {
98-
config.loadFromJson();
99-
// load freq
100-
freqCombo.setSelectedItem(config.getSampleFreq());
101+
if (new File("config.json").exists()) {
102+
loadConfig();
101103
}
102104
}
103105

@@ -114,16 +116,21 @@ private void loadConfig() {
114116
for (int i = 0; i < selected.size(); i++) {
115117
checkBoxes.get(i).setSelected(selected.get(i));
116118
}
117-
118119
labelAreas = new ArrayList<>();
119120
for (int i = 0; i < labels.size(); i++) {
120121
addLabelArea(false);
121122
labelAreas.get(i).setText(labels.get(i));
122123
}
124+
addLabelArea(true);
123125
freqCombo.setSelectedItem(freq);
124126
pythonInterpreterTextField.setText(config.getPythonInterpreter());
125127
dataOutputTextField.setText(config.getDataOutputPath());
126-
deviceCombo.setSelectedIndex(config.getEyeTrackerDevice());
128+
129+
if (deviceCombo.getItemCount() > 1){
130+
deviceCombo.setSelectedIndex(config.getEyeTrackerDevice());
131+
} else {
132+
deviceCombo.setSelectedIndex(0);
133+
}
127134
if (!checkBoxes.get(1).isSelected()) {
128135
freqCombo.setEnabled(false);
129136
deviceCombo.setEnabled(false);
@@ -202,14 +209,9 @@ protected JComponent createCenterPanel() {
202209
checkBoxes.add(screenRecording);
203210
checkBoxPanel.add(screenRecording);
204211

205-
JCheckBox transmitData = new JCheckBox("Transmit Data");
206-
// checkBoxes.add(transmitData);
207-
// checkBoxPanel.add(transmitData);
208-
209212
iDETracking.setBorder(new EmptyBorder(contentMargin));
210213
eyeTracking.setBorder(new EmptyBorder(contentMargin));
211214
screenRecording.setBorder(new EmptyBorder(contentMargin));
212-
transmitData.setBorder(new EmptyBorder(contentMargin));
213215

214216
panel.add(checkBoxPanel);
215217

@@ -223,7 +225,6 @@ protected JComponent createCenterPanel() {
223225
pythonInterpreterLabel.setHorizontalTextPosition(JLabel.LEFT);
224226
panel.add(pythonInterpreterLabel);
225227

226-
// pythonInterpreterTextField = new TextFieldWithBrowseButton();
227228
pythonInterpreterTextField.setEditable(false);
228229
pythonInterpreterTextField.setMaximumSize(new Dimension(500, 40));
229230
pythonInterpreterTextField.setBorder(new EmptyBorder(contentMargin));
@@ -265,7 +266,6 @@ protected void textChanged(@NotNull DocumentEvent e) {
265266

266267
panel.add(pythonInterpreterTextField);
267268

268-
269269
JLabel dataOutputLabel = new JLabel("Data Output Path");
270270
dataOutputLabel.setHorizontalTextPosition(JLabel.LEFT);
271271
dataOutputLabel.setBorder(new EmptyBorder(JBUI.insetsLeft(20)));
@@ -277,15 +277,6 @@ protected void textChanged(@NotNull DocumentEvent e) {
277277
dataOutputTextField.setText(selectDataOutputPlaceHolder);
278278
dataOutputTextField.setAlignmentX(Component.LEFT_ALIGNMENT);
279279
dataOutputTextField.addBrowseFolderListener(new TextBrowseFolderListener(new FileChooserDescriptor(false, true, false, false, false, false)));
280-
//
281-
// new ComponentValidator(getDisposable()).withValidator(() -> {
282-
// String text = dataOutputTextField.getText();
283-
// if (text.equals("Select Data Output Folder")) {
284-
// return new ValidationInfo("Please select a data output folder", dataOutputTextField.getTextField());
285-
// }
286-
// return null;
287-
// }).installOn(dataOutputTextField.getTextField());
288-
289280

290281
panel.add(dataOutputTextField);
291282

@@ -321,6 +312,7 @@ protected void textChanged(@NotNull DocumentEvent e) {
321312

322313
eyeTracking.addChangeListener(e -> {
323314
freqCombo.setEnabled(eyeTracking.isSelected());
315+
deviceCombo.setEnabled(eyeTracking.isSelected());
324316
});
325317

326318
JPanel labelAreaPanel = new JPanel();
@@ -333,7 +325,6 @@ protected void textChanged(@NotNull DocumentEvent e) {
333325
labelAreaPanel.add(labels);
334326
panel.add(labelAreaPanel);
335327

336-
337328
eyeTracking.addActionListener(actionEvent -> {
338329
if (!pythonEnvironment) {
339330
eyeTracking.setSelected(false);
@@ -355,26 +346,23 @@ protected void textChanged(@NotNull DocumentEvent e) {
355346
String trackerName = AvailabilityChecker.getEyeTrackerName(getPythonInterpreter());
356347
if (trackerName != null && !trackerName.equals("Not Found")) {
357348
deviceCombo.removeAllItems();
358-
deviceCombo.addItem(trackerName);
359349
deviceCombo.addItem("Mouse");
350+
deviceCombo.addItem(trackerName);
351+
deviceCombo.setSelectedIndex(1);
360352
}
361-
deviceCombo.setSelectedIndex(0);
362353
List<String> freqList = AvailabilityChecker.getFrequencies(getPythonInterpreter());
363354
freqCombo.removeAllItems();
364355
for (String freq : freqList) {
365356
freqCombo.addItem(Double.parseDouble(freq));
366357
}
367358
new AlertDialog("Eye tracker found.", AllIcons.General.InspectionsOK).show();
368-
369-
370359
}
371360
} catch (IOException | InterruptedException e) {
372361
throw new RuntimeException(e);
373362
}
374363
}
375364
});
376365

377-
378366
return panel;
379367
}
380368

src/main/java/trackers/ScreenRecorder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private void createEncoder() throws IOException {
7474
public void startRecording() throws IOException {
7575
state = 1;
7676
clipNumber = 1;
77+
timeList.clear();
7778
isRecording = true;
7879
File file = new File(dataOutputPath + "/screen_recording/frames.csv");
7980
file.getParentFile().mkdirs();

0 commit comments

Comments
 (0)