Repository: spyder-ide/spyder

Issue:
Windows: something is preventing "File" and "Edit" menus being clicked
See this screencast:

![spyder-menu-bug](https://cloud.githubusercontent.com/assets/480395/6382695/94666c0e-bd96-11e4-8dc1-94d9d8166e8a.gif)

When hovering over the File and Edit menu items (and the left half of the Search menu item), the item does not raise, and clicking on it doesn't open the menu. However, once opening the menu items further to the right, by hovering over left the File and Edit menus also open.

This kind of problem is described [here](http://qt-project.org/forums/viewthread/9043/) and is apparently due to some widget being parented by MainWindow incorrectly.  I have not yet found which widget is causing this.



Discussion:
@cjrh, are you using any third party plugins?

Nope, this is raw HEAD.

It would be good to know whether this happens on another Windows machine or not.  Apparently (according to the link I posted) Mac and linux are unaffected by the parenting issue. 

I checked Spyder 2.3.2: this **does not occur**. So it is def introduced recently as I suspected.

It's probably a problem with our new use of signals and slots. Are you using PySide or PyQt4?

Both. I'm working though the history on master now.  I'll find the commit eventually.

The problem first occurs in the master branch in 29c927df7d96a8fd3d891e4bb7011894cd414010 

I'd guess `self.tour = tour.AnimatedTour(self)` is the offending [line](https://github.com/spyder-ide/spyder/commit/29c927df7d96a8fd3d891e4bb7011894cd414010#diff-e13742a2ff2d16fb2f96574ff7b24a5cR919).

In `tour.py` if we change this:

``` python
class AnimatedTour(QWidget):
    """ """

    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self.parent = parent

```

to this

``` python
class AnimatedTour(QWidget):
    """ """

    def __init__(self, parent):
        QWidget.__init__(self, None)

        self.parent = parent

```

The menu problem is resolved.  We can't just pass in `None`, because the mainwindow (parent) _is still required_ inside `AnimatedTour` further down for some signal stuff.  

Of course, I don't know what else this change would break ;)

Shouldn't the tour be a Dialog or a Dock?

I don't know Qt well enough to comment on that.

That was more of a question for Carlos  :smile:

Oh and I do see this behaviour on Linux.

Ok interesting.   Good to know.  I was too lazy to check 😴

Oops, this one is on me. I will try to get this fixed. 

@cjrh can you add this to the `def __init__` of the `AnimatedTour` class inside `tour.py`?

I just want to check that it works in windows before making the PR

`self.setAttribute(Qt.WA_TransparentForMouseEvents)` 

This fixes the behavior in Linux

That works 👍

Cool thanks for checking, will make the PR


Resolving patch:
diff --git a/spyderlib/tour.py b/spyderlib/tour.py
--- a/spyderlib/tour.py
+++ b/spyderlib/tour.py
@@ -787,7 +787,7 @@ def __init__(self, parent):
 
         self.parent = parent
         
-        # variables to adjust 
+        # Variables to adjust 
         self.duration_canvas = [666, 666]
         self.duration_tips = [333, 333]
         self.opacity_canvas = [0.0, 0.7]
@@ -810,13 +810,18 @@ def __init__(self, parent):
 
         self.is_tour_set = False
 
+        # Widgets
         self.canvas = FadingCanvas(self.parent, self.opacity_canvas,
                                    self.duration_canvas, self.easing_curve,
                                    self.color)
         self.tips = FadingTipBox(self.parent, self.opacity_tips,
                                  self.duration_tips, self.easing_curve)
 
-        # signals and slots
+        # Widgets setup
+        # Needed to fix issue #2204
+        self.setAttribute(Qt.WA_TransparentForMouseEvents)
+
+        # Signals and slots
         self.tips.button_next.clicked.connect(self.next_step)
         self.tips.button_previous.clicked.connect(self.previous_step)
         self.tips.button_close.clicked.connect(self.close_tour)


Test patch: