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,31 +124,33 @@ class RepositoryTip(object):
def get_tip(self):
global escape
s = "<big><b>%s:</b>\t%s</big>\n\n"\
"\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"\
"\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"),
escape(self._obj.address.get_parish()),
escape(self._obj.address.get_city()),
escape(self._obj.address.get_county()),
escape(self._obj.address.get_state()),
escape(self._obj.address.get_postal_code()),
escape(self._obj.address.get_country()),
_("Telephone"), escape(self._obj.address.get_phone()),
_("Email"), escape(self._obj.get_email()),
_("Search Url"), escape(self._obj.get_search_url()),
_("Home Url"), escape(self._obj.get_home_url()))
s = "<big><b>%s:</b>\t%s</big>\n\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"\
"\t<b>%s:</b>\t%s\n"\
% (
_("Location"),
escape(address.get_street()),
escape(address.get_city()),
escape(address.get_county()),
escape(address.get_state()),
escape(address.get_postal_code()),
escape(address.get_country()),
_("Telephone"), escape(address.get_phone()))
# Get the Urls
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
notelist = self._obj.get_note_list()

View File

@ -276,9 +276,9 @@ class ListView(NavigationView):
self.__display_column_sort()
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.list, self.model.tooltip_column, True)
self.list, self.model.tooltip_column(), True)
self.dirty = False
cput4 = time.clock()
self.uistate.show_filter_results(self.dbstate,

View File

@ -96,7 +96,7 @@ class EventModel(FlatBaseModel):
self.column_handle,
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)
def on_get_n_columns(self):

View File

@ -86,7 +86,7 @@ class FamilyModel(FlatBaseModel):
self.column_marker_text,
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)
def marker_column(self):

View File

@ -40,6 +40,8 @@ import gtk
#
#-------------------------------------------------------------------------
import gen.lib
import const
import ToolTips
import Utils
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@ -213,7 +215,15 @@ class RepositoryModel(FlatBaseModel):
return u""
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):
return "%012x" % data[7]

View File

@ -110,6 +110,6 @@ class SourceModel(FlatBaseModel):
self.db.get_source_from_handle(data[0]))
except:
log.error("Failed to create tooltip.",exc_info=True)
return t
return t
else:
return u''