#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
#based on the plcopen standard.
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
#See COPYING file for copyrights details.
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#General Public License for more details.
#You should have received a copy of the GNU General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from controls.CustomToolTip import CustomToolTip, TOOLTIP_WAIT_PERIOD
#-------------------------------------------------------------------------------
# Tool Tip Producer class
#-------------------------------------------------------------------------------
Class that implements an element that generate Tool Tip
def __init__(self, parent):
@param parent: Parent Viewer
# Timer for firing Tool tip display
self.ToolTipTimer = wx.Timer(self.Parent, -1)
self.Parent.Bind(wx.EVT_TIMER,
def OnToolTipTimer(self, event):
Callback for Tool Tip firing timer Event
@param event: Tool tip text
value = self.GetToolTipValue()
if value is not None and self.ToolTipPos is not None:
self.ToolTip = CustomToolTip(self.Parent, value)
self.ToolTip.SetToolTipPosition(self.ToolTipPos)
def GetToolTipValue(self):
Generic method that have to be overridden by derived classes
@return: Tool tip text (None if not overridden)
def DisplayToolTip(self, pos):
@param pos: Tool tip position
# Destroy current displayed Tool tip
# Start Tool tip firing timer
int(TOOLTIP_WAIT_PERIOD * 1000),
def SetToolTipText(self, text):
Set current Tool tip text
@param text: Tool tip Text
if self.ToolTip is not None:
self.ToolTip.SetTip(text)
def DestroyToolTip(self):
Destroy current displayed Tool Tip
# Stop Tool tip firing timer
if self.ToolTip is not None: