internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: psychopy/psychopy

Issue:
Eye tracking Calibration: Not presented if MouseGaze used
The calibration routine does not present if MouseGaze is the eye tracking device type. 


Discussion:
This is most likely because of the "Disable Component" issue or issue of component gui state != 'internal' state. If you generate the python script, is there any call to calibration? I have had to be generatng python script from Builder to check things like this to see if it is Builder not genrating expected code.
 

Resolving patch:
diff --git a/psychopy/app/builder/dialogs/__init__.py b/psychopy/app/builder/dialogs/__init__.py
--- a/psychopy/app/builder/dialogs/__init__.py
+++ b/psychopy/app/builder/dialogs/__init__.py
@@ -150,7 +150,7 @@ def __init__(self, dlg, label, param, parent, fieldName,
         elif param.inputType == 'bool':
             self.valueCtrl = paramCtrls.BoolCtrl(parent,
                                          name=fieldName,size=wx.Size(self.valueWidth, 24))
-            self.valueCtrl.SetValue(bool(param.val))
+            self.valueCtrl.SetValue(bool(param))
         elif param.inputType == 'file' or browse:
             self.valueCtrl = paramCtrls.FileCtrl(parent,
                                                  val=str(param.val), valType=param.valType,
diff --git a/psychopy/experiment/params.py b/psychopy/experiment/params.py
--- a/psychopy/experiment/params.py
+++ b/psychopy/experiment/params.py
@@ -273,6 +273,13 @@ def __ne__(self, other):
     def __bool__(self):
         """Return a bool, so we can do `if thisParam`
         rather than `if thisParam.val`"""
+        if self.val in ['True', 'true', 'TRUE', True, 1, 1.0]:
+            # Return True for aliases of True
+            return True
+        if self.val in ['False', 'false', 'FALSE', False, 0, 0.0]:
+            # Return False for aliases of False
+            return False
+        # If not a clear alias, use bool method of value
         return bool(self.val)
 
     @property


Test patch:
Repository: psychopy/psychopy

Issue:
Polygon: "constant" blocked in vertices parameter
In the polygon component the "constant" dropdown is disabled/greyed out in the vertices field (cannot be set every repeat/frame)


Discussion:

Resolving patch:
diff --git a/psychopy/experiment/components/__init__.py b/psychopy/experiment/components/__init__.py
--- a/psychopy/experiment/components/__init__.py
+++ b/psychopy/experiment/components/__init__.py
@@ -292,6 +292,9 @@ def getInitVals(params, target="PsychoPy"):
         elif name == 'buttonRequired':
             inits[name].val = "True"
             inits[name].valType = 'code'
+        elif name == 'vertices':
+            inits[name].val = "[[-0.5,-0.5], [-0.5, 0.5], [0.5, 0.5], [0.5, -0.5]]"
+            inits[name].valType = 'code'
         else:
             print("I don't know the appropriate default value for a '%s' "
                   "parameter. Please email the mailing list about this error" %
diff --git a/psychopy/experiment/components/polygon/__init__.py b/psychopy/experiment/components/polygon/__init__.py
--- a/psychopy/experiment/components/polygon/__init__.py
+++ b/psychopy/experiment/components/polygon/__init__.py
@@ -88,7 +88,7 @@ def __init__(self, exp, parentName, name='polygon', interpolate='linear',
         self.params['vertices'] = Param(
             vertices, valType='list', inputType='single', categ='Basic',
             updates='constant',
-            allowedUpdates=['constant'],
+            allowedUpdates=['constant', 'set every repeat', 'set every frame'],
             hint=msg,
             label=_translate("Vertices")
         )


Test patch:
Repository: psychopy/psychopy

Issue:
Adding a loop to an empty timeline raises an error
I tried to add a loop to an empty timeline, which admittedly doesn't make a lot of sense to do. It did raise an error though:
```
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py", line 3171, in OnMouse
    self.setLoopPoint2()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py", line 3045, in setLoopPoint2
    self.drawEntryPoints([self.entryPointPosList[0], x])
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py", line 3447, in drawEntryPoints
    self.pdc.DrawCircle(pos, self.linePos[1], ptSize)
TypeError: PseudoDC.DrawCircle(): arguments did not match any overloaded call:
  overload 1: argument 1 has unexpected type 'NoneType'
  overload 2: argument 1 has unexpected type 'NoneType'
```
PS - This happened in an experiment that originally contained 4 routines, that I had first deleted.


Discussion:
I think the solution here is to grey out the Add Loop button when there's no routines, so rather than letting people do this and then erroring because it doesn't make any sense, we just stop them doing it in the first place.

Resolving patch:
diff --git a/psychopy/app/builder/builder.py b/psychopy/app/builder/builder.py
--- a/psychopy/app/builder/builder.py
+++ b/psychopy/app/builder/builder.py
@@ -3030,6 +3030,8 @@ def insertRoutine(self, ii):
         self.frame.addToUndoStack("ADD Routine `%s`" % rtn.name)
         # reset flow drawing (remove entry point)
         self.clearMode()
+        # enable/disable add loop button
+        self.btnInsertLoop.Enable(bool(len(self.frame.exp.flow)))
 
     def setLoopPoint1(self, evt=None):
         """Someone pushed the insert loop button.
@@ -3316,6 +3318,8 @@ def removeComponent(self, component, compID):
         # perform the actual removal
         flow.removeComponent(component, id=compID)
         self.draw()
+        # enable/disable add loop button
+        self.btnInsertLoop.Enable(bool(len(flow)))
 
     def OnPaint(self, event):
         # Create a buffered paint DC.  It will create the real


Test patch:
Repository: psychopy/psychopy

Issue:
What's this error message exactly?
I'm wondering what that symbol between "or" and "no spaces" should mean? 

![image](https://user-images.githubusercontent.com/8987504/121728088-b3a19f00-cae4-11eb-8655-a6fd9bf67a6b.png)



Discussion:
Every character has to be alphanumeric (`[A-Za-z\d]`) or an underscore, definitely could word that error better... I'll look up where it's defined

Resolving patch:
diff --git a/psychopy/app/builder/validators.py b/psychopy/app/builder/validators.py
--- a/psychopy/app/builder/validators.py
+++ b/psychopy/app/builder/validators.py
@@ -391,7 +391,7 @@ def check(self, parent):
                     ).format(used=_translate(used))
                 OK = False
             elif not namespace.isValid(newName):  # valid as a var name
-                msg = _translate("Name must be alpha-numeric or _, no spaces")
+                msg = _translate("Name can only contain letters, numbers and underscores (_), no spaces or other symbols")
                 OK = False
             # warn but allow, chances are good that its actually ok
             elif namespace.isPossiblyDerivable(newName):


Test patch:
Repository: psychopy/psychopy

Issue:
PsychoJS code generation: setting text in a textbox doesn't show up
[This experiment](https://github.com/psychopy/psychojs_testing/tree/main/tests/wdio_textbox) contains a non-editable textbox that presents the content of a variable named `$msg`. In a code component, begin routine tab, this variable is set to the value `"this is a test"`. I compiled this experiment to JS with a current version of the dev branch of PsychoPy. However, this value isn't shown. It seems two things are going wrong at the side of the code generation:
1. The `setText(msg)` part is before the "begin routine" part that assigns a value to `msg`
2. Because `reset()` is called after `setText(msg)`, the textbox is emptied again.

Below some JS as was generated:
```
textbox1_2.setText(msg)
textbox1_2.reset()
msg = "This is a test";
```

Below an adjustment that can make the text display
```
msg = "This is a test";
textbox1_2.reset()
textbox1_2.setText(msg)
```


Discussion:

Resolving patch:
diff --git a/psychopy/experiment/components/textbox/__init__.py b/psychopy/experiment/components/textbox/__init__.py
--- a/psychopy/experiment/components/textbox/__init__.py
+++ b/psychopy/experiment/components/textbox/__init__.py
@@ -257,12 +257,11 @@ def writeRoutineStartCode(self, buff):
         BaseVisualComponent.writeRoutineStartCode(self, buff)
 
     def writeRoutineStartCodeJS(self, buff):
-        BaseVisualComponent.writeRoutineStartCode(self, buff)
-
         code = (
-            "%(name)s.reset()"
+            "%(name)s.reset();"
         )
         buff.writeIndentedLines(code % self.params)
+        BaseVisualComponent.writeRoutineStartCode(self, buff)
 
     def writeRoutineEndCode(self, buff):
         name = self.params['name']


Test patch:
Repository: psychopy/psychopy

Issue:
BUG: error when using open file from coder view
Selecting open file from coder view produces the following error (in the dev branch):

Traceback (most recent call last):
  File "C:\Users\44797\PycharmProjects\psychopy\psychopy\app\coder\coder.py", line 2374, in fileOpen
    defaultDir=initPath, style=wx.FD_OPEN
TypeError: FileDialog(): argument 'defaultDir' has unexpected type 'NoneType'



Discussion:

Resolving patch:
diff --git a/psychopy/app/builder/builder.py b/psychopy/app/builder/builder.py
--- a/psychopy/app/builder/builder.py
+++ b/psychopy/app/builder/builder.py
@@ -668,7 +668,7 @@ def fileOpen(self, event=None, filename=None, closeCurrent=True):
             if self.filename:
                 initPath = str(Path(self.filename).parent)
             else:
-                initPath = None
+                initPath = ""
             # Open dlg
             dlg = wx.FileDialog(self, message=_translate("Open file ..."),
                                 defaultDir=initPath,
diff --git a/psychopy/app/coder/coder.py b/psychopy/app/coder/coder.py
--- a/psychopy/app/coder/coder.py
+++ b/psychopy/app/coder/coder.py
@@ -2367,7 +2367,7 @@ def fileOpen(self, event=None, filename=None):
             if hasattr(self.currentDoc, 'filename'):
                 initPath = str(Path(self.currentDoc.filename).parent)
             else:
-                initPath = None
+                initPath = ""
             # Open dlg
             dlg = wx.FileDialog(
                 self, message=_translate("Open file ..."),


Test patch:
Repository: psychopy/psychopy

Issue:
Eyetracking: Calibration routine, Animation Position Changes causes freeze
If the "Animate Position Changes in the Animation tab is checked/unchecked the routine freezes with a white box in the corner of the routine panel - like this https://github.com/psychopy/psychopy/issues/3944 


Discussion:
Ahh I see why this was accidentally fixed now - the thing that fixed it will be when I fixed the flicker by only laying out when there's a visibility change from checking depends. Can actually fix this properly now I know where it's erroring!

Resolving patch:
diff --git a/psychopy/app/builder/dialogs/__init__.py b/psychopy/app/builder/dialogs/__init__.py
--- a/psychopy/app/builder/dialogs/__init__.py
+++ b/psychopy/app/builder/dialogs/__init__.py
@@ -566,8 +566,8 @@ def checkDepends(self, event=None):
             if isChanged:
                 self.sizer.SetEmptyCellSize((0, 0))
                 self.sizer.Layout()
-                self.Fit()
-                self.dlg.Fit()
+                if isinstance(self.dlg, wx.Dialog):
+                    self.dlg.Fit()
                 self.Refresh()
 
         def doValidate(self, event=None):


Test patch:
Repository: psychopy/psychopy

Issue:
Slider start value doesn't affect .value, .rating or .markerPos
Even if Slider component in Builder is given a start value, it still starts off as None (so you still have to do `(slider.markerPos or 0)`)


Discussion:

Resolving patch:
diff --git a/psychopy/experiment/components/slider/__init__.py b/psychopy/experiment/components/slider/__init__.py
--- a/psychopy/experiment/components/slider/__init__.py
+++ b/psychopy/experiment/components/slider/__init__.py
@@ -222,13 +222,12 @@ def writeInitCode(self, buff):
 
         # build up an initialization string for Slider():
         initStr = ("{name} = visual.Slider(win=win, name='{name}',\n"
-                   "    size={size}, pos={pos}, units={units},\n"
+                   "    startValue={initVal}, size={size}, pos={pos}, units={units},\n"
                    "    labels={labels}, ticks={ticks}, granularity={granularity},\n"
                    "    style={styles}, styleTweaks={styleTweaks}, opacity={opacity},\n"
                    "    color={color}, fillColor={fillColor}, borderColor={borderColor}, colorSpace={colorSpace},\n"
                    "    font={font}, labelHeight={letterHeight},\n"
                    "    flip={flip}, depth={depth}, readOnly={readOnly})\n"
-                   "{name}.markerPos = {initVal}\n"
                    .format(**inits))
         buff.writeIndented(initStr)
 
diff --git a/psychopy/visual/slider.py b/psychopy/visual/slider.py
--- a/psychopy/visual/slider.py
+++ b/psychopy/visual/slider.py
@@ -51,6 +51,7 @@ def __init__(self,
                  win,
                  ticks=(1, 2, 3, 4, 5),
                  labels=None,
+                 startValue=None,
                  pos=None,
                  size=None,
                  units=None,
@@ -169,8 +170,7 @@ def __init__(self,
         self.readOnly = readOnly
 
         self.categorical = False  # will become True if no ticks set only labels
-        self.rating = None  # current value (from a response)
-        self.markerPos = None  # current value (maybe not from a response)
+        self.startValue = self.rating =  self.markerPos = startValue
         self.rt = None
         self.history = []
         self.marker = None
@@ -292,9 +292,8 @@ def reset(self):
         """Resets the slider to its starting state (so that it can be restarted
         on each trial with a new stimulus)
         """
-        self.markerPos = None
+        self.markerPos = self.rating = self.startValue
         self.history = []
-        self.rating = None
         self.rt = None
         self.responseClock.reset()
         self.status = NOT_STARTED


Test patch:
Repository: psychopy/psychopy

Issue:
gui.DlgFromDict raises KeyError when passing a dictionary of alternative labels
When I create and run a `DlgFromDict` I often want the dictionary to have useful but short names, and the dialog box to have longer, more informative names.

However if I pass any dictionary to the `gui.DlgFromDict` as a labels argument (that has at least one matching key to the `dictionary` object) then when the dialog box returns it triggers a `KeyError`

This can be replicated by adding a line after line 696 of https://github.com/psychopy/psychopy/blob/release/psychopy/gui/qtgui.py:
`labels = {'Group': 'Patient Group'},`
and then running `python -m psychopy.gui.qtgui` to run the tests.

I have some ideas for a solution, and could create a pull request to track this if you like.


Discussion:

Resolving patch:
diff --git a/psychopy/gui/qtgui.py b/psychopy/gui/qtgui.py
--- a/psychopy/gui/qtgui.py
+++ b/psychopy/gui/qtgui.py
@@ -466,6 +466,7 @@ def __init__(self, dictionary, title='', fixed=None, order=None,
             self.dictionary = dictionary
 
         self._keys = list(self.dictionary.keys())
+        self._labels = labels
 
         if order:
             self._keys = list(order) + list(set(self._keys).difference(set(order)))
@@ -494,8 +495,12 @@ def show(self):
         ok_data = self.exec_()
         if ok_data:
             for n, thisKey in enumerate(self._keys):
+                if thisKey in self._labels:
+                    labelKey = self._labels[thisKey]
+                else:
+                    labelKey = thisKey
                 try:
-                    self.dictionary[thisKey] = self.inputFieldTypes[thisKey](self.data[n])
+                    self.dictionary[thisKey] = self.inputFieldTypes[labelKey](self.data[n])
                 except ValueError:
                     self.dictionary[thisKey] = self.data[n]
 
@@ -694,6 +699,7 @@ def showWindow(win):
     info = {'Observer': 'jwp', 'GratingOri': 45,
             'ExpVersion': 1.1, 'Group': ['Test', 'Control']}
     dictDlg = DlgFromDict(dictionary=info, title='TestExperiment',
+                          labels={'Group': 'Participant Group'},
                           fixed=['ExpVersion'])
     if dictDlg.OK:
         print(info)


Test patch:
Repository: psychopy/psychopy

Issue:
Lib list entries in Runner.getPsychoJS() need updating for PsychoJS latest



Discussion:

Resolving patch:
diff --git a/psychopy/app/runner/runner.py b/psychopy/app/runner/runner.py
--- a/psychopy/app/runner/runner.py
+++ b/psychopy/app/runner/runner.py
@@ -759,7 +759,7 @@ def getPsychoJS(self):
         """
         libPath = self.currentFile.parent / self.outputPath / 'lib'
         ver = '.'.join(self.app.version.split('.')[:3])
-        psychoJSLibs = ['core', 'data', 'util', 'visual', 'sound']
+        libFileExtensions = ['css', 'iife.js', 'iife.js.map', 'js', 'js.LEGAL.txt', 'js.map']
 
         try:  # ask-for-forgiveness rather than query-then-make
             os.makedirs(libPath)
@@ -767,11 +767,11 @@ def getPsychoJS(self):
             if e.errno != errno.EEXIST:  # we only want to ignore "exists", not others like permissions
                 raise  # raises the error again
 
-        for lib in psychoJSLibs:
-            finalPath = libPath / ("{}-{}.js".format(lib, ver))
+        for ext in libFileExtensions:
+            finalPath = libPath / ("psychojs-{}.{}".format(ver, ext))
             if finalPath.exists():
                 continue
-            url = "https://lib.pavlovia.org/{}-{}.js".format(lib, ver)
+            url = "https://lib.pavlovia.org/psychojs-{}.{}".format(ver, ext)
             req = requests.get(url)
             with open(finalPath, 'wb') as f:
                 f.write(req.content)


Test patch:
Repository: psychopy/psychopy

Issue:
Boilerplate JS for circle shape needs more edges



Discussion:

Resolving patch:
diff --git a/psychopy/experiment/components/polygon/__init__.py b/psychopy/experiment/components/polygon/__init__.py
--- a/psychopy/experiment/components/polygon/__init__.py
+++ b/psychopy/experiment/components/polygon/__init__.py
@@ -244,6 +244,10 @@ def writeInitCodeJS(self, buff):
             code = ("{name} = new visual.Rect ({{\n"
                     "  win: psychoJS.window, name: '{name}', {unitsStr}\n"
                     "  width: {size}[0], height: {size}[1],\n")
+        elif vertices in ['circle', '100']:
+            code = ("{name} = new visual.Polygon({{\n"
+                    "  win: psychoJS.window, name: '{name}', {unitsStr}\n"
+                    "  edges: 100, size:{size},\n")
         elif vertices in ['star']:
             code = ("{name} = new visual.ShapeStim ({{\n"
                     "  win: psychoJS.window, name: '{name}', {unitsStr}\n"


Test patch:
Repository: psychopy/psychopy

Issue:
iohub mouse.setPosition inverts y position of system mouse
See https://discourse.psychopy.org/t/iohub-mouse-wrong-location-using-coder/24085/3


Discussion:
iohub `mouse.setPosition` inverts y position of system mouse on macOS.
`mouse.setPosition((0,0))` : correctly sets system cursor set to screen center
`mouse.setPosition((100,-200))` : system cursor incorrectly set to psychopy pix coord (100,200) - y value is inverted.



this is actually an issue win and macOS
Also fix:
- [ ] setPosition only seems to work when units are pix / ints.

Resolving patch:
diff --git a/psychopy/demos/coder/iohub/mouse.py b/psychopy/demos/coder/iohub/mouse.py
--- a/psychopy/demos/coder/iohub/mouse.py
+++ b/psychopy/demos/coder/iohub/mouse.py
@@ -20,8 +20,8 @@
 # some default devices have been created that can now be used
 keyboard = io.devices.keyboard
 mouse = io.devices.mouse
-
-win.setMouseVisible(False)
+mouse.setPosition((0.0, .250))
+#win.setMouseVisible(False)
 
 # Create some psychopy visual stim
 fixSpot = visual.GratingStim(win, tex="none", mask="gauss", pos=(0, 0), size=(.03, .03), color='black', autoLog=False)
diff --git a/psychopy/iohub/devices/display/__init__.py b/psychopy/iohub/devices/display/__init__.py
--- a/psychopy/iohub/devices/display/__init__.py
+++ b/psychopy/iohub/devices/display/__init__.py
@@ -583,7 +583,7 @@ def display2psychopyPix(x, y):
             return (x - w / 2), -y + h / 2
 
         def psychopy2displayPix(cx, cy):
-            return l + (cx + w / 2), t + (cy + h / 2)
+            return l + (cx + w / 2), b - (cy + h / 2)
 
         if coord_type == 'pix':
             def pix2coord(self, x, y, display_index=None):
diff --git a/psychopy/iohub/devices/mouse/__init__.py b/psychopy/iohub/devices/mouse/__init__.py
--- a/psychopy/iohub/devices/mouse/__init__.py
+++ b/psychopy/iohub/devices/mouse/__init__.py
@@ -124,7 +124,7 @@ def setPosition(self, pos, display_index=None):
             tuple: new (x,y) position of mouse in Display coordinate space.
         """
         try:
-            pos = int(pos[0]), int(pos[1])
+            pos = pos[0], pos[1]
         except Exception:
             print2err('Warning: Mouse.setPosition: pos must be a list of '
                       'two numbers, not: ', pos)
@@ -207,6 +207,9 @@ def getPositionAndDelta(self, return_display_index=False):
             self._initialMousePos()
             cpos = self._position
             lpos = self._lastPosition
+            if lpos is None:
+                lpos = cpos[0], cpos[1]
+
             change_x = cpos[0] - lpos[0]
             change_y = cpos[1] - lpos[1]
             if return_display_index is True:


Test patch: