Skip to content

Commit

Permalink
Fix 'info' kind of view for WxPython backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
corranwebster committed Mar 13, 2018
1 parent 5d9fc94 commit 884cecf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions traitsui/wx/ui_live.py
Expand Up @@ -187,7 +187,11 @@ def init(self, ui, parent, style):
window_style |= (wx.FRAME_FLOAT_ON_PARENT |
wx.FRAME_NO_TASKBAR)

window = wx.Frame(parent, -1, '', style=window_style)
if isinstance(parent, tuple):
window = wx.Frame(None, -1, '', style=window_style)
window._control_region = parent
else:
window = wx.Frame(parent, -1, '', style=window_style)
window._kind = ui.view.kind
self._monitor = MouseMonitor(ui)

Expand Down Expand Up @@ -463,18 +467,18 @@ def Notify(self):
if self.is_activated:
# Don't close the popup if any mouse buttons are currently pressed:
ms = wx.GetMouseState()
if ms.LeftDown() or ms.MiddleDown() or ms.RightDown():
if ms.LeftIsDown() or ms.MiddleIsDown() or ms.RightIsDown():
return

# Check for the special case of the mouse pointer having to be
# within the original bounds of the object the popup was created
# for:
if self.is_info:
parent = control._parent
parent = control.GetParent()
if isinstance(parent, wx.Window):
px, py, pdx, pdy = parent.GetScreenRect()
else:
px, py, pdx, pdy = parent
px, py, pdx, pdy = control._control_region
if ((mx < px) or (mx >= (px + pdx)) or
(my < py) or (my >= (py + pdy))):
ui.owner.close_popup()
Expand Down

0 comments on commit 884cecf

Please sign in to comment.