Mercurial > fife-parpg
changeset 314:62d1eebd1487
* Modified status bar to use a simpler and more efficient way of displaying tool tips
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 14 Aug 2009 21:40:38 +0000 |
parents | fa3778416433 |
children | 21999e058c7b |
files | clients/editor/scripts/gui/statusbar.py |
diffstat | 1 files changed, 15 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/clients/editor/scripts/gui/statusbar.py Fri Aug 14 00:59:54 2009 +0000 +++ b/clients/editor/scripts/gui/statusbar.py Fri Aug 14 21:40:38 2009 +0000 @@ -14,31 +14,30 @@ self._tooltip = None self._label = widgets.Label(text=text) self.addChild(self._label) + + self._text = u"" + self._tooltipDisplayed = False def setText(self, text): """ Sets the text to be displayed whenever a tooltip isn't displayed """ - self._label.text = text + self._text = text + if not self.isTooltipDisplayed(): + self._label.text = text def getText(self): - return self._label.text + return self._text text = property(getText, setText) def showTooltip(self, text): """ Shows a text which is visible until hideTooltip is called """ - if text == u"": - self.hideTooltip() - if self._tooltip is not None: - self._tooltip.text = text - else: - self.removeChild(self._label) - self._tooltip = widgets.Label(text=text) - self.addChild(self._tooltip) - self.adaptLayout() + self._label.text = text + self._tooltipDisplayed = True def hideTooltip(self): """ Removes the text set by showTooltip. Whatever text previously set by setText is then displayed. """ - if self._tooltip is not None: - self.removeChild(self._tooltip) - self.addChild(self._label) - self._tooltip = None - self.adaptLayout() + self._label.text = self._text + self._tooltipDisplayed = False + + def isTooltipDisplayed(self): + """ Returns true if tool tip is displayed """ + return self._tooltipDisplayed