From 581d7223a7dcaedf75c3ed410096ba3270e4f6f6 Mon Sep 17 00:00:00 2001 From: Jim Ramsay Date: Thu, 18 Mar 2010 10:52:04 -0400 Subject: [PATCH] Deprecation warning: gtk.Tooltips deprecated in pygtk 2.12 Runtime-detect whether we should use the old gtk.Tooltips interface, or the new gtk.Widget.set_tooltip_text based on the pygtk version. --- ROX-Lib2/python/rox/OptionsBox.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ROX-Lib2/python/rox/OptionsBox.py b/ROX-Lib2/python/rox/OptionsBox.py index c59ca80..1c4a10a 100644 --- a/ROX-Lib2/python/rox/OptionsBox.py +++ b/ROX-Lib2/python/rox/OptionsBox.py @@ -117,7 +117,9 @@ class OptionsBox(g.Dialog): self.trans = translation g.Dialog.__init__(self) - self.tips = g.Tooltips() + if (g.pygtk_version < (2, 12, 0)): + # gtk.Tooltips deprecated as of pygtk-2.12.0 + self.tips = g.Tooltips() self.set_has_separator(False) self.options = options_group @@ -126,8 +128,12 @@ class OptionsBox(g.Dialog): button = rox.ButtonMixed(g.STOCK_UNDO, _('_Revert')) self.add_action_widget(button, REVERT) - self.tips.set_tip(button, _('Restore all options to how they were ' - 'when the window was opened')) + revert_tooltip = _('Restore all options to how they were ' + 'when the window was opened') + if (g.pygtk_version >= (2, 12, 0)): + button.set_tooltip_text(revert_tooltip) + else: + self.tips.set_tip(button, revert_tooltip) self.add_button(g.STOCK_OK, g.RESPONSE_OK) @@ -366,7 +372,10 @@ class OptionsBox(g.Dialog): else: data = None if data: - self.tips.set_tip(widget, self.trans(data)) + if (g.pygtk_version >= (2, 12, 0)): + widget.set_tooltip_text(self.trans(data)) + else: + self.tips.set_tip(widget, self.trans(data)) def get_size_group(self, name): """Return the GtkSizeGroup for this name, creating one -- 2.11.4.GIT