From e9a364f2e62e4e4c1c5ad70e9d84360a79078172 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Sun, 18 Mar 2012 14:58:43 +0200 Subject: [PATCH] Use an alternative method to show tooltips for fittingView --- config.py | 2 +- gui/builtinViews/fittingView.py | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index d3ad6dcf6..60206591e 100644 --- a/config.py +++ b/config.py @@ -8,7 +8,7 @@ except ImportError: configforced = None # Turns on debug mode -debug = False +debug = True # Defines if our saveddata will be in pyfa root or not saveInRoot = False diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 6b2fc5873..9b73e1448 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -135,22 +135,37 @@ class FittingView(d.Display): self.itemCount = 0 self.itemRect = 0 + self.tooltip = wx.ToolTip(tip = "Miscellanea") + self.tooltip.Enable(True) + self.tooltip.SetDelay(0) + self.SetToolTip(self.tooltip) + self.Bind(wx.EVT_KEY_UP, self.kbEvent) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_RIGHT_DOWN, self.click) self.Bind(wx.EVT_SHOW, self.OnShow) self.Bind(wx.EVT_MOTION, self.OnMouseMove) + self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) self.parent.Bind(gui.chromeTabs.EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) + + def OnLeaveWindow(self, event): + self.tooltip.SetTip("") + self.tooltip.Enable(True) + event.Skip() + def OnMouseMove(self, event): row, _, col = self.HitTestSubItem(event.Position) if row != -1 and col != -1 and col < len(self.DEFAULT_COLS): mod = self.mods[self.GetItemData(row)] if self.DEFAULT_COLS[col] == "Miscellanea": tooltip = self.activeColumns[col].getToolTip(mod) - self.SetToolTipString(tooltip) + self.tooltip.SetTip(tooltip) + self.tooltip.Enable(True) else: - self.SetToolTip(None) + self.tooltip.Enable(False) + else: + self.tooltip.Enable(False) event.Skip() def handleDrag(self, type, fitID):