Skip to content

Commit

Permalink
Fixes for two builder crashes
Browse files Browse the repository at this point in the history
Edge case builder crashes involving modifying habituation blocks.
  • Loading branch information
jfkominsky committed Aug 4, 2023
1 parent 2c085ab commit ef2ad4a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PyHab/PyHabBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ def blockMaker(self, blockName, new=True, hab=False):
habSettingsText.text = 'Habituation (ON)'
habSettingsButton.fillColor = "DarkGreen"
# Copy over existing habituation settings.
for i,j in ['blockList'][blockName].items():
for i,j in self.settings['blockList'][blockName].items():
if i in habFields.keys():
habFields[i] = j
if self.settings['blockList'][blockName]['blockRedo'] in [1, '1', True, 'True']:
Expand Down Expand Up @@ -1395,6 +1395,7 @@ def blockMaker(self, blockName, new=True, hab=False):
elif blockUI['buttons']['text'][i].text[0] == 'H': # Since hab can have two text values.
if len(blockFlow['labels']) > 0:
habFields = self.habSettingsDlg(trialList=blockOrder, lastSet=deepcopy(habFields))

if habFields['habituation'] in [1, '1', True, 'True']:
habSettingsText.text = 'Habituation (ON)'
habSettingsButton.fillColor = "DarkGreen"
Expand Down Expand Up @@ -3882,6 +3883,8 @@ def habSettingsDlg(self, trialList, lastSet, redo=False): #Habituation criteria

return self.habSettingsDlg(trialList, lastSetDat, redo=True)

else:
return lastSet


def saveDlg(self):
Expand Down

0 comments on commit ef2ad4a

Please sign in to comment.