Skip to content

Commit

Permalink
BF: Code Type is now set correctly on opening the dialog
Browse files Browse the repository at this point in the history
Previously, the code type was forced to either Auto->JS, or Both, because
code type selection was conditional based on whether metapensiero was
installed. This fix now unselects Auto->JS if metapensiero is not
installed, but otherwise loads previously selected code type.
  • Loading branch information
dvbridges committed Feb 19, 2020
1 parent 276eee8 commit 5c57d0c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions psychopy/app/builder/dialogs/dlgsCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ def __init__(self, frame, title, params, order,
self.nameOKlabel.SetForegroundColour(wx.RED)
elif paramName == 'Code Type':
_codeTypes = self.params['Code Type'].allowedVals
_selectedCodeType = self.params['Code Type'].val
_selectedCodeTypeIndex = _codeTypes.index(_selectedCodeType)
self.codeTypeMenu = wx.Choice(self, choices=_codeTypes)
self.codeTypeMenu.SetSelection(
_codeTypes.index(_codeTypes[hasMetapensiero - 2]))

if not hasMetapensiero and _selectedCodeType.lower() == 'auto->js':
_selectedCodeTypeIndex -= 1

self.codeTypeMenu.SetSelection(_selectedCodeTypeIndex)
self.codeTypeMenu.Bind(wx.EVT_CHOICE, self.onCodeChoice)
self.codeTypeName = wx.StaticText(self, wx.ID_ANY,
_translate(param.label))
Expand Down

0 comments on commit 5c57d0c

Please sign in to comment.