From 628457e159470ed026c88516b96d36fe4d9c287a Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 9 Mar 2006 19:07:13 +0000 Subject: [PATCH] Add option to suppress tooltips in trees svn: r6111 --- gramps2/ChangeLog | 5 ++++ gramps2/src/DisplayModels.py | 57 +++++++++++++++++++++++------------- gramps2/src/PeopleModel.py | 5 +++- gramps2/src/const.py.in | 1 + 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ca71ed035..cf2eeac64 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-03-09 Don Allingham + * src/const.py.in: add use_tips variable + * src/PeopleModel.py: use_tips to control tool tips + * src/DataModels.py: use_tips to control tool tips + 2006-03-08 Don Allingham * src/DataViews/_FamilyView.py: fix spacing * src/Editors/_EditPrimary.py: make sure object is valid before diff --git a/gramps2/src/DisplayModels.py b/gramps2/src/DisplayModels.py index 38d7f0815..797a6fd7b 100644 --- a/gramps2/src/DisplayModels.py +++ b/gramps2/src/DisplayModels.py @@ -50,6 +50,7 @@ import RelLib import Utils import ToolTips import GrampsLocale +import const _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] @@ -266,11 +267,15 @@ class SourceModel(BaseModel): return time.localtime(data[8]) def column_tooltip(self,data): - try: - t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_source_from_handle(data[0])) - except: - log.error("Failed to create tooltip.",exc_info=True) - return t + if const.use_tips: + try: + t = ToolTips.TipFromFunction(self.db, lambda: + self.db.get_source_from_handle(data[0])) + except: + log.error("Failed to create tooltip.",exc_info=True) + return t + else: + return u'' #------------------------------------------------------------------------- # @@ -375,11 +380,15 @@ class PlaceModel(BaseModel): _codeset) def column_tooltip(self,data): - try: - t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_place_from_handle(data[0])) - except: - log.error("Failed to create tooltip.", exc_info=True) - return t + if const.use_tips: + try: + t = ToolTips.TipFromFunction(self.db, lambda: + self.db.get_place_from_handle(data[0])) + except: + log.error("Failed to create tooltip.", exc_info=True) + return t + else: + return u'' #------------------------------------------------------------------------- # @@ -464,11 +473,15 @@ class FamilyModel(BaseModel): _codeset) def column_tooltip(self,data): - try: - t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_family_from_handle(data[0])) - except: - log.error("Failed to create tooltip.", exc_info=True) - return t + if const.use_tips: + try: + t = ToolTips.TipFromFunction(self.db, lambda: + self.db.get_family_from_handle(data[0])) + except: + log.error("Failed to create tooltip.", exc_info=True) + return t + else: + return u'' #------------------------------------------------------------------------- @@ -543,11 +556,15 @@ class MediaModel(BaseModel): _codeset) def column_tooltip(self,data): - try: - t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_object_from_handle(data[0])) - except: - log.error("Failed to create tooltip.", exc_info=True) - return t + if self.use_tips: + try: + t = ToolTips.TipFromFunction(self.db, lambda: + self.db.get_object_from_handle(data[0])) + except: + log.error("Failed to create tooltip.", exc_info=True) + return t + else: + return u'' #------------------------------------------------------------------------- # diff --git a/gramps2/src/PeopleModel.py b/gramps2/src/PeopleModel.py index 502dc56b8..b5250d19f 100644 --- a/gramps2/src/PeopleModel.py +++ b/gramps2/src/PeopleModel.py @@ -476,7 +476,10 @@ class PeopleModel(gtk.GenericTreeModel): return None def column_tooltip(self,data,node): - return ToolTips.TipFromFunction(self.db, lambda: self.db.get_person_from_handle(data[0])) + if const.use_tips: + return ToolTips.TipFromFunction(self.db, lambda: self.db.get_person_from_handle(data[0])) + else: + return u'' def column_int_id(self,data,node): diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in index 91fcad1f9..9e078c789 100644 --- a/gramps2/src/const.py.in +++ b/gramps2/src/const.py.in @@ -126,6 +126,7 @@ fdl = os.path.join(data_dir,"fdl.txt") startup = 1 dnd_images = 1 +use_tips = False #------------------------------------------------------------------------- #