Skip to content

Commit

Permalink
Merge pull request #1214 from AllenNeuralDynamics/production_testing
Browse files Browse the repository at this point in the history
[update main] 2024-12-17
  • Loading branch information
XX-Yin authored Dec 18, 2024
2 parents f6de347 + 1113c39 commit 7ffc205
Show file tree
Hide file tree
Showing 6 changed files with 404 additions and 197 deletions.
28 changes: 14 additions & 14 deletions src/foraging_gui/Dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __init__(self, MainWindow,parent=None):
self._UpdateFigure()
self.setWindowTitle('Water Calibration: {}'.format(self.MainWindow.current_box))
self.Warning.setText('')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
# find all buttons and set them to not be the default button
for container in [self]:
for child in container.findChildren((QtWidgets.QPushButton)):
Expand Down Expand Up @@ -412,7 +412,7 @@ def _Finished(self):
self.StartCalibratingLeft.setEnabled(True)
self.StartCalibratingRight.setEnabled(True)
self.Warning.setText('Calibration Finished')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')


def _Continue(self):
Expand Down Expand Up @@ -515,7 +515,7 @@ def _StartCalibratingLeft(self):
self.StartCalibratingLeft.setChecked(False)
self.StartCalibratingLeft.setStyleSheet("background-color : none")
self.Warning.setText('Calibration was terminated!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.StartCalibratingRight.setEnabled(True)
return

Expand Down Expand Up @@ -666,7 +666,7 @@ def _StartCalibratingRight(self):
self.StartCalibratingRight.setChecked(False)
self.StartCalibratingRight.setStyleSheet("background-color : none")
self.Warning.setText('Calibration was terminated!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.StartCalibratingRight.setEnabled(True)
return

Expand Down Expand Up @@ -816,7 +816,7 @@ def _CalibrationStatus(self,opentime, weight_before, i, cycle, interval):
'\nTime remaining: {}'.format(self._TimeRemaining(
i,cycle,opentime,interval))
)
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')

def _Save(self,valve,valve_open_time,valve_open_interval,cycle,total_water,tube_weight,append=False):
'''save the calibrated result and update the figure'''
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def _SpotCheck(self, valve: Literal['Left', 'Right']):
'\nTime remaining: {}'.format(self._TimeRemaining(
i, self.SpotCycle, open_time, self.SpotInterval))
)
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')

# set the valve open time
getattr(self.MainWindow.Channel, f'{valve}Value')(float(open_time) * 1000)
Expand Down Expand Up @@ -1558,12 +1558,12 @@ def _Capture(self):
self.Warning.setText('')
if self.Location_1.currentText()=='Both':
self.Warning.setText('Data not captured! Please choose left or right, not both!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.Warning.setAlignment(Qt.AlignCenter)
return
if self.LaserPowerMeasured.text()=='':
self.Warning.setText('Data not captured! Please enter power measured!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.Warning.setAlignment(Qt.AlignCenter)
return
for attr_name in dir(self):
Expand Down Expand Up @@ -1600,7 +1600,7 @@ def _Save(self):
except Exception as e:
logging.error(str(e))
self.Warning.setText('Data not saved! Please Capture the power first!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.Warning.setAlignment(Qt.AlignCenter)
return
# delete invalid indices
Expand Down Expand Up @@ -1684,7 +1684,7 @@ def _Save(self):
self.Warning.setText('')
if LaserCalibrationResults=={}:
self.Warning.setText('Data not saved! Please enter power measured!')
self.Warning.setStyleSheet(self.MainWindow.default_warning_color)
self.Warning.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')
self.Warning.setAlignment(Qt.AlignCenter)
return
self.MainWindow.LaserCalibrationResults=LaserCalibrationResults
Expand Down Expand Up @@ -2296,7 +2296,7 @@ def update_auto_train_fields(self,
self.label_curriculum_name.setText('subject not found')
self.label_last_actual_stage.setText('subject not found')
self.label_next_stage_suggested.setText('subject not found')
self.label_subject_id.setStyleSheet(self.MainWindow.default_warning_color)
self.label_subject_id.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')

# disable some stuff
self.checkBox_override_stage.setChecked(False)
Expand Down Expand Up @@ -2380,7 +2380,7 @@ def update_auto_train_fields(self,
else:
self.label_last_actual_stage.setText('irrelevant (curriculum overridden)')
self.label_next_stage_suggested.setText('irrelevant')
self.label_next_stage_suggested.setStyleSheet(self.MainWindow.default_warning_color)
self.label_next_stage_suggested.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')

# Set override stage automatically
self.checkBox_override_stage.setChecked(True)
Expand Down Expand Up @@ -2815,7 +2815,7 @@ def update_auto_train_lock(self, engaged):
for widget in self.widgets_locked_by_auto_train:
# Exclude some fields so that RAs can change them without going off-curriculum
# See https://github.com/AllenNeuralDynamics/aind-behavior-blog/issues/620
if widget.objectName() in ["StopIgnores", "MaxTrial", "MaxTime"]:
if widget.objectName() in ["auto_stop_ignore_win", "MaxTrial", "MaxTime"]:
continue
widget.setEnabled(False)
# set the border color to green
Expand Down Expand Up @@ -2857,7 +2857,7 @@ def update_auto_train_lock(self, engaged):
widget.setStyleSheet("")
self.MainWindow.TrainingParameters.setStyleSheet("")
self.MainWindow.label_auto_train_stage.setText("off curriculum")
self.MainWindow.label_auto_train_stage.setStyleSheet(self.MainWindow.default_warning_color)
self.MainWindow.label_auto_train_stage.setStyleSheet(f'color: {self.MainWindow.default_warning_color};')


# enable override
Expand Down
Loading

0 comments on commit 7ffc205

Please sign in to comment.