From 7ba22af095ba49fcb5867160b7d72af7747e0441 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Tue, 13 Oct 2009 19:20:35 +0000 Subject: [PATCH] Bug 3290: Deprecation warnings with gtk 2.18 on Ubuntu 9.10 svn: r13368 --- src/DataViews/GrampletView.py | 17 ++-- src/DataViews/MediaView.py | 8 +- src/DataViews/PedigreeView.py | 12 ++- src/DataViews/RelationView.py | 31 +++---- src/DisplayTabs/_BackRefList.py | 3 +- src/DisplayTabs/_ButtonTab.py | 15 ++-- src/Editors/ObjectEntries.py | 9 +-- src/Editors/_EditFamily.py | 22 ++--- src/ExportAssistant.py | 4 +- src/FilterEditor/_EditRule.py | 14 ++-- src/Filters/SideBar/_SidebarFilter.py | 3 +- src/PluginUtils/_GuiOptions.py | 112 ++++++++++++-------------- src/PluginUtils/_PluginDialogs.py | 7 +- src/ViewManager.py | 2 +- src/plugins/tool/MediaManager.py | 4 +- src/widgets/buttons.py | 5 +- src/widgets/expandcollapsearrow.py | 5 +- src/widgets/labels.py | 3 +- 18 files changed, 113 insertions(+), 163 deletions(-) diff --git a/src/DataViews/GrampletView.py b/src/DataViews/GrampletView.py index ab7e0824c..ae40b51a8 100644 --- a/src/DataViews/GrampletView.py +++ b/src/DataViews/GrampletView.py @@ -174,8 +174,7 @@ def make_requested_gramplet(viewpage, name, opts, dbstate, uistate): if msg is None: msg = _("Drag Properties Button to move and click it for setup") if msg: - gui.tooltips = gtk.Tooltips() - gui.tooltips.set_tip(gui.scrolledwindow, msg) + gui.scrolledwindow.set_tooltip_text(msg) gui.tooltips_text = msg gui.make_gui_options() gui.gvoptions.hide() @@ -949,13 +948,10 @@ class GuiGramplet(object): else: tag.set_property('underline', pango.UNDERLINE_NONE) view.get_window(gtk.TEXT_WINDOW_TEXT).set_cursor(cursor) - if self.tooltips: - if ttip: - self.tooltips.set_tip(self.scrolledwindow, - ttip) - else: - self.tooltips.set_tip(self.scrolledwindow, - self.tooltips_text) + if ttip: + self.scrolledwindow.set_tooltip_text(ttip) + elif self.tooltips_text: + self.scrolledwindow.set_tooltip_text(self.tooltips_text) return False # handle event further, if necessary def on_button_press(self, view, event): @@ -1101,8 +1097,7 @@ class GrampletView(PageView.PersonNavView): # build the GUI: frame = MyScrolledWindow() msg = _("Right click to add gramplets") - self.tooltips = gtk.Tooltips() - self.tooltips.set_tip(frame, msg) + frame.set_tooltip_text(msg) frame.viewpage = self frame.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.hbox = gtk.HBox(homogeneous=True) diff --git a/src/DataViews/MediaView.py b/src/DataViews/MediaView.py index 4331be1f0..5c5ccffdd 100644 --- a/src/DataViews/MediaView.py +++ b/src/DataViews/MediaView.py @@ -275,13 +275,11 @@ class MediaView(PageView.ListView): ebox = gtk.EventBox() ebox.add(self.image) ebox.connect('button-press-event', self.button_press_event) + ebox.set_tooltip_text( + _('Double click image to view in an external viewer')) vbox.pack_start(ebox, False) vbox.pack_start(base, True) - self.ttips = gtk.Tooltips() - self.ttips.set_tip( - ebox, _('Double click image to view in an external viewer')) - self.selection.connect('changed', self.row_change) self._set_dnd() return vbox @@ -314,13 +312,11 @@ class MediaView(PageView.ListView): handle = self.first_selected() if not handle: self.image.clear() - self.ttips.disable() else: obj = self.dbstate.db.get_object_from_handle(handle) pix = ThumbNails.get_thumbnail_image( Utils.media_path_full(self.dbstate.db, obj.get_path())) self.image.set_from_pixbuf(pix) - self.ttips.enable() def ui_definition(self): """ diff --git a/src/DataViews/PedigreeView.py b/src/DataViews/PedigreeView.py index d45b2750b..1d4691982 100644 --- a/src/DataViews/PedigreeView.py +++ b/src/DataViews/PedigreeView.py @@ -527,8 +527,6 @@ class PedigreeView(PageView.PersonNavView): contains the interface. This containter will be inserted into a gtk.Notebook page. """ - self.tooltips = gtk.Tooltips() - self.tooltips.enable() self.notebook = gtk.Notebook() self.notebook.connect("button-press-event", self.bg_button_press_cb) @@ -877,7 +875,7 @@ class PedigreeView(PageView.PersonNavView): else: pw = PersonBoxWidget( self, self.format_helper, lst[i][0], lst[i][3], positions[i][0][3], image); if positions[i][0][3] < 7: - self.tooltips.set_tip(pw, self.format_helper.format_person(lst[i][0], 11)) + pw.set_tooltip_text(self.format_helper.format_person(lst[i][0], 11)) pw.connect("button-press-event", self.person_button_press_cb,lst[i][0].get_handle()) if positions[i][0][2] > 1: @@ -945,7 +943,7 @@ class PedigreeView(PageView.PersonNavView): if lst[i] and lst[i][2]: line.add_events(gtk.gdk.ENTER_NOTIFY_MASK) # Required for tooltip and mouse-over line.add_events(gtk.gdk.LEAVE_NOTIFY_MASK) # Required for tooltip and mouse-over - self.tooltips.set_tip(line, self.format_helper.format_relation(lst[i][2], 11)) + line.set_tooltip_text(self.format_helper.format_relation(lst[i][2], 11)) if lst[i*2+1]: line.set_data("frela", lst[i*2+1][1]) if lst[i*2+2]: @@ -979,7 +977,7 @@ class PedigreeView(PageView.PersonNavView): childlist = find_children(self.dbstate.db,lst[0][0]) if childlist: l.connect("clicked",self.on_show_child_menu) - self.tooltips.set_tip(l, _("Jump to child...")) + l.set_tooltip_text(_("Jump to child...")) else: l.set_sensitive(False) ymid = int(math.floor(ymax/2)) @@ -988,7 +986,7 @@ class PedigreeView(PageView.PersonNavView): l.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_IN)) if lst[1]: l.connect("clicked",self.on_childmenu_changed,lst[1][0].handle) - self.tooltips.set_tip(l, _("Jump to father")) + l.set_tooltip_text(("Jump to father")) else: l.set_sensitive(False) ymid = int(math.floor(ymax/4)) @@ -997,7 +995,7 @@ class PedigreeView(PageView.PersonNavView): l.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_IN)) if lst[2]: l.connect("clicked",self.on_childmenu_changed,lst[2][0].handle) - self.tooltips.set_tip(l, _("Jump to mother")) + l.set_tooltip_text(("Jump to mother")) else: l.set_sensitive(False) ymid = int(math.floor(ymax/4*3)) diff --git a/src/DataViews/RelationView.py b/src/DataViews/RelationView.py index 90be1681a..d98a63e66 100644 --- a/src/DataViews/RelationView.py +++ b/src/DataViews/RelationView.py @@ -431,7 +431,6 @@ class RelationshipView(PageView.PersonNavView): if self.redrawing: return False self.redrawing = True - self.tooltips = gtk.Tooltips() for old_child in self.vbox.get_children(): self.vbox.remove(old_child) @@ -539,7 +538,7 @@ class RelationshipView(PageView.PersonNavView): if Config.get(Config.RELEDITBTN): button = widgets.IconButton(self.edit_button_press, person.handle) - self.tooltips.set_tip(button, _('Edit %s') % name) + button.set_tooltip_text(_('Edit %s') % name) else: button = None hbox = widgets.LinkBox(label, button) @@ -758,28 +757,28 @@ class RelationshipView(PageView.PersonNavView): if self.reorder_sensitive: add = widgets.IconButton(self.reorder_button_press, None, gtk.STOCK_SORT_ASCENDING) - self.tooltips.set_tip(add, ord_msg) + add.set_tooltip_text(ord_msg) hbox.pack_start(add, False) add = widgets.IconButton(call_fcn, None, gtk.STOCK_ADD) - self.tooltips.set_tip(add, add_msg) + add.set_tooltip_text(add_msg) hbox.pack_start(add, False) if is_parent: add = widgets.IconButton(self.select_family, None, gtk.STOCK_INDEX) - self.tooltips.set_tip(add, sel_msg) + add.set_tooltip_text(sel_msg) hbox.pack_start(add, False) if family: edit = widgets.IconButton(self.edit_family, family.handle, gtk.STOCK_EDIT) - self.tooltips.set_tip(edit, edit_msg) + edit.set_tooltip_text(edit_msg) hbox.pack_start(edit, False) if not self.dbstate.db.readonly: delete = widgets.IconButton(del_fcn, family.handle, gtk.STOCK_REMOVE) - self.tooltips.set_tip(delete, del_msg) + delete.set_tooltip_text(del_msg) hbox.pack_start(delete, False) self.attach.attach(hbox, _BTN_START, _BTN_STOP, self.row, self.row+1) self.row += 1 @@ -884,13 +883,11 @@ class RelationshipView(PageView.PersonNavView): addchild = widgets.IconButton(self.add_child_to_fam, family.handle, gtk.STOCK_ADD) - self.tooltips.set_tip(addchild, - _('Add new child to family')) + addchild.set_tooltip_text(_('Add new child to family')) selchild = widgets.IconButton(self.sel_child_to_fam, family.handle, gtk.STOCK_INDEX) - self.tooltips.set_tip(selchild, - _('Add existing child to family')) + selchild.set_tooltip_text(_('Add existing child to family')) hbox.pack_start(addchild, False) hbox.pack_start(selchild, False) @@ -934,7 +931,7 @@ class RelationshipView(PageView.PersonNavView): if Config.get(Config.RELEDITBTN): button = widgets.IconButton(self.edit_button_press, handle) - self.tooltips.set_tip(button, _('Edit %s') % name[0]) + button.set_tooltip_text(('Edit %s') % name[0]) else: button = None vbox.pack_start(widgets.LinkBox(link_label, button), @@ -987,7 +984,7 @@ class RelationshipView(PageView.PersonNavView): link_label.modify_bg(gtk.STATE_NORMAL, self.color) if Config.get(Config.RELEDITBTN): button = widgets.IconButton(self.edit_button_press, handle) - self.tooltips.set_tip(button, _('Edit %s') % name[0]) + button.set_tooltip_text(_('Edit %s') % name[0]) else: button = None vbox.pack_start(widgets.LinkBox(link_label, button)) @@ -1074,7 +1071,7 @@ class RelationshipView(PageView.PersonNavView): link_label.set_padding(3, 0) if child_should_be_linked and Config.get(Config.RELEDITBTN): button = widgets.IconButton(self.edit_button_press, handle) - self.tooltips.set_tip(button, _('Edit %s') % name[0]) + button.set_tooltip_text(_('Edit %s') % name[0]) else: button = None @@ -1342,13 +1339,11 @@ class RelationshipView(PageView.PersonNavView): addchild = widgets.IconButton(self.add_child_to_fam, family.handle, gtk.STOCK_ADD) - self.tooltips.set_tip(addchild, - _('Add new child to family')) + addchild.set_tooltip_text(_('Add new child to family')) selchild = widgets.IconButton(self.sel_child_to_fam, family.handle, gtk.STOCK_INDEX) - self.tooltips.set_tip(selchild, - _('Add existing child to family')) + selchild.set_tooltip_text(_('Add existing child to family')) hbox.pack_start(addchild, False) hbox.pack_start(selchild, False) self.attach.attach( diff --git a/src/DisplayTabs/_BackRefList.py b/src/DisplayTabs/_BackRefList.py index 7958652e3..9b9ee8bba 100644 --- a/src/DisplayTabs/_BackRefList.py +++ b/src/DisplayTabs/_BackRefList.py @@ -87,8 +87,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) diff --git a/src/DisplayTabs/_ButtonTab.py b/src/DisplayTabs/_ButtonTab.py index 3e26d164a..c4fabdcca 100644 --- a/src/DisplayTabs/_ButtonTab.py +++ b/src/DisplayTabs/_ButtonTab.py @@ -98,7 +98,6 @@ class ButtonTab(GrampsTab): """ self.dirty_selection = False GrampsTab.__init__(self,dbstate, uistate, track, name) - self.tooltips = gtk.Tooltips() self.create_buttons(share_button, move_buttons, jump_button) def create_buttons(self, share_button, move_buttons, jump_button): @@ -113,22 +112,22 @@ class ButtonTab(GrampsTab): self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked) self.del_btn = SimpleButton(gtk.STOCK_REMOVE, self.del_button_clicked) - 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']) 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.share_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']) else: self.up_btn = None self.down_btn = None @@ -146,7 +145,7 @@ class ButtonTab(GrampsTab): if jump_button: self.jump_btn = SimpleButton(gtk.STOCK_JUMP_TO, self.jump_button_clicked) - 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 3accdc40f..c94909d32 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -409,7 +409,6 @@ 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) @@ -543,12 +542,10 @@ class EditFamily(EditPrimary): self.mbutton_del = self.top.get_widget('mbutton_del') self.mbutton_edit = self.top.get_widget('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) @@ -561,12 +558,9 @@ class EditFamily(EditPrimary): self.fbutton_del = self.top.get_widget('fbutton_del') self.fbutton_edit = self.top.get_widget('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) @@ -856,7 +850,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 78c302de5..e211d6aad 100644 --- a/src/ExportAssistant.py +++ b/src/ExportAssistant.py @@ -197,8 +197,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) @@ -207,11 +205,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) if ix == recent_type : button.set_active(True) diff --git a/src/FilterEditor/_EditRule.py b/src/FilterEditor/_EditRule.py index ee7d61d9a..d5160719a 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.obj_name[namespace]) - self.tooltips.enable() + self.button.set_tooltip_text(_('Select %s from a list') + % self.obj_name[namespace]) 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/Filters/SideBar/_SidebarFilter.py b/src/Filters/SideBar/_SidebarFilter.py index 1fac5cea7..93488387c 100644 --- a/src/Filters/SideBar/_SidebarFilter.py +++ b/src/Filters/SideBar/_SidebarFilter.py @@ -41,7 +41,6 @@ class SidebarFilter(object): self.table.set_row_spacings(6) self.table.set_col_spacing(0, 6) self.table.set_col_spacing(1, 6) - self.tooltips = gtk.Tooltips() self.apply_btn = gtk.Button(stock=gtk.STOCK_FIND) self.clear_btn = gtk.Button() @@ -119,7 +118,7 @@ class SidebarFilter(object): self.add_entry(name, widget) widget.connect('key-press-event', self.key_press) if tooltip: - self.tooltips.set_tip(widget, tooltip) + widget.set_tooltip_text(tooltip) def key_press(self, obj, event): if not event.state or event.state in (gtk.gdk.MOD2_MASK,): diff --git a/src/PluginUtils/_GuiOptions.py b/src/PluginUtils/_GuiOptions.py index bc31f8eba..05b77c02a 100644 --- a/src/PluginUtils/_GuiOptions.py +++ b/src/PluginUtils/_GuiOptions.py @@ -158,7 +158,7 @@ class GuiStringOption(gtk.Entry): """ This class displays an option that is a simple one-line string. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.StringOption @@ -168,7 +168,7 @@ class GuiStringOption(gtk.Entry): self.__option = option self.set_text( self.__option.get_value() ) self.connect('changed', self.__text_changed) - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -195,12 +195,12 @@ class GuiColorOption(gtk.ColorButton): """ This class displays an option that allows the selection of a colour. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): self.__option = option value = self.__option.get_value() gtk.ColorButton.__init__( self, gtk.gdk.color_parse(value) ) self.connect('color-set', self.__value_changed) - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) def __value_changed(self, obj): # IGNORE:W0613 - obj is unused """ @@ -223,7 +223,7 @@ class GuiNumberOption(gtk.SpinButton): This class displays an option that is a simple number with defined maximum and minimum values. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): self.__option = option decimals = 0 @@ -243,7 +243,7 @@ class GuiNumberOption(gtk.SpinButton): self.set_value(self.__option.get_value()) self.connect('value_changed', self.__value_changed) - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -271,7 +271,7 @@ class GuiTextOption(gtk.ScrolledWindow): """ This class displays an option that is a multi-line string. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): self.__option = option gtk.ScrolledWindow.__init__(self) self.set_shadow_type(gtk.SHADOW_IN) @@ -287,7 +287,7 @@ class GuiTextOption(gtk.ScrolledWindow): # Required for tooltip gtext.add_events(gtk.gdk.ENTER_NOTIFY_MASK) gtext.add_events(gtk.gdk.LEAVE_NOTIFY_MASK) - tooltip.set_tip(gtext, self.__option.get_help()) + gtext.set_tooltip_text(self.__option.get_help()) self.__buff = gtext.get_buffer() self.__buff.connect('changed', self.__value_changed) @@ -310,12 +310,12 @@ class GuiBooleanOption(gtk.CheckButton): """ This class displays an option that is a boolean (True or False). """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): self.__option = option gtk.CheckButton.__init__(self, self.__option.get_label()) self.set_active(self.__option.get_value()) self.connect('toggled', self.__value_changed) - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -343,7 +343,7 @@ class GuiEnumeratedListOption(gtk.HBox): This class displays an option that provides a finite number of values. Each possible value is assigned a value and a description. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): gtk.HBox.__init__(self) evtBox = gtk.EventBox() self.__option = option @@ -353,7 +353,7 @@ class GuiEnumeratedListOption(gtk.HBox): self.__update_options() - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) self.__combo.connect('changed', self.__value_changed) self.__option.connect('options-changed', self.__update_options) @@ -407,7 +407,7 @@ class GuiPersonOption(gtk.HBox): This class displays an option that allows a person from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.PersonOption @@ -436,8 +436,8 @@ class GuiPersonOption(gtk.HBox): person = self.__db.get_default_person() self.__update_person(person) - tooltip.set_tip(pevt, self.__option.get_help()) - tooltip.set_tip(person_button, _('Select a different person')) + pevt.set_tooltip_text(self.__option.get_help()) + person_button.set_tooltip_text(_('Select a different person')) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -498,7 +498,7 @@ class GuiFamilyOption(gtk.HBox): This class displays an option that allows a family from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.FamilyOption @@ -524,8 +524,8 @@ class GuiFamilyOption(gtk.HBox): self.__initialize_family() - tooltip.set_tip(pevt, self.__option.get_help()) - tooltip.set_tip(family_button, _('Select a different family')) + pevt.set_tooltip_text(self.__option.get_help()) + family_button.set_tooltip_text(_('Select a different family')) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -637,7 +637,7 @@ class GuiNoteOption(gtk.HBox): This class displays an option that allows a note from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.NoteOption @@ -666,8 +666,8 @@ class GuiNoteOption(gtk.HBox): note = self.__db.get_note_from_gramps_id(nid) self.__update_note(note) - tooltip.set_tip(pevt, self.__option.get_help()) - tooltip.set_tip(note_button, _('Select an existing note')) + pevt.set_tooltip_text(self.__option.get_help()) + note_button.set_tooltip_text(_('Select an existing note')) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -719,7 +719,7 @@ class GuiMediaOption(gtk.HBox): This class displays an option that allows a media object from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.MediaOption @@ -748,8 +748,8 @@ class GuiMediaOption(gtk.HBox): media = self.__db.get_object_from_gramps_id(mid) self.__update_media(media) - tooltip.set_tip(pevt, self.__option.get_help()) - tooltip.set_tip(media_button, _('Select an existing media object')) + pevt.set_tooltip_text(self.__option.get_help()) + media_button.set_tooltip_text(_('Select an existing media object')) self.__option.connect('avail-changed', self.__update_avail) self.__update_avail() @@ -796,7 +796,7 @@ class GuiPersonListOption(gtk.HBox): This class displays a widget that allows multiple people from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.PersonListOption @@ -849,7 +849,7 @@ class GuiPersonListOption(gtk.HBox): self.__vbbox.set_layout(gtk.BUTTONBOX_SPREAD) self.pack_end(self.__vbbox, expand=False) - tooltip.set_tip(self.__tree_view, self.__option.get_help()) + self.__tree_view.set_tooltip_text(self.__option.get_help()) def __update_value(self): """ @@ -936,7 +936,7 @@ class GuiPlaceListOption(gtk.HBox): This class displays a widget that allows multiple places from the database to be selected. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.PlaceListOption @@ -989,7 +989,7 @@ class GuiPlaceListOption(gtk.HBox): self.__vbbox.set_layout(gtk.BUTTONBOX_SPREAD) self.pack_end(self.__vbbox, expand=False) - tooltip.set_tip(self.__tree_view, self.__option.get_help()) + self.__tree_view.set_tooltip_text(self.__option.get_help()) def __update_value(self): """ @@ -1048,7 +1048,7 @@ class GuiSurnameColorOption(gtk.HBox): selected from the database, and to assign a colour (not necessarily unique) to each one. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.SurnameColorOption @@ -1112,7 +1112,7 @@ class GuiSurnameColorOption(gtk.HBox): colour = tmp.pop(0) self.__model.append([surname, colour]) - tooltip.set_tip(self.__tree_view, self.__option.get_help()) + self.__tree_view.set_tooltip_text(self.__option.get_help()) def __value_changed(self): """ @@ -1201,7 +1201,7 @@ class GuiDestinationOption(gtk.HBox): This class displays an option that allows the user to select a DestinationOption. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.DestinationOption @@ -1222,7 +1222,7 @@ class GuiDestinationOption(gtk.HBox): self.pack_start(self.__entry, True, True) self.pack_end(self.__button, False, False) - tooltip.set_tip(self, self.__option.get_help()) + self.set_tooltip_text(self.__option.get_help()) self.__option.connect('options-changed', self.__option_changed) @@ -1296,14 +1296,14 @@ class GuiStyleOption(GuiEnumeratedListOption): """ This class displays a StyleOption. """ - def __init__(self, option, dbstate, uistate, track, tooltip): + def __init__(self, option, dbstate, uistate, track): """ @param option: The option to display. @type option: gen.plug.menu.StyleOption @return: nothing """ GuiEnumeratedListOption.__init__(self, option, dbstate, - uistate, track, tooltip) + uistate, track) self.__option = option self.__button = gtk.Button("%s..." % _("Style Editor")) @@ -1344,7 +1344,6 @@ class GuiMenuOptions(object): # Fill options_dict with report/tool defaults: self.options_dict = {} self.options_help = {} - self.__tooltips = gtk.Tooltips() self.add_menu_options(self.menu) for name in self.menu.get_all_option_names(): option = self.menu.get_option_by_name(name) @@ -1408,7 +1407,7 @@ class GuiMenuOptions(object): option = self.menu.get_option_by_name(name) self.options_dict[name] = option.get_value() -def make_gui_option(option, tooltips, dbstate, uistate, track): +def make_gui_option(option, dbstate, uistate, track): """ Stand-alone function so that Options can be used in other ways, too. Takes an Option and returns a GuiOption. @@ -1417,49 +1416,40 @@ def make_gui_option(option, tooltips, dbstate, uistate, track): label = True pmgr = gen.plug.PluginManager.get_instance() external_options = pmgr.get_external_opt_dict() - if tooltips == None: - tooltips = gtk.Tooltips() - elif type(tooltips) == type(""): - msg = tooltips - tooltips = gtk.Tooltips() - # FIXME: what widget? - #tooltips.set_tip(gui.scrolledwindow, msg) if isinstance(option, gen.plug.menu.PersonOption): - widget = GuiPersonOption(option, dbstate, uistate, track, tooltips) + widget = GuiPersonOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.FamilyOption): - widget = GuiFamilyOption(option, dbstate, uistate, track, tooltips) + widget = GuiFamilyOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.NoteOption): - widget = GuiNoteOption(option, dbstate, uistate, track, tooltips) + widget = GuiNoteOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.MediaOption): - widget = GuiMediaOption(option, dbstate, uistate, track, tooltips) + widget = GuiMediaOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.PersonListOption): - widget = GuiPersonListOption(option, dbstate, uistate, track, tooltips) + widget = GuiPersonListOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.NumberOption): - widget = GuiNumberOption(option, dbstate, uistate, track, tooltips) + widget = GuiNumberOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.BooleanOption): - widget = GuiBooleanOption(option, dbstate, uistate, track, tooltips) + widget = GuiBooleanOption(option, dbstate, uistate, track) label = False elif isinstance(option, gen.plug.menu.DestinationOption): - widget = GuiDestinationOption(option, dbstate, uistate, track, tooltips) + widget = GuiDestinationOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.StringOption): - widget = GuiStringOption(option, dbstate, uistate, track, tooltips) + widget = GuiStringOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.StyleOption): - widget = GuiStyleOption(option, dbstate, uistate, track, tooltips) + widget = GuiStyleOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.EnumeratedListOption): - widget = GuiEnumeratedListOption(option, dbstate, uistate, track, - tooltips) + widget = GuiEnumeratedListOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.TextOption): - widget = GuiTextOption(option, dbstate, uistate, track, tooltips) + widget = GuiTextOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.ColorOption): - widget = GuiColorOption(option, dbstate, uistate, track, tooltips) + widget = GuiColorOption(option, dbstate, uistate, tracks) elif isinstance(option, gen.plug.menu.SurnameColorOption): - widget = GuiSurnameColorOption(option, dbstate, uistate, track, - tooltips) + widget = GuiSurnameColorOption(option, dbstate, uistate, track) elif isinstance(option, gen.plug.menu.PlaceListOption): - widget = GuiPlaceListOption(option, dbstate, uistate, track, tooltips) + widget = GuiPlaceListOption(option, dbstate, uistate, track) elif option.__class__ in external_options: widget = external_options[option.__class__](option, dbstate, uistate, - track, tooltips) + track) else: raise AttributeError( "can't make GuiOption: unknown option type: '%s'" % option) diff --git a/src/PluginUtils/_PluginDialogs.py b/src/PluginUtils/_PluginDialogs.py index 5708b7974..9bb8654df 100644 --- a/src/PluginUtils/_PluginDialogs.py +++ b/src/PluginUtils/_PluginDialogs.py @@ -119,12 +119,7 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.apply_button.set_label(_("_Apply")) self.apply_button.set_use_underline(True) if tool_tip: - try: - tttips = gtk.tooltips_data_get(self.apply_button) - if tttips: - tttips[0].set_tip(self.apply_button, tool_tip) - except AttributeError: - pass + self.apply_button.set_tooltip_text(tool_tip) self.item = None self.build_plugin_tree(item_list, categories) diff --git a/src/ViewManager.py b/src/ViewManager.py index ce7c221cc..a032f9cdc 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -885,7 +885,7 @@ class ViewManager(object): button.set_alignment(0, 0.5) # add the tooltip - self.tips.set_tip(button, page_title) + button.set_tooltip_text(page_title) # connect the signal, along with the index as user data handler_id = button.connect('clicked', self.__vb_clicked, index) diff --git a/src/plugins/tool/MediaManager.py b/src/plugins/tool/MediaManager.py index 83afccd71..0ec606ec6 100644 --- a/src/plugins/tool/MediaManager.py +++ b/src/plugins/tool/MediaManager.py @@ -144,19 +144,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 c63e08853..93df5458c 100644 --- a/src/widgets/labels.py +++ b/src/widgets/labels.py @@ -84,7 +84,6 @@ 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) @@ -94,7 +93,7 @@ class LinkLabel(gtk.EventBox): 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)