From: Daid Date: Mon, 12 Mar 2012 18:52:55 +0000 (+0100) Subject: Possibly fix the popups for MacOS X-Git-Tag: RC1~101 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ef278b6b1d6ba61f361eaf51e1858ee90d3c15df;p=cura.git Possibly fix the popups for MacOS --- diff --git a/SkeinPyPy_NewUI/newui/configBase.py b/SkeinPyPy_NewUI/newui/configBase.py index 7f55448c..f1a66421 100644 --- a/SkeinPyPy_NewUI/newui/configBase.py +++ b/SkeinPyPy_NewUI/newui/configBase.py @@ -1,7 +1,7 @@ from __future__ import absolute_import import __init__ -import wx, os, platform, types +import wx, os, sys, platform, types from fabmetheus_utilities import settings @@ -18,7 +18,7 @@ class configWindowBase(wx.Frame): super(configWindowBase, self).__init__(None, title=title) self.settingControlList = [] - + #Create the popup window self.popup = wx.PopupWindow(self, wx.BORDER_SIMPLE) self.popup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) @@ -27,7 +27,10 @@ class configWindowBase(wx.Frame): self.popup.sizer = wx.BoxSizer() self.popup.sizer.Add(self.popup.text, flag=wx.EXPAND|wx.ALL, border=1) self.popup.SetSizer(self.popup.sizer) - + + self.popup.Bind(wx.EVT_MOTION, self.OnPopupHide) + self.popup.text.Bind(wx.EVT_MOTION, self.OnPopupHide) + def CreateConfigTab(self, nb, name): leftConfigPanel, rightConfigPanel, configPanel = self.CreateConfigPanel(nb) nb.AddPage(configPanel, name) @@ -48,7 +51,7 @@ class configWindowBase(wx.Frame): leftConfigPanel.main = self rightConfigPanel.main = self return leftConfigPanel, rightConfigPanel, configPanel - + def OnPopupDisplay(self, setting): self.popup.setting = setting self.UpdatePopup(setting) @@ -125,6 +128,10 @@ class SettingRow(): self.ctrl.Bind(wx.EVT_ENTER_WINDOW, lambda e: panel.main.OnPopupDisplay(self)) self.ctrl.Bind(wx.EVT_LEAVE_WINDOW, panel.main.OnPopupHide) + #MacOS X doesn't get EVT_ENTER/LEAVE_WINDOW for controls. So we use the motion event then. This results in slightly less good popups, but it works. + if sys.platform == 'darwin': + self.ctrl.Bind(wx.EVT_MOTION, lambda e: panel.main.OnPopupDisplay(self)) + self.defaultBGColour = self.ctrl.GetBackgroundColour() panel.main.settingControlList.append(self)