Fix tooltips in list views (currently disabled)

svn: r15615
This commit is contained in:
Nick Hall 2010-07-04 16:59:05 +00:00
parent 5ab9ca2e5a
commit 24403802ac
6 changed files with 43 additions and 31 deletions

View File

@ -124,8 +124,13 @@ class RepositoryTip(object):
def get_tip(self): def get_tip(self):
global escape global escape
s = "<big><b>%s:</b>\t%s</big>\n\n"\ s = "<big><b>%s:</b>\t%s</big>\n\n" % (
"\t<b>%s:</b>\n"\ _("Repository"),escape(self._obj.get_name()))
addresses = self._obj.get_address_list()
if addresses:
address = addresses[0]
s += "\t<b>%s:</b>\n"\
"\t\t%s\n"\ "\t\t%s\n"\
"\t\t%s\n"\ "\t\t%s\n"\
"\t\t%s\n"\ "\t\t%s\n"\
@ -133,22 +138,19 @@ class RepositoryTip(object):
"\t\t%s\n"\ "\t\t%s\n"\
"\t\t%s\n"\ "\t\t%s\n"\
"\t<b>%s:</b>\t%s\n"\ "\t<b>%s:</b>\t%s\n"\
"\t<b>%s:</b>\t%s\n"\
"\t<b>%s:</b>\t%s\n"\
"\t<b>%s:</b>\t%s\n"\
% ( % (
_("Repository"),escape(self._obj.get_name()),
_("Location"), _("Location"),
escape(self._obj.address.get_parish()), escape(address.get_street()),
escape(self._obj.address.get_city()), escape(address.get_city()),
escape(self._obj.address.get_county()), escape(address.get_county()),
escape(self._obj.address.get_state()), escape(address.get_state()),
escape(self._obj.address.get_postal_code()), escape(address.get_postal_code()),
escape(self._obj.address.get_country()), escape(address.get_country()),
_("Telephone"), escape(self._obj.address.get_phone()), _("Telephone"), escape(address.get_phone()))
_("Email"), escape(self._obj.get_email()),
_("Search Url"), escape(self._obj.get_search_url()), # Get the Urls
_("Home Url"), escape(self._obj.get_home_url())) for url in self._obj.get_url_list():
s += "\t<b>%s:</b>\t%s\n" % (url.get_type(), escape(url.get_path()))
# Get the notes # Get the notes
notelist = self._obj.get_note_list() notelist = self._obj.get_note_list()

View File

@ -276,9 +276,9 @@ class ListView(NavigationView):
self.__display_column_sort() self.__display_column_sort()
self.goto_active(None) self.goto_active(None)
if const.USE_TIPS and self.model.tooltip_column is not None: if const.USE_TIPS and self.model.tooltip_column() is not None:
self.tooltips = TreeTips.TreeTips( self.tooltips = TreeTips.TreeTips(
self.list, self.model.tooltip_column, True) self.list, self.model.tooltip_column(), True)
self.dirty = False self.dirty = False
cput4 = time.clock() cput4 = time.clock()
self.uistate.show_filter_results(self.dbstate, self.uistate.show_filter_results(self.dbstate,

View File

@ -96,7 +96,7 @@ class EventModel(FlatBaseModel):
self.column_handle, self.column_handle,
self.column_tooltip, self.column_tooltip,
] ]
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=9, FlatBaseModel.__init__(self, db, scol, order, tooltip_column=8,
search=search, skip=skip, sort_map=sort_map) search=search, skip=skip, sort_map=sort_map)
def on_get_n_columns(self): def on_get_n_columns(self):

View File

@ -86,7 +86,7 @@ class FamilyModel(FlatBaseModel):
self.column_marker_text, self.column_marker_text,
self.column_marker_color, self.column_marker_color,
] ]
FlatBaseModel.__init__(self, db, scol, order, tooltip_column=6, FlatBaseModel.__init__(self, db, scol, order, tooltip_column=7,
search=search, skip=skip, sort_map=sort_map) search=search, skip=skip, sort_map=sort_map)
def marker_column(self): def marker_column(self):

View File

@ -40,6 +40,8 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gen.lib import gen.lib
import const
import ToolTips
import Utils import Utils
from gui.views.treemodels.flatbasemodel import FlatBaseModel from gui.views.treemodels.flatbasemodel import FlatBaseModel
@ -213,7 +215,15 @@ class RepositoryModel(FlatBaseModel):
return u"" return u""
def column_tooltip(self,data): def column_tooltip(self,data):
return "" if const.USE_TIPS:
try:
t = ToolTips.TipFromFunction(self.db, lambda:
self.db.get_repository_from_handle(data[0]))
except:
log.error("Failed to create tooltip.",exc_info=True)
return t
else:
return u''
def sort_change(self,data): def sort_change(self,data):
return "%012x" % data[7] return "%012x" % data[7]