Bug 0003063: gtk.Tooltips is deprecated -- second batch of updates

svn: r13340
This commit is contained in:
Gerald Britton 2009-10-07 20:01:39 +00:00
parent 9a8b5d8743
commit bebba4b366
10 changed files with 33 additions and 56 deletions

View File

@ -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")

View File

@ -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

View File

@ -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):
"""

View File

@ -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()

View File

@ -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)
if ix == recent_type :
button.set_active(True)

View File

@ -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)
#-------------------------------------------------------------------------
#

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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 = '<span %s>%s</span>' % (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)