Repository: spyder-ide/spyder

Issue:
Single click to open files doesn't work in project explorer
<!--- **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! --->

### 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)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
    * [ ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ ] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below

When enabling single click to open files I find it only works on file explorer but not in project explorer. Is this the default or the functionality should work similarly in both explorers?

## Problem Description



### What steps reproduce the problem?

1. 
2. 
3. 

### What is the expected output? What do you see instead?



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 
* Python version: 
* Qt version: 
* PyQt version: 
* Operating System name/version: 

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```



Discussion:
Good point! We'll take a look at it in a future beta.

Resolving patch:
diff --git a/spyder/plugins/projects/plugin.py b/spyder/plugins/projects/plugin.py
--- a/spyder/plugins/projects/plugin.py
+++ b/spyder/plugins/projects/plugin.py
@@ -22,6 +22,7 @@
 
 # Local imports
 from spyder.config.base import _, get_home_dir
+from spyder.config.main import CONF
 from spyder.api.plugins import SpyderPluginWidget
 from spyder.py3compat import is_text_string, to_text_string
 from spyder.utils import encoding
@@ -47,11 +48,13 @@ def __init__(self, parent=None):
         SpyderPluginWidget.__init__(self, parent)
 
         self.explorer = ProjectExplorerWidget(
-                            self,
-                            name_filters=self.get_option('name_filters'),
-                            show_all=self.get_option('show_all'),
-                            show_hscrollbar=self.get_option('show_hscrollbar'),
-                            options_button=self.options_button)
+            self,
+            name_filters=self.get_option('name_filters'),
+            show_all=self.get_option('show_all'),
+            show_hscrollbar=self.get_option('show_hscrollbar'),
+            options_button=self.options_button,
+            single_click_to_open=CONF.get('explorer', 'single_click_to_open'),
+        )
 
         layout = QVBoxLayout()
         layout.addWidget(self.explorer)
@@ -165,6 +168,16 @@ def register_plugin(self):
         self.sig_pythonpath_changed.connect(self.main.pythonpath_changed)
         self.main.editor.set_projects(self)
 
+        # Connect to file explorer to keep single click to open files in sync
+        self.main.explorer.fileexplorer.sig_option_changed.connect(
+            self.set_single_click_to_open
+        )
+
+    def set_single_click_to_open(self, option, value):
+        """Set single click to open files and directories."""
+        if option == 'single_click_to_open':
+            self.explorer.treewidget.set_single_click_to_open(value)
+
     def refresh_plugin(self):
         """Refresh project explorer widget"""
         pass
diff --git a/spyder/plugins/projects/widgets/explorer.py b/spyder/plugins/projects/widgets/explorer.py
--- a/spyder/plugins/projects/widgets/explorer.py
+++ b/spyder/plugins/projects/widgets/explorer.py
@@ -173,7 +173,8 @@ class ProjectExplorerWidget(QWidget):
     sig_open_file = Signal(str)
 
     def __init__(self, parent, name_filters=[],
-                 show_all=True, show_hscrollbar=True, options_button=None):
+                 show_all=True, show_hscrollbar=True, options_button=None,
+                 single_click_to_open=False):
         QWidget.__init__(self, parent)
 
         self.name_filters = name_filters
@@ -181,8 +182,11 @@ def __init__(self, parent, name_filters=[],
         self.show_hscrollbar = show_hscrollbar
 
         self.treewidget = ExplorerTreeWidget(self, self.show_hscrollbar)
-        self.treewidget.setup(name_filters=self.name_filters,
-                              show_all=self.show_all)
+        self.treewidget.setup(
+            name_filters=self.name_filters,
+            show_all=self.show_all,
+            single_click_to_open=False,
+        )
         self.treewidget.setup_view()
         self.treewidget.hide()
 


Test patch: