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

Issue:
Variable inspector opens window out of focus
## Issue Report Checklist

* [X] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [X] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [X] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [X] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [X] Reset preferences with ``spyder --reset``
    * [X] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [X] Tried the other applicable steps from the Troubleshooting Guide


## Problem Description
When I open a variable like a list or dict in python and I try to open a long string field, the new variable window for the long string is opened behind the main list (or dict) variable window previously opened.

<img width="681" alt="imagen" src="https://user-images.githubusercontent.com/46159929/82662724-ae9a5500-9c2e-11ea-8d20-1b448a529784.png">


### What steps reproduce the problem?

1. Create a list or dict with a field with a long string
2. Open the list/dict in variable explorer
3. The string editor is opened behind the list/dict variable window


### Versions

* Spyder version: From 4.0.0 to 4.1.3 with the same issue
* Python version: 3.7.6
* Qt version: 5.9.6
* PyQt version: 5.9.2
* Operating System name/version: macos Catalina 10.15.4


Discussion:
Thanks for reporting.

@goanpeca, please take a look at this one (I thought you already fixed it some time ago).
>(I thought you already fix it some time ago).

Can't recall.

Resolving patch:
diff --git a/spyder/plugins/variableexplorer/widgets/texteditor.py b/spyder/plugins/variableexplorer/widgets/texteditor.py
--- a/spyder/plugins/variableexplorer/widgets/texteditor.py
+++ b/spyder/plugins/variableexplorer/widgets/texteditor.py
@@ -10,6 +10,7 @@
 
 # Standard library imports
 from __future__ import print_function
+import sys
 
 # Third party imports
 from qtpy.QtCore import Qt, Slot
@@ -78,7 +79,12 @@ def __init__(self, text, title='', font=None, parent=None, readonly=False):
         self.layout.addLayout(btn_layout)
 
         # Make the dialog act as a window
-        self.setWindowFlags(Qt.Window)
+        if sys.platform == 'darwin':
+            # See spyder-ide/spyder#12825
+            self.setWindowFlags(Qt.Tool)
+        else:
+            # Make the dialog act as a window
+            self.setWindowFlags(Qt.Window)
 
         self.setWindowIcon(ima.icon('edit'))
         if title:


Test patch:
Repository: spyder-ide/spyder

Issue:
Some improvements to the Find pane
While taking a look at this pane with @juanis2112 to update its documentation, we noticed a couple of things that are worth improving on it:

