From: daid Date: Wed, 14 Mar 2012 16:11:42 +0000 (+0100) Subject: After some tests with EVT_KILL_FOCUS I found something interresting. This might solve... X-Git-Tag: RC1~91 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=09cb6898ef6dfecfb98c1576cdc675f9848f34e3;p=cura.git After some tests with EVT_KILL_FOCUS I found something interresting. This might solve the issue with the popups for MacOS --- diff --git a/SkeinPyPy_NewUI/newui/configBase.py b/SkeinPyPy_NewUI/newui/configBase.py index f1a66421..7c9ec2a1 100644 --- a/SkeinPyPy_NewUI/newui/configBase.py +++ b/SkeinPyPy_NewUI/newui/configBase.py @@ -20,16 +20,13 @@ class configWindowBase(wx.Frame): self.settingControlList = [] #Create the popup window - self.popup = wx.PopupWindow(self, wx.BORDER_SIMPLE) + self.popup = wx.PopupWindow(self, flags=wx.BORDER_SIMPLE) self.popup.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK)) self.popup.setting = None self.popup.text = wx.StaticText(self.popup, -1, ''); 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) @@ -124,21 +121,23 @@ class SettingRow(): else: self.ctrl = wx.ComboBox(panel, -1, getSettingFunc(configName, defaultValue[0]), choices=defaultValue, style=wx.CB_DROPDOWN|wx.CB_READONLY) self.ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange) + + sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL) + sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|wx.EXPAND) + sizer.SetRows(x+1) - 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.ctrl.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter) + self.ctrl.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseExit) self.defaultBGColour = self.ctrl.GetBackgroundColour() panel.main.settingControlList.append(self) - - sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL) - sizer.Add(self.ctrl, (x,y+1), flag=wx.ALIGN_BOTTOM|wx.EXPAND) - sizer.SetRows(x+1) + + def OnMouseEnter(self, e): + self.panel.main.OnPopupDisplay(self) + + def OnMouseExit(self, e): + self.panel.main.OnPopupHide(self) def OnSettingChange(self, e): if self.type == 'profile':