Repository: spyder-ide/spyder

Issue:
Exploring variables in debugging mode is giving focus to the Editor
## Description of your problem

**What steps will reproduce the problem?**

1. enter the debug mode
2. go to _variable explorer_
3. double click some variable to see details

**What is the expected output? What do you see instead?**
In debug Mode, the variable explorer will open the variable windows in the background, which means that it **DOES NOT** pop out and keeps staying open in the background. 


**Please provide any additional information below**
In normal mode (click the run and the variables can be seen in the variable window), the variable window will pop out after double clicking. 

## Versions and main components

* Spyder Version:3.2.1
* Python Version:3.6.1
* Qt Version: 5.6.2
* PyQt Version: 5.6
* Operating system: Linux( Ubuntu 14.04)


## Dependencies

Please go to the menu entry `Help > Optional Dependencies` (or
`Help > Dependencies`), press the button `Copy to clipboard`
and paste the contents below:
IPython >=4.0    :  5.3.0 (OK)
cython >=0.21    :  0.25.2 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
psutil >=0.3     :  5.2.2 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.5.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
sympy >=0.7.3    :  1.0 (OK)



Discussion:
This depends on how things are handled by your window manager. For me windows appear on front.

@dalthviz, what's the behavior on Windows?
@ccordoba12 the window appears but then the focus changes immediately to the editor so, for example, the dataframe editor stays open behind the mainwindow:

![pop](https://user-images.githubusercontent.com/16781833/29647000-5e92ca36-884c-11e7-95b3-446fc154bb47.gif)

Haha, so I am not the only one anymore. 
Yep, I now know where this problem is coming from: we're giving focus to the Editor automatically after a variable is inspected.

We'll fix after we release 3.2.2.
Hi,
The 3.2.3 milestone is closed and I just noticed 3.2.4 has recently been released. Is this bug fixed in 3.2.4 ?
Nop, it wasn't. We'll take a look at it in **3.2.5**.

@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/utils/ipython/spyder_kernel.py b/spyder/utils/ipython/spyder_kernel.py
--- a/spyder/utils/ipython/spyder_kernel.py
+++ b/spyder/utils/ipython/spyder_kernel.py
@@ -65,6 +65,7 @@ def __init__(self, *args, **kwargs):
         self.namespace_view_settings = {}
         self._pdb_obj = None
         self._pdb_step = None
+        self._do_publish_pdb_state = True
 
         kernel_config = self.config.get('IPKernelApp', None)
         if kernel_config is not None:
@@ -157,6 +158,7 @@ def get_value(self, name):
             #   petitions to display a value
             value = None
             publish_data({'__spy_data__': value})
+        self._do_publish_pdb_state = False
 
     def set_value(self, name, value):
         """Set the value of a variable"""
@@ -212,11 +214,12 @@ def publish_pdb_state(self):
         Publish Variable Explorer state and Pdb step through
         publish_data.
         """
-        if self._pdb_obj:
+        if self._pdb_obj and self._do_publish_pdb_state:
             state = dict(namespace_view = self.get_namespace_view(),
                          var_properties = self.get_var_properties(),
                          step = self._pdb_step)
             publish_data({'__spy_pdb_state__': state})
+        self._do_publish_pdb_state = True
 
     def pdb_continue(self):
         """


Test patch: