From bebba4b3662368eed0f8db6a5b4111a9c1f02d97 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Wed, 7 Oct 2009 20:01:39 +0000 Subject: [PATCH] Bug 0003063: gtk.Tooltips is deprecated -- second batch of updates svn: r13340 --- src/DisplayTabs/_BackRefList.py | 4 +--- src/DisplayTabs/_ButtonTab.py | 16 +++++++--------- src/Editors/ObjectEntries.py | 9 ++++----- src/Editors/_EditFamily.py | 23 +++++++---------------- src/ExportAssistant.py | 6 ++---- src/FilterEditor/_EditRule.py | 12 +++++------- src/plugins/tool/MediaManager.py | 4 +--- src/widgets/buttons.py | 5 ++--- src/widgets/expandcollapsearrow.py | 5 ++--- src/widgets/labels.py | 5 ++--- 10 files changed, 33 insertions(+), 56 deletions(-) diff --git a/src/DisplayTabs/_BackRefList.py b/src/DisplayTabs/_BackRefList.py index b4b35dc11..62239c335 100644 --- a/src/DisplayTabs/_BackRefList.py +++ b/src/DisplayTabs/_BackRefList.py @@ -91,8 +91,7 @@ class BackRefList(EmbeddedList): Method has signature of, and overrides create_buttons from _ButtonTab.py """ self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked) - self.tooltips = gtk.Tooltips() - self.tooltips.set_tip(self.edit_btn, _('Edit reference')) + self.edit_btn.set_tooltip_text(_('Edit reference')) hbox = gtk.HBox() hbox.set_spacing(6) @@ -104,7 +103,6 @@ class BackRefList(EmbeddedList): self.del_btn = None self.track_ref_for_deletion("edit_btn") - self.track_ref_for_deletion("tooltips") self.track_ref_for_deletion("add_btn") self.track_ref_for_deletion("del_btn") diff --git a/src/DisplayTabs/_ButtonTab.py b/src/DisplayTabs/_ButtonTab.py index 8711a5b17..c0862aa19 100644 --- a/src/DisplayTabs/_ButtonTab.py +++ b/src/DisplayTabs/_ButtonTab.py @@ -99,8 +99,6 @@ class ButtonTab(GrampsTab): """ self.dirty_selection = False GrampsTab.__init__(self,dbstate, uistate, track, name) - self.tooltips = gtk.Tooltips() - self.track_ref_for_deletion("tooltips") self.create_buttons(share_button, move_buttons, jump_button) def create_buttons(self, share_button, move_buttons, jump_button): @@ -118,23 +116,23 @@ class ButtonTab(GrampsTab): self.track_ref_for_deletion("edit_btn") self.track_ref_for_deletion("del_btn") - self.tooltips.set_tip(self.add_btn, self._MSG['add']) - self.tooltips.set_tip(self.edit_btn, self._MSG['edit']) - self.tooltips.set_tip(self.del_btn, self._MSG['del']) + self.add_btn.set_tooltip_text(self._MSG['add']) + self.edit_btn.set_tooltip_text(self._MSG['edit']) + self.del_btn.set_tooltip_text(self._MSG['del']) if share_button: self.share_btn = SimpleButton(gtk.STOCK_INDEX, self.share_button_clicked) - self.tooltips.set_tip(self.share_btn, self._MSG['share']) + self.share_btn.set_tooltip_text(self._MSG['share']) self.track_ref_for_deletion("share_btn") else: self.share_btn = None if move_buttons: self.up_btn = SimpleButton(gtk.STOCK_GO_UP, self.up_button_clicked) - self.tooltips.set_tip(self.up_btn, self._MSG['up']) + self.up_btn.set_tooltip_text(self._MSG['up']) self.down_btn = SimpleButton(gtk.STOCK_GO_DOWN, self.down_button_clicked) - self.tooltips.set_tip(self.down_btn, self._MSG['down']) + self.down_btn.set_tooltip_text(self._MSG['down']) self.track_ref_for_deletion("up_btn") self.track_ref_for_deletion("down_btn") else: @@ -155,7 +153,7 @@ class ButtonTab(GrampsTab): if jump_button: self.jump_btn = SimpleButton(gtk.STOCK_JUMP_TO, self.jump_button_clicked) self.track_ref_for_deletion("jump_btn") - self.tooltips.set_tip(self.jump_btn, self._MSG['jump']) + self.jump_btn.set_tooltip_text(self._MSG['jump']) else: self.jump_btn = None diff --git a/src/Editors/ObjectEntries.py b/src/Editors/ObjectEntries.py index c7086566d..413f8b254 100644 --- a/src/Editors/ObjectEntries.py +++ b/src/Editors/ObjectEntries.py @@ -87,7 +87,6 @@ class ObjEntry(object): self.set_val = set_val self.uistate = uistate self.track = track - self.tooltips = gtk.Tooltips() #connect drag and drop self._init_dnd() @@ -219,25 +218,25 @@ class ObjEntry(object): image.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_BUTTON) image.show() self.share.add(image) - self.tooltips.set_tip(self.share, self.DEL_STR) + self.share.set_tooltip_text(self.DEL_STR) if self.add_edt is not None: image = gtk.Image() image.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_BUTTON) image.show() self.add_edt.add(image) - self.tooltips.set_tip(self.add_edt, self.EDIT_STR) + self.add_edt.set_tooltip_text(self.EDIT_STR) else: image = gtk.Image() image.set_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON) image.show() self.share.add(image) - self.tooltips.set_tip(self.share, self.SHARE_STR) + self.share.set_tooltip_text(self.SHARE_STR) if self.add_edt is not None: image = gtk.Image() image.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON) image.show() self.add_edt.add(image) - self.tooltips.set_tip(self.add_edt, self.ADD_STR) + self.add_edt.set_tooltip_text(self.ADD_STR) class PlaceEntry(ObjEntry): """ diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index dfaf3daa0..1a8f867b6 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -410,13 +410,10 @@ class EditFamily(EditPrimary): def __init__(self, dbstate, uistate, track, family): - self.tooltips = gtk.Tooltips() EditPrimary.__init__(self, dbstate, uistate, track, family, dbstate.db.get_family_from_handle, dbstate.db.get_family_from_gramps_id) - self.track_ref_for_deletion("tooltips") - # look for the scenerio of a child and no parents on a new # family @@ -591,12 +588,9 @@ class EditFamily(EditPrimary): self.mbutton_del = self.top.get_object('mbutton_del') self.mbutton_edit = self.top.get_object('mbutton_edit') - self.tooltips.set_tip(self.mbutton_index, - _("Select a person as the mother")) - self.tooltips.set_tip(self.mbutton_add, - _("Add a new person as the mother")) - self.tooltips.set_tip(self.mbutton_del, - _("Remove the person as the mother")) + mbutton_index.set_tooltip_text(_("Select a person as the mother")) + mbutton_add.set_tooltip_text(_("Add a new person as the mother")) + mbutton_del.set_tooltip_text(_("Remove the person as the mother")) self.mbutton_edit.connect('button-press-event', self.edit_mother) self.mbutton_edit.connect('key-press-event', self.edit_mother) @@ -609,12 +603,9 @@ class EditFamily(EditPrimary): self.fbutton_del = self.top.get_object('fbutton_del') self.fbutton_edit = self.top.get_object('fbutton_edit') - self.tooltips.set_tip(self.fbutton_index, - _("Select a person as the father")) - self.tooltips.set_tip(self.fbutton_add, - _("Add a new person as the father")) - self.tooltips.set_tip(self.fbutton_del, - _("Remove the person as the father")) + self.fbutton_index.set_tooltip_text(_("Select a person as the father")) + self.fbutton_add.set_tooltip_text(_("Add a new person as the father")) + self.fbutton_del.set_tooltip_text(_("Remove the person as the father")) self.fbutton_edit.connect('button-press-event', self.edit_father) self.fbutton_edit.connect('key-press-event', self.edit_father) @@ -935,7 +926,7 @@ class EditFamily(EditPrimary): if death and death.get_type() == gen.lib.EventType.BURIAL: death_label.set_label(_("Burial:")) - self.tooltips.set_tip(btn_edit, _('Edit %s') % name) + btn_edit.set_tooltip_text(_('Edit %s') % name) btn_index.hide() btn_add.hide() btn_del.show() diff --git a/src/ExportAssistant.py b/src/ExportAssistant.py index affe453d4..317fe8ad4 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -198,8 +198,6 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : table.set_row_spacings(6) table.set_col_spacings(6) - tip = gtk.Tooltips() - group = None recent_type = Config.get(Config.RECENT_EXPORT_TYPE) @@ -208,11 +206,11 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) : description= self.__exporters[ix].get_description() button = gtk.RadioButton(group,title) + button.set_tooltip_text(description) if not group: group = button self.format_buttons.append(button) - table.attach(button,0,2,2*ix,2*ix+1) - tip.set_tip(button,description) + table.attach(button, 0, 2, 2*ix, 2*ix+1) if ix == recent_type : button.set_active(True) diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index 3abcf8b81..e1a734083 100644 --- a/src/FilterEditor/_EditRule.py +++ b/src/FilterEditor/_EditRule.py @@ -264,10 +264,8 @@ class MyID(gtk.HBox): self.button.show() self.pack_start(self.entry) self.add(self.button) - self.tooltips = gtk.Tooltips() - self.tooltips.set_tip(self.button, _('Select %s from a list') + self.button.set_tooltip_text(_('Select %s from a list') % self.obj_name[namespace]) - self.tooltips.enable() self.show() self.set_text('') @@ -313,13 +311,13 @@ class MyID(gtk.HBox): def set_text(self, val): if not val: - self.tooltips.set_tip(self.entry, self._empty_id_txt) + self.entry.set_tooltip_text(self._empty_id_txt) else: try: name = self.name_from_gramps_id(val) - self.tooltips.set_tip(self.entry, name) + self.entry.set_tooltip_text(name) except AttributeError: - self.tooltips.set_tip(self.entry, self._invalid_id_txt) + self.entry.set_tooltip_text(self._invalid_id_txt) self.entry.set_text(val) @@ -334,7 +332,7 @@ class MySource(MyID): ' with no source.') def __init__(self, dbstate, uistate, track): MyID.__init__(self, dbstate, uistate, track, namespace='Source') - self.tooltips.set_tip(self.entry, self._empty_id_txt) + self.entry.set_tooltip_text(self._empty_id_txt) #------------------------------------------------------------------------- # diff --git a/src/plugins/tool/MediaManager.py b/src/plugins/tool/MediaManager.py index e724fc9e5..526bbf065 100644 --- a/src/plugins/tool/MediaManager.py +++ b/src/plugins/tool/MediaManager.py @@ -145,19 +145,17 @@ class MediaMan(Tool.Tool): table.set_row_spacings(6) table.set_col_spacings(6) - tip = gtk.Tooltips() - group = None for ix in range(len(self.batch_ops)): title = self.batch_ops[ix].title description= self.batch_ops[ix].description button = gtk.RadioButton(group,title) + button.set_tooltip_text(description) if not group: group = button self.batch_op_buttons.append(button) table.attach(button,0,2,2*ix,2*ix+1,yoptions=0) - tip.set_tip(button,description) box.add(table) return box diff --git a/src/widgets/buttons.py b/src/widgets/buttons.py index fa059ecd4..ed3519d20 100644 --- a/src/widgets/buttons.py +++ b/src/widgets/buttons.py @@ -123,7 +123,6 @@ class PrivacyButton(object): def __init__(self, button, obj, readonly=False): self.button = button self.button.connect('toggled', self._on_toggle) - self.tooltips = gtk.Tooltips() self.obj = obj self.set_active(obj.get_privacy()) self.button.set_sensitive(not readonly) @@ -146,12 +145,12 @@ class PrivacyButton(object): if obj.get_active(): # image.set_from_icon_name('stock_lock', gtk.ICON_SIZE_MENU) image.set_from_stock('gramps-lock', gtk.ICON_SIZE_MENU) - self.tooltips.set_tip(obj, _('Record is private')) + obj.set_tooltip_text(_('Record is private')) self.obj.set_privacy(True) else: # image.set_from_icon_name('stock_lock-open', gtk.ICON_SIZE_MENU) image.set_from_stock('gramps-unlock', gtk.ICON_SIZE_MENU) - self.tooltips.set_tip(obj, _('Record is public')) + obj.set_tooltip_text(_('Record is public')) self.obj.set_privacy(False) image.show() obj.add(image) diff --git a/src/widgets/expandcollapsearrow.py b/src/widgets/expandcollapsearrow.py index 44bd66612..c68282576 100644 --- a/src/widgets/expandcollapsearrow.py +++ b/src/widgets/expandcollapsearrow.py @@ -76,13 +76,12 @@ class ExpandCollapseArrow(gtk.EventBox): @param pair: user param for onbuttonpress function """ gtk.EventBox.__init__(self) - self.tooltips = gtk.Tooltips() if collapsed : self.arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_OUT) - self.tooltips.set_tip(self, _("Expand this section")) + self.set_tooltip_text(_("Expand this section")) else: self.arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_OUT) - self.tooltips.set_tip(self, _("Collapse this section")) + self.set_tooltip_text(_("Collapse this section")) self.add(self.arrow) self.connect('button-press-event', onbuttonpress, pair) self.connect('realize', realize_cb) diff --git a/src/widgets/labels.py b/src/widgets/labels.py index 8d1eacc6a..b9fd0de2f 100644 --- a/src/widgets/labels.py +++ b/src/widgets/labels.py @@ -84,17 +84,16 @@ class LinkLabel(gtk.EventBox): gtk.EventBox.__init__(self) self.orig_text = cgi.escape(label[0]) self.gender = label[1] - self.tooltips = gtk.Tooltips() self.decoration = decoration text = '%s' % (self.decoration, self.orig_text) if func: - msg = _('Click to make the active person\n' + msg = _('Click to make this person active\n' 'Right click to display the edit menu') if not Config.get(Config.RELEDITBTN): msg += "\n" + _('Edit icons can be enabled in the Preferences dialog') - self.tooltips.set_tip(self, msg) + self.set_tooltip_text(msg) self.label = gtk.Label(text) self.label.set_use_markup(True)