* Its options and context menus show two entries called "Collapse Section"/"Expand section", as shown below

    ![Selección_002](https://user-images.githubusercontent.com/365293/86488992-7fe0c580-bd28-11ea-8e07-897c9c59d668.png)

    We consider they can be removed because that can be achieved by simply pressing the folding arrow on the left.

    ![Selección_003](https://user-images.githubusercontent.com/365293/86489047-a999ec80-bd28-11ea-9d8f-db37c1e0d213.png)

    The really useful entries are "Collapse all"/"Expand all" because it can be quite time consuming to go file by file to collapse its results.

* The past list of excluded extensions is shown in its dropdown menu, like this

    ![Selección_004](https://user-images.githubusercontent.com/365293/86489133-f5e52c80-bd28-11ea-8c71-c271a4231a95.png)

    However, new entries in that dropdown are only added when you press `Enter` on it. That's kind of counterintuitive, because you'd expect that they are also added when you press `Enter` in the main search field or simply start a search with the `Search` button. That's why we should fix that to match user expectations.


Discussion:
@steff456, please work on this one.

Resolving patch:
diff --git a/spyder/plugins/findinfiles/widgets.py b/spyder/plugins/findinfiles/widgets.py
--- a/spyder/plugins/findinfiles/widgets.py
+++ b/spyder/plugins/findinfiles/widgets.py
@@ -674,6 +674,9 @@ def _check_find(self):
             self.stop.emit()
         else:
             self.find.emit()
+            # Update comboboxes when the user searchs using any button or
+            # action. For further information see spyder-ide/spyder#13178
+            self.update_combos()
 
     def refresh_buttons(self, start=False):
         """Refresh start/stop of buttons."""
@@ -964,6 +967,10 @@ def __init__(self, parent, text_color=None, max_results=1000):
         self.setUniformRowHeights(True)  # Needed for performance
         self.sortByColumn(0, Qt.AscendingOrder)
 
+        # Only show the actions for collaps/expand all entries in the widget
+        # For further information see spyder-ide/spyder#13178
+        self.common_actions = self.common_actions[:2]
+
         # Signals
         self.header().sectionClicked.connect(self.sort_section)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Traceback from the Files pane (AttributeError: 'FindInFilesWidget' object has no attribute 'extras_toolbar')
There is an error in the console regarding the Files pane (running with master):
```python
Traceback (most recent call last):
  File "C:\Users\Daniel\Documents\Spyder\Spyder otros\gonzalo\spyder\spyder\plugins\findinfiles\widgets.py", line 984, in <lambda>
    toggled=lambda val: self.set_option('more_options', val),
  File "C:\Users\Daniel\Documents\Spyder\Spyder otros\gonzalo\spyder\spyder\api\widgets\mixins.py", line 143, in set_option
    self._set_option(option, value, emit=True)
  File "C:\Users\Daniel\Documents\Spyder\Spyder otros\gonzalo\spyder\spyder\api\widgets\mixins.py", line 96, in _set_option
    self.on_option_update(option, value)
  File "C:\Users\Daniel\Documents\Spyder\Spyder otros\gonzalo\spyder\spyder\plugins\findinfiles\widgets.py", line 1053, in on_option_update
    self.extras_toolbar.setVisible(value)
AttributeError: 'FindInFilesWidget' object has no attribute 'extras_toolbar'
```

_Originally posted by @dalthviz in https://github.com/spyder-ide/spyder/pull/12196#issuecomment-658977813_


Discussion:

Resolving patch:
diff --git a/spyder/plugins/findinfiles/widgets.py b/spyder/plugins/findinfiles/widgets.py
--- a/spyder/plugins/findinfiles/widgets.py
+++ b/spyder/plugins/findinfiles/widgets.py
@@ -852,6 +852,8 @@ def __init__(self, name=None, plugin=None, parent=None,
         self.supported_encodings = self.get_option('supported_encodings')
         self.search_thread = None
         self.running = False
+        self.more_options_action = None
+        self.extras_toolbar = None
 
         search_text = self.get_option('search_text')
         path_history = self.get_option('path_history')
@@ -1039,7 +1041,9 @@ def update_actions(self):
 
         self.find_action.setIconText(icon_text)
         self.find_action.setIcon(icon)
-        self.extras_toolbar.setVisible(self.more_options_action.isChecked())
+        if self.extras_toolbar and self.more_options_action:
+            self.extras_toolbar.setVisible(
+                self.more_options_action.isChecked())
 
     def on_option_update(self, option, value):
         if option == 'more_options':
@@ -1050,9 +1054,13 @@ def on_option_update(self, option, value):
                 icon = self.create_icon('options_more')
                 tip = _('Show advanced options')
 
-            self.extras_toolbar.setVisible(value)
-            self.more_options_action.setIcon(icon)
-            self.more_options_action.setToolTip(tip)
+            if self.extras_toolbar:
+                self.extras_toolbar.setVisible(value)
+
+            if self.more_options_action:
+                self.more_options_action.setIcon(icon)
+                self.more_options_action.setToolTip(tip)
+
         elif option == 'max_results':
             self.result_browser.set_max_results(value)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
"Run in current namespace" missing in Spyder 5.0.0a1
The Spyder Run options are missing from the latest version of the software.
In particular, it is not possible to set the option for running scripts in "console's current namespace instead of an empty one", as described here: https://github.com/spyder-ide/spyder/pull/10032

Is there a workaround for setting "current_namespace=True" to all runfile calls?
I need to define variables on-the-fly and use them while running script files.

Thank you for your help.


Discussion:
@goanpeca, please take a look at this one.
> Is there a workaround for setting "current_namespace=True" to all runfile calls?

Sorry, there isn't.

> I need to define variables on-the-fly and use them while running script files.

Please go back to 4.1.4. 5.0.0a1 is still very alpha and has several issues we need to fix.

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -3505,7 +3505,7 @@ def _dialog_finished(result_code):
                 if widget is not None:
                     dlg.add_page(widget)
 
-            for plugin in [self.appearance, self.workingdirectory,
+            for plugin in [self.appearance, self.run, self.workingdirectory,
                            self.editor, self.projects, self.ipyconsole,
                            self.historylog, self.help, self.variableexplorer,
                            self.onlinehelp, self.explorer, self.findinfiles


Test patch:
diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py
--- a/spyder/app/tests/test_mainwindow.py
+++ b/spyder/app/tests/test_mainwindow.py
@@ -2331,6 +2331,16 @@ def preferences_dialog_helper(qtbot, main_window, section):
     return dlg, index, page
 
 
+@pytest.mark.slow
+def test_preferences_run_section_exists(main_window, qtbot):
+    """
+    Test for spyder-ide/spyder#13524 regression.
+
+    Ensure the Run section exists.
+    """
+    assert preferences_dialog_helper(qtbot, main_window, 'run')
+
+
 @pytest.mark.slow
 def test_preferences_checkboxes_not_checked_regression(main_window, qtbot):
     """
Repository: spyder-ide/spyder

Issue:
Plain text in help pane has a bug
## Problem Description
When I open spyder, go to the help pane and in the hamburger menu I activate the option `Plain Text` if the source is in the console I will see,

![image](https://user-images.githubusercontent.com/20992645/90807962-e4f67780-e2e4-11ea-8161-fcf08a75b90b.png)

If the source is editor I will see the pane empty.

Then if I write in a file in the editor `import numpy as np` and `Ctrl+I`, the pane will show me 
![image](https://user-images.githubusercontent.com/20992645/90808080-17a07000-e2e5-11ea-83e1-5df13707dc1e.png)

### What is the expected output? What do you see instead?
Remove the `No further documentation available` from the actual documentation shown in the plain text option of the help pane



Discussion:
@steff456, please take a look at this one. It shouldn't be that hard to fix.

Resolving patch:
diff --git a/spyder/plugins/help/plugin.py b/spyder/plugins/help/plugin.py
--- a/spyder/plugins/help/plugin.py
+++ b/spyder/plugins/help/plugin.py
@@ -294,9 +294,9 @@ def restore_text(self):
             cb = self._last_editor_cb
         if cb is None:
             if self.is_plain_text_mode():
-                self.plain_text.clear()
+                self.switch_to_plain_text()
             else:
-                self.rich_text.clear()
+                self.switch_to_rich_text()
         else:
             func = cb[0]
             args = cb[1:]
@@ -380,9 +380,9 @@ def set_plain_text(self, text, is_code):
                 if text['note']:
                     note = ''.join(['Type: ', text['note'], '\n\n----\n\n'])
                 else:
-                    note = _('No further documentation available')
+                    note = ''
             except TypeError:
-                definition = _('No documentation available')
+                definition = self.no_doc_string
                 note = ''
 
             full_text = ''.join([rst_title, definition, note,
@@ -720,9 +720,7 @@ def show_help(self, obj_text, ignore_unknown=False):
             if hlp_text is None:
                 hlp_text = source_text
                 if hlp_text is None:
-                    hlp_text = self.no_doc_string
-                    if ignore_unknown:
-                        return False
+                    return False
         else:
             hlp_text = source_text
             if hlp_text is None:


Test patch:
Repository: spyder-ide/spyder

Issue:
Breakpoint's hamburger menu has duplicated options than in context menu
## Problem Description

Options in the hamburger menu should be removed because they are duplicated in the context menu.

**Master**
![image](https://user-images.githubusercontent.com/20992645/91772933-6f738c80-ebab-11ea-926b-4590b12fbc88.png)

**4.x**
![image](https://user-images.githubusercontent.com/20992645/91772983-81edc600-ebab-11ea-80f8-737c4927ef30.png)


### What steps reproduce the problem?

1. Go to breakpoints plugin
2. Open the hamburger menu

### What is the expected output? What do you see instead?
Have the same hamburger menu than in 4.x





Discussion:

Resolving patch:
diff --git a/spyder/plugins/breakpoints/widgets/main_widget.py b/spyder/plugins/breakpoints/widgets/main_widget.py
--- a/spyder/plugins/breakpoints/widgets/main_widget.py
+++ b/spyder/plugins/breakpoints/widgets/main_widget.py
@@ -384,17 +384,6 @@ def get_focus_widget(self):
     def setup(self, options):
         self.breakpoints_table.setup()
 
-        clear_all_action = self.get_action(
-            BreakpointTableViewActions.ClearAllBreakpoints)
-        clear_action = self.get_action(
-            BreakpointTableViewActions.ClearBreakpoint)
-        edit_action = self.get_action(
-            BreakpointTableViewActions.EditBreakpoint)
-
-        options_menu = self.get_options_menu()
-        for item in [clear_all_action, clear_action, edit_action]:
-            self.add_item_to_menu(item, menu=options_menu)
-
     def on_option_update(self, option, value):
         pass
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Spyder crashes with `select all` + `copy all` in the help pane

## Problem Description
If I use the options of the context menu `select all` and then `copy` Spyder crashes in Windows and throws an error in macOS and Linux.

![image22](https://user-images.githubusercontent.com/20992645/91772020-a2b51c00-eba9-11ea-89f4-d57ad32ebf86.png)

![image12](https://user-images.githubusercontent.com/20992645/91772032-a8aafd00-eba9-11ea-9e45-8c8fc6371037.png)


### What steps reproduce the problem?

1. Open the help menu and request help via `Ctrl + I`
2. Open the context menu and hit `select all`
3. Open the context menu and hit `copy`
4. Spyder issue reporter appears in macOS and Linux, in Windows it crashes

### What is the expected output? What do you see instead?
Have a clean copy of the text in the clipboard



Discussion:

Resolving patch:
diff --git a/spyder/widgets/browser.py b/spyder/widgets/browser.py
--- a/spyder/widgets/browser.py
+++ b/spyder/widgets/browser.py
@@ -128,17 +128,15 @@ def setup(self, options={}):
         select_all_action = self.create_action(
             name=WebViewActions.SelectAll,
             text=_("Select all"),
-            # icon=self.create_icon(''),
             triggered=lambda: original_select_action.trigger(),
             context=Qt.WidgetWithChildrenShortcut,
         )
 
-        copy_action = self.pageAction(QWebEnginePage.Copy)
+        original_copy_action = self.pageAction(QWebEnginePage.Copy)
         copy_action = self.create_action(
             name=WebViewActions.Copy,
             text=_("Copy"),
-            # icon=self.create_icon(''),
-            triggered=lambda: copy_action.trigger(),
+            triggered=lambda: original_copy_action.trigger(),
             context=Qt.WidgetWithChildrenShortcut,
         )
 
@@ -163,7 +161,6 @@ def setup(self, options={}):
         inspect_action = self.create_action(
             name=WebViewActions.Inspect,
             text=_("Inspect"),
-            # icon=self.create_icon(''),
             triggered=lambda: original_inspect_action.trigger(),
             context=Qt.WidgetWithChildrenShortcut,
         )


Test patch:
Repository: spyder-ide/spyder

Issue:
Differences in online help pane toolbar
## Problem Description
The toolbar of the Online Help pane has some differences in master and 4.x,

1. First the buttons are in a complete different order
**Master**
![image](https://user-images.githubusercontent.com/20992645/91904898-4ca8ad00-ec6b-11ea-8f97-719f08dd7428.png)

**4.x**
![image](https://user-images.githubusercontent.com/20992645/91904918-5500e800-ec6b-11ea-96e4-c9aac469935c.png)

2. Placeholder text is different
**Master**
![image](https://user-images.githubusercontent.com/20992645/91904977-6d710280-ec6b-11ea-939b-2aded6233fdd.png)

**4.x**
![image](https://user-images.githubusercontent.com/20992645/91904998-75c93d80-ec6b-11ea-909f-5285b20c5d78.png)


### What is the expected output? What do you see instead?
The online help pane should look the same as 4.x



Discussion:

Resolving patch:
diff --git a/spyder/plugins/onlinehelp/widgets.py b/spyder/plugins/onlinehelp/widgets.py
--- a/spyder/plugins/onlinehelp/widgets.py
+++ b/spyder/plugins/onlinehelp/widgets.py
@@ -159,7 +159,7 @@ def __init__(self, name=None, plugin=None, parent=None,
         self.find_widget.set_editor(self.webview)
         self.find_widget.hide()
         self.url_combo.setMaxCount(self.get_option('max_history_entries'))
-        tip = _('Write a package name here')
+        tip = _('Write a package name here, e.g. pandas')
         self.url_combo.lineEdit().setPlaceholderText(tip)
         self.url_combo.lineEdit().setToolTip(tip)
         self.webview.setup()


Test patch:
Repository: spyder-ide/spyder

Issue:
The icon of internal console settings disappeared 
## Problem Description
The icon of the internal console settings under the hamburger menu disappeared

**Master**
![image](https://user-images.githubusercontent.com/20992645/91904142-099a0a00-ec6a-11ea-9f36-e454650cacc3.png)

**4.x**
![image](https://user-images.githubusercontent.com/20992645/91904161-14549f00-ec6a-11ea-9075-7cfcca637c55.png)


### What steps reproduce the problem?

1. Open the internal console pane
2. Go to the hamburger menu, it doesn't have an icon

### What is the expected output? What do you see instead?
See the hamburger menu as in 4.x



Discussion:

Resolving patch:
diff --git a/spyder/api/widgets/__init__.py b/spyder/api/widgets/__init__.py
--- a/spyder/api/widgets/__init__.py
+++ b/spyder/api/widgets/__init__.py
@@ -714,16 +714,18 @@ def create_toolbar(self, toolbar_id):
 
         return toolbar
 
-    def create_menu(self, menu_id, title=''):
+    def create_menu(self, menu_id, title='', icon=None):
         """
         Override SpyderMenuMixin method to use a different menu class.
 
         Parameters
         ----------
-        toolbar_id: str
+        menu_id: str
             Unique toolbar string identifier.
         title: str
             Toolbar localized title.
+        icon: QIcon or None
+            Icon to use for the menu.
 
         Returns
         -------
@@ -741,6 +743,11 @@ def create_menu(self, menu_id, title=''):
 
         menu = MainWidgetMenu(parent=self, title=title)
         menu.ID = menu_id
+
+        if icon is not None:
+            menu.menuAction().setIconVisibleInMenu(True)
+            menu.setIcon(icon)
+
         self._menus[menu_id] = menu
         return menu
 
diff --git a/spyder/api/widgets/mixins.py b/spyder/api/widgets/mixins.py
--- a/spyder/api/widgets/mixins.py
+++ b/spyder/api/widgets/mixins.py
@@ -356,9 +356,9 @@ def create_menu(self, name, text=None, icon=None):
         ----------
         name: str
             Unique str identifier.
-        text: str
+        text: str or None
             Localized text string.
-        icon: QIcon,
+        icon: QIcon or None
             Icon to use for the menu.
 
         Return: QMenu
diff --git a/spyder/plugins/console/widgets/main_widget.py b/spyder/plugins/console/widgets/main_widget.py
--- a/spyder/plugins/console/widgets/main_widget.py
+++ b/spyder/plugins/console/widgets/main_widget.py
@@ -233,6 +233,7 @@ def setup(self, options):
         internal_settings_menu = self.create_menu(
             ConsoleWidgetMenus.InternalSettings,
             _('Internal console settings'),
+            icon=self.create_icon('tooloptions'),
         )
         for item in [buffer_action, wrap_action, codecompletion_action,
                      exteditor_action]:
@@ -272,8 +273,6 @@ def on_option_update(self, option, value):
             self.shell.set_external_editor(value, '')
 
     def update_actions(self):
-        # This method is a required part of the PluginMainWidget API. On this
-        # widget it is not currently used.
         pass
 
     def get_focus_widget(self):


Test patch:
Repository: spyder-ide/spyder

Issue:
[API] Support adding icons to menus
Update the `create_menu` method to support adding icons

_Originally posted by @dalthviz in https://github.com/spyder-ide/spyder/pull/13689#discussion_r482332011_


Discussion:

Resolving patch:
diff --git a/spyder/api/widgets/mixins.py b/spyder/api/widgets/mixins.py
--- a/spyder/api/widgets/mixins.py
+++ b/spyder/api/widgets/mixins.py
@@ -348,7 +348,7 @@ def add_item_to_menu(self, action_or_menu, menu, section=None,
 
         menu.add_action(action_or_menu, section=section, before=before)
 
-    def create_menu(self, name, text=None):
+    def create_menu(self, name, text=None, icon=None):
         """
         Create a menu.
 
@@ -358,6 +358,8 @@ def create_menu(self, name, text=None):
             Unique str identifier.
         text: str
             Localized text string.
+        icon: QIcon,
+            Icon to use for the menu.
 
         Return: QMenu
             Return the created menu.
@@ -374,6 +376,10 @@ def create_menu(self, name, text=None):
             )
 
         menu = SpyderMenu(parent=self, title=text)
+        if icon is not None:
+            menu.menuAction().setIconVisibleInMenu(True)
+            menu.setIcon(icon)
+
         self._menus[name] = menu
         return menu
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Improvements to the help pane
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

## Problem Description

- [x] Add Home button  to for getting back the home screen of the pane and being able to open the tutorial. back
- [x] Change background color for the help pane home screen to the same blue in the top bar of the tutorial
- [x] In the home screen links should be green not underlined.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/help/plugin.py b/spyder/plugins/help/plugin.py
--- a/spyder/plugins/help/plugin.py
+++ b/spyder/plugins/help/plugin.py
@@ -140,6 +140,13 @@ def __init__(self, parent=None, css_path=CSS_PATH):
         auto_import_state = self.get_option('automatic_import')
         self.auto_import_action.setChecked(auto_import_state)
 
+        # Home Button
+        self.home_button = create_toolbutton(self,
+                                             triggered=self.show_intro_message,
+                                             icon=ima.icon('home'),
+                                             tip=_("Home"))
+        layout_edit.addWidget(self.home_button)
+        
         # Lock checkbox
         self.locked_button = create_toolbutton(self,
                                                triggered=self.toggle_locked)


Test patch: