from __future__ import absolute_import
import __init__
-import wx, os, platform, types
+import wx, os, sys, platform, types
from fabmetheus_utilities import settings
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))
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)
leftConfigPanel.main = self
rightConfigPanel.main = self
return leftConfigPanel, rightConfigPanel, configPanel
-
+
def OnPopupDisplay(self, setting):
self.popup.setting = setting
self.UpdatePopup(setting)
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)