Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test_gonogo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laura Rodríguez
test_gonogo
Commits
b27c8826
Commit
b27c8826
authored
Jun 05, 2025
by
Laura Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5jun
parent
ff29977d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
test_gonogo.py
+32
-8
No files found.
test_gonogo.py
View file @
b27c8826
...
@@ -13,7 +13,12 @@ import constants # Debe contener: DISPSIZE = (1920, 1080)
...
@@ -13,7 +13,12 @@ import constants # Debe contener: DISPSIZE = (1920, 1080)
import
pandas
as
pd
# Importamos pandas para guardar los resultados en un archivo Excel
import
pandas
as
pd
# Importamos pandas para guardar los resultados en un archivo Excel
import
subprocess
# Para abrir el archivo con el programa predeterminado
import
subprocess
# Para abrir el archivo con el programa predeterminado
import
os
# Para comprobar la existencia del archivo
import
os
# Para comprobar la existencia del archivo
from
PyQt6.QtWidgets
import
(
QApplication
,
QWidget
,
QVBoxLayout
,
QPushButton
,
QLabel
,
QMessageBox
)
from
PyQt6.QtGui
import
QFont
from
PyQt6.QtCore
import
Qt
# ============ FUNCIÓN DE CALIBRACIÓN ============
# ============ FUNCIÓN DE CALIBRACIÓN ============
def
calibrate_tobii
(
self
):
def
calibrate_tobii
(
self
):
...
@@ -231,6 +236,7 @@ def run_gonogo_test(self):
...
@@ -231,6 +236,7 @@ def run_gonogo_test(self):
# ============ INTERFAZ PYQT ===================
# ============ INTERFAZ PYQT ===================
class
EyeTrackingApp
(
QWidget
):
class
EyeTrackingApp
(
QWidget
):
def
__init__
(
self
):
def
__init__
(
self
):
super
()
.
__init__
()
super
()
.
__init__
()
...
@@ -243,6 +249,27 @@ class EyeTrackingApp(QWidget):
...
@@ -243,6 +249,27 @@ class EyeTrackingApp(QWidget):
def
setup_ui
(
self
):
def
setup_ui
(
self
):
self
.
setStyleSheet
(
"background-color: #e6f0ff;"
)
self
.
setStyleSheet
(
"background-color: #e6f0ff;"
)
button_style
=
"""
QPushButton {
background-color: #3399ff;
color: white;
padding: 10px;
border-radius: 5px;
font-weight: bold;
}
QPushButton:hover {
background-color: #1a8cff;
color: #e6f7ff;
}
QPushButton:pressed {
background-color: #006bb3;
color: #ccf2ff;
padding-top: 11px;
padding-bottom: 9px;
}
"""
layout
=
QVBoxLayout
()
layout
=
QVBoxLayout
()
title
=
QLabel
(
"Test Go/NoGo con Tobii"
)
title
=
QLabel
(
"Test Go/NoGo con Tobii"
)
...
@@ -252,19 +279,19 @@ class EyeTrackingApp(QWidget):
...
@@ -252,19 +279,19 @@ class EyeTrackingApp(QWidget):
self
.
btn_calibrate
=
QPushButton
(
"Calibrar"
)
self
.
btn_calibrate
=
QPushButton
(
"Calibrar"
)
self
.
btn_calibrate
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_calibrate
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_calibrate
.
setStyleSheet
(
"background-color: #3399ff; color: white; padding: 10px; border-radius: 5px;"
)
self
.
btn_calibrate
.
setStyleSheet
(
button_style
)
self
.
btn_calibrate
.
clicked
.
connect
(
self
.
calibrate
)
self
.
btn_calibrate
.
clicked
.
connect
(
self
.
calibrate
)
layout
.
addWidget
(
self
.
btn_calibrate
)
layout
.
addWidget
(
self
.
btn_calibrate
)
self
.
btn_test
=
QPushButton
(
"Iniciar test Go/NoGo"
)
self
.
btn_test
=
QPushButton
(
"Iniciar test Go/NoGo"
)
self
.
btn_test
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_test
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_test
.
setStyleSheet
(
"background-color: #3399ff; color: white; padding: 10px; border-radius: 5px;"
)
self
.
btn_test
.
setStyleSheet
(
button_style
)
self
.
btn_test
.
clicked
.
connect
(
self
.
start_test
)
self
.
btn_test
.
clicked
.
connect
(
self
.
start_test
)
layout
.
addWidget
(
self
.
btn_test
)
layout
.
addWidget
(
self
.
btn_test
)
self
.
btn_results
=
QPushButton
(
"Consultar resultados"
)
self
.
btn_results
=
QPushButton
(
"Consultar resultados"
)
self
.
btn_results
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_results
.
setFont
(
QFont
(
"Arial"
,
14
))
self
.
btn_results
.
setStyleSheet
(
"background-color: #3399ff; color: white; padding: 10px; border-radius: 5px;"
)
self
.
btn_results
.
setStyleSheet
(
button_style
)
self
.
btn_results
.
clicked
.
connect
(
self
.
view_results
)
self
.
btn_results
.
clicked
.
connect
(
self
.
view_results
)
layout
.
addWidget
(
self
.
btn_results
)
layout
.
addWidget
(
self
.
btn_results
)
...
@@ -276,7 +303,7 @@ class EyeTrackingApp(QWidget):
...
@@ -276,7 +303,7 @@ class EyeTrackingApp(QWidget):
self
.
calibrated
=
True
self
.
calibrated
=
True
QMessageBox
.
information
(
self
,
"Calibración"
,
"Calibración completada con éxito."
)
QMessageBox
.
information
(
self
,
"Calibración"
,
"Calibración completada con éxito."
)
else
:
else
:
QMessageBox
.
critical
(
self
,
"Error"
,
"La calibraci
i
ón ha fallado."
)
QMessageBox
.
critical
(
self
,
"Error"
,
"La calibración ha fallado."
)
def
start_test
(
self
):
def
start_test
(
self
):
# if not self.calibrated:
# if not self.calibrated:
...
@@ -286,11 +313,8 @@ class EyeTrackingApp(QWidget):
...
@@ -286,11 +313,8 @@ class EyeTrackingApp(QWidget):
def
view_results
(
self
):
def
view_results
(
self
):
file_path
=
"gonogo_results.xlsx"
file_path
=
"gonogo_results.xlsx"
# Verificamos si el archivo existe antes de intentar abrirlo
if
os
.
path
.
exists
(
file_path
):
if
os
.
path
.
exists
(
file_path
):
try
:
try
:
# Abrimos el archivo con el programa predeterminado (Windows)
subprocess
.
Popen
([
file_path
],
shell
=
True
)
subprocess
.
Popen
([
file_path
],
shell
=
True
)
except
Exception
as
e
:
except
Exception
as
e
:
QMessageBox
.
critical
(
self
,
"Error"
,
f
"No se pudo abrir el archivo Excel. {e}"
)
QMessageBox
.
critical
(
self
,
"Error"
,
f
"No se pudo abrir el archivo Excel. {e}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment