GEPS008: Removed obsolete listview tooltips code
svn: r19803
This commit is contained in:
parent
5f7c31eae8
commit
fdb3be0ffa
@ -6,7 +6,6 @@ src/const.py
|
||||
src/gramps.py
|
||||
src/LdsUtils.py
|
||||
src/PlaceUtils.py
|
||||
src/ToolTips.py
|
||||
src/TransUtils.py
|
||||
src/Utils.py
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#src
|
||||
src/AutoComp.py
|
||||
src/ImgManip.py
|
||||
src/TreeTips.py
|
||||
|
||||
# cli
|
||||
src/cli/__init__.py
|
||||
|
@ -21,9 +21,7 @@ gdir_PYTHON = \
|
||||
ImgManip.py\
|
||||
LdsUtils.py \
|
||||
MacTransUtils.py\
|
||||
ToolTips.py\
|
||||
TransUtils.py\
|
||||
TreeTips.py\
|
||||
Utils.py\
|
||||
PlaceUtils.py
|
||||
|
||||
|
256
src/ToolTips.py
256
src/ToolTips.py
@ -1,256 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# ToolTips
|
||||
#
|
||||
# The model provides a framework for generating tooltips for different
|
||||
# gramps objects. The idea is to hide the task of generating these tips
|
||||
# from the other parts of gramps and to provide a single place were
|
||||
# a tooltip is generated so that it is consistent everywhere it is used.
|
||||
#
|
||||
# The tooltips generated by this module are meant to be passed to the
|
||||
# TreeTips module for rendering.
|
||||
#
|
||||
# To add tooltips for a new object:
|
||||
#
|
||||
# 1. copy one of the existing <object>Tip classes and change the tooltip()
|
||||
# method to suit the new object.
|
||||
# 2. add a new entry to the CLASS_MAP at the bottom of the file.
|
||||
# 3. thats it.
|
||||
#
|
||||
# To use the tips, use one of the factory classes to generate the tips.
|
||||
# The factory classes generate methods that TreeTips will execute only
|
||||
# if the tip is needed. So the processing is deferred until required.
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from xml.sax.saxutils import escape
|
||||
from gen.ggettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import gen.datehandler
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Utility functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def short(val,size=60):
|
||||
if len(val) > size:
|
||||
return "%s..." % val[0:size]
|
||||
else:
|
||||
return val
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Factory classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class TipFromFunction(object):
|
||||
"""
|
||||
TipFromFunction generates a tooltip callable.
|
||||
"""
|
||||
def __init__(self,db,fetch_function):
|
||||
"""
|
||||
fetch_function: a callable that will return a Rellib object
|
||||
when it is run. The function will not be run until the tooltip
|
||||
is required. Use a lambda function to currie any required
|
||||
arguments.
|
||||
"""
|
||||
self._db = db
|
||||
self._fetch_function = fetch_function
|
||||
|
||||
def get_tip(self):
|
||||
o = self._fetch_function()
|
||||
|
||||
# check if we have a handler for the object type returned
|
||||
for cls, handler in CLASS_MAP.iteritems():
|
||||
if isinstance(o,cls):
|
||||
return handler(self._db, o)()
|
||||
return "no tip"
|
||||
|
||||
__call__ = get_tip
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Tip generator classes.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class RepositoryTip(object):
|
||||
def __init__(self,db,repos):
|
||||
self._db = db
|
||||
self._obj = repos
|
||||
|
||||
def get_tip(self):
|
||||
global escape
|
||||
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_locality()),
|
||||
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()
|
||||
for notehandle in notelist:
|
||||
note = self._db.get_note_from_handle(notehandle)
|
||||
s += "\t<b>%s:</b>\t%s\n" % (
|
||||
_("Note"), escape(note.get()))
|
||||
|
||||
# Get the list of sources that reference this repository
|
||||
repos_handle = self._obj.get_handle()
|
||||
source_list = [ src_handle for src_handle \
|
||||
in self._db.get_source_handles(sort_handles=True) \
|
||||
if self._db.get_source_from_handle(src_handle).has_repo_reference(repos_handle)]
|
||||
|
||||
if len(source_list) > 0:
|
||||
s += "\n<big><b>%s</b></big>\n\n" % (_("Sources in repository"),)
|
||||
|
||||
for src_handle in source_list:
|
||||
src = self._db.get_source_from_handle(src_handle)
|
||||
s += "\t<b>%s:</b>\t%s\n" % (
|
||||
_("Name"),escape(short(src.get_title())))
|
||||
|
||||
return s
|
||||
|
||||
__call__ = get_tip
|
||||
|
||||
class PersonTip(object):
|
||||
def __init__(self,db,repos):
|
||||
self._db = db
|
||||
self._obj = repos
|
||||
|
||||
def get_tip(self):
|
||||
global escape
|
||||
|
||||
birth_str = ""
|
||||
birth_ref = self._obj.get_birth_ref()
|
||||
if birth_ref:
|
||||
birth = self._db.get_event_from_handle(birth_ref.ref)
|
||||
date_str = gen.datehandler.get_date(birth)
|
||||
if date_str != "":
|
||||
birth_str = escape(date_str)
|
||||
|
||||
s = "<span size=\"larger\" weight=\"bold\">%s</span>\n"\
|
||||
" <span weight=\"bold\">%s:</span> %s\n"\
|
||||
" <span weight=\"bold\">%s:</span> %s\n" % (
|
||||
_("Person"),
|
||||
_("Name"),escape(self._obj.get_primary_name().get_name()),
|
||||
_("Birth"),birth_str)
|
||||
|
||||
if len(self._obj.get_source_references()) > 0:
|
||||
psrc_ref = self._obj.get_source_references()[0]
|
||||
psrc_id = psrc_ref.get_reference_handle()
|
||||
psrc = self._db.get_source_from_handle(psrc_id)
|
||||
|
||||
s += "\n<span size=\"larger\" weight=\"bold\">%s</span>\n"\
|
||||
" <span weight=\"bold\">%s:</span> %s\n" % (
|
||||
_("Primary source"),
|
||||
_("Name"),
|
||||
escape(short(psrc.get_title())))
|
||||
|
||||
return s
|
||||
|
||||
__call__ = get_tip
|
||||
|
||||
class FamilyTip(object):
|
||||
def __init__(self,db, obj):
|
||||
self._db = db
|
||||
self._obj = obj
|
||||
|
||||
def get_tip(self):
|
||||
global escape
|
||||
|
||||
fhandle = self._obj.get_father_handle()
|
||||
mhandle = self._obj.get_mother_handle()
|
||||
|
||||
s = "<span size=\"larger\" weight=\"bold\">%s</span>" % _("Family")
|
||||
|
||||
if fhandle:
|
||||
father = self._db.get_person_from_handle(fhandle)
|
||||
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||
_("Father"),escape(father.get_primary_name().get_name()))
|
||||
|
||||
if mhandle:
|
||||
mother = self._db.get_person_from_handle(mhandle)
|
||||
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||
_("Mother"),escape(mother.get_primary_name().get_name()))
|
||||
|
||||
for cref in self._obj.get_child_ref_list():
|
||||
child = self._db.get_person_from_handle(cref.ref)
|
||||
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||
_("Child"),escape(child.get_primary_name().get_name()))
|
||||
|
||||
return s
|
||||
|
||||
__call__ = get_tip
|
||||
|
||||
|
||||
CLASS_MAP = {
|
||||
gen.lib.Repository : RepositoryTip,
|
||||
gen.lib.Person : PersonTip,
|
||||
gen.lib.Family : FamilyTip
|
||||
}
|
261
src/TreeTips.py
261
src/TreeTips.py
@ -1,261 +0,0 @@
|
||||
# File: treetips.py
|
||||
# Author: Toshio Kuratomi <toshio@tiki-lounge.com>
|
||||
# Date: 6 April, 2004
|
||||
# Copyright: Toshio Kuratomi
|
||||
# License: GPL
|
||||
# $Id$
|
||||
|
||||
"""A tooltip class."""
|
||||
|
||||
#
|
||||
# Support for text markup added: March 05 - rjt-gramps <at> thegrindstone.me.uk
|
||||
# Support for tooltips to be functions added: March 05 - rjt-gramps <at> thegrindstone.me.uk
|
||||
#
|
||||
|
||||
import gtk
|
||||
import gobject
|
||||
|
||||
class TreeTips(gtk.Widget):
|
||||
""" A tooltips widget specialized to work with gtk.TreeView's.
|
||||
|
||||
TreeTips associates a column in a TreeStore with tooltips that will be
|
||||
displayed when the mouse is over the row the column is for. Each row can
|
||||
have one treetip.
|
||||
"""
|
||||
__gproperties__ = {
|
||||
'tip_window' : (gobject.TYPE_PYOBJECT,
|
||||
'The window that the tooltip is displayed in.',
|
||||
'The window that the tooltip is displayed in.',
|
||||
gobject.PARAM_READABLE),
|
||||
'tip_label' : (gobject.TYPE_PYOBJECT,
|
||||
'The label that displays the tooltip text.',
|
||||
'The label that displays the tooltip text.',
|
||||
gobject.PARAM_READABLE),
|
||||
'active_tips_data' : (gobject.TYPE_PYOBJECT,
|
||||
'The data associated with the active tooltip.',
|
||||
'The data associated with the active tooltip.',
|
||||
gobject.PARAM_READABLE),
|
||||
'delay' : (gobject.TYPE_INT,
|
||||
'MSecs before displaying the tooltip.',
|
||||
'The delay between the mouse pausing over the widget and the display of the tooltip in msec.',
|
||||
0, 60000, 2000,
|
||||
gobject.PARAM_READWRITE),
|
||||
'enabled' : (gobject.TYPE_BOOLEAN,
|
||||
'If TRUE the tooltips are enabled',
|
||||
'If TRUE the tooltips are enabled',
|
||||
True,
|
||||
gobject.PARAM_READABLE),
|
||||
'view' : (gobject.TYPE_PYOBJECT,
|
||||
'gtk.TreeView that we get our data from.',
|
||||
'The tip data comes from a column in a gtk.TreeView.',
|
||||
gobject.PARAM_READWRITE),
|
||||
'column' : (gobject.TYPE_INT,
|
||||
'Column from the gtk.TreeView that holds tip data.',
|
||||
'The tip data for each row is held by a column in the row. This specifies which column that data is in.',
|
||||
0, 32000, 0,
|
||||
gobject.PARAM_READWRITE),
|
||||
'markup_enabled' : (gobject.TYPE_BOOLEAN,
|
||||
'If TRUE the tooltips are in Pango Markup',
|
||||
'If TRUE the tooltips are in Pango Markup',
|
||||
False,
|
||||
gobject.PARAM_READWRITE),
|
||||
|
||||
}
|
||||
|
||||
def __init__(self, treeview=None, column=None, markup_enabled=False):
|
||||
"""Create a new TreeTips Group.
|
||||
|
||||
:Parameters:
|
||||
treeview : gtk.TreeView === Treeview for which the tips display,
|
||||
default is None.
|
||||
column : integer === Column id in the Treemodel holding the treetip
|
||||
text, default is None.
|
||||
markup_enabled : bool === If True the tooltips are in Pango Markup,
|
||||
if False the tooltips are in plain text.
|
||||
"""
|
||||
if treeview:
|
||||
try:
|
||||
treeview.connect('leave-notify-event', self.__tree_leave_notify)
|
||||
treeview.connect('motion-notify-event', self.__tree_motion_notify)
|
||||
except (AttributeError, TypeError):
|
||||
raise TypeError, ('The value of view must be an object that'
|
||||
'implements leave-notify-event and motion-notify-event '
|
||||
'gsignals such as gtk.TreeStore.')
|
||||
|
||||
gobject.GObject.__init__(self)
|
||||
|
||||
self.view = treeview or None
|
||||
self.delay = 2000
|
||||
self.enabled = True
|
||||
self.column = column or 0
|
||||
self.markup_enabled = markup_enabled
|
||||
self.tip_window = gtk.Window(gtk.WINDOW_POPUP)
|
||||
self.tip_window.set_app_paintable(True)
|
||||
self.tip_window.set_border_width(4)
|
||||
self.tip_window.connect('expose-event', self.__paint_window)
|
||||
self.tip_label = gtk.Label('')
|
||||
self.tip_label.set_line_wrap(True)
|
||||
self.tip_label.set_alignment(0.5, 0.5)
|
||||
self.active_tips_data = ''
|
||||
self.tip_window.add(self.tip_label)
|
||||
self.unique = 1 # Unique number used for timeouts
|
||||
self.timeoutID = 0
|
||||
self.path = None
|
||||
self.screenWidth = gtk.gdk.screen_width()
|
||||
self.screenHeight = gtk.gdk.screen_height()
|
||||
|
||||
def enable(self):
|
||||
"""Enable showing of tooltips"""
|
||||
self.enabled = True
|
||||
|
||||
def disable(self):
|
||||
"""Disable showing tooltips"""
|
||||
self.enabled = False
|
||||
self.timeoutID = 0
|
||||
self.path = None
|
||||
self.tip_window.hide()
|
||||
|
||||
def do_get_property(self, prop):
|
||||
"""Return the gproperty's value."""
|
||||
if prop.name == 'delay':
|
||||
return self.delay
|
||||
elif prop.name == 'enabled':
|
||||
return self.enabled
|
||||
elif prop.name == 'view':
|
||||
return self.view
|
||||
elif prop.name == 'column':
|
||||
return self.column
|
||||
elif prop.name == 'active-tips-data':
|
||||
return self.active_tips_data
|
||||
elif prop.name == 'tip-label':
|
||||
return self.tip_label
|
||||
elif prop.name == 'tip-window':
|
||||
return self.tip_window
|
||||
elif prop.name == 'markup_enabled':
|
||||
return self.markup_enabled
|
||||
else:
|
||||
raise AttributeError, 'unknown property %s' % prop.name
|
||||
|
||||
def do_set_property(self, prop, value):
|
||||
"""Set the property of writable properties.
|
||||
|
||||
"""
|
||||
if prop.name == 'delay':
|
||||
self.delay = value
|
||||
elif prop.name == 'view':
|
||||
try:
|
||||
value.connect('leave-notify-event', self.__tree_leave_notify)
|
||||
value.connect('motion-notify-event', self.__tree_motion_notify)
|
||||
except (AttributeError, TypeError):
|
||||
raise TypeError, ('The value of view must be an object that'
|
||||
'implements leave-notify-event and motion-notify-event '
|
||||
'gsignals')
|
||||
self.view = value
|
||||
elif prop.name == 'column':
|
||||
self.column = value
|
||||
elif prop.name == 'markup_enabled':
|
||||
self.markup_enabled = value
|
||||
else:
|
||||
raise AttributeError, 'unknown or read only property %s' % prop.name
|
||||
|
||||
def __paint_window(self, window, event):
|
||||
window.style.paint_flat_box(window.window, gtk.STATE_NORMAL,
|
||||
gtk.SHADOW_OUT, None, window,
|
||||
'tooltip', 0, 0, -1, -1)
|
||||
|
||||
def __tree_leave_notify(self, tree, event):
|
||||
"""Hide tooltips when we leave the tree."""
|
||||
|
||||
self.timeoutID = 0
|
||||
self.path = None
|
||||
self.tip_window.hide()
|
||||
|
||||
def __tree_motion_notify(self, tree, event):
|
||||
"""Decide which tooltip to display when we move within the tree."""
|
||||
|
||||
if not self.enabled:
|
||||
return
|
||||
self.tip_window.hide()
|
||||
self.path = None
|
||||
self.unique += 1
|
||||
self.timeoutID = self.unique
|
||||
gobject.timeout_add(self.delay, self.__treetip_show, tree,
|
||||
int(event.x), int(event.y), self.timeoutID)
|
||||
|
||||
def __treetip_show(self, tree, xEvent, yEvent, ID):
|
||||
"""Show the treetip window."""
|
||||
if self.timeoutID != ID:
|
||||
return False
|
||||
pathReturn = tree.get_path_at_pos(xEvent, yEvent)
|
||||
model = tree.get_model()
|
||||
if pathReturn is None:
|
||||
self.path = None
|
||||
elif self.path != pathReturn[0]:
|
||||
self.path = pathReturn[0]
|
||||
rowIter = model.get_iter(self.path)
|
||||
tip = model.get_value(rowIter, self.column)
|
||||
# The tip can be either a string or
|
||||
# a function that returns a string.
|
||||
if isinstance(tip, str):
|
||||
text = tip
|
||||
elif callable(tip):
|
||||
text = tip()
|
||||
else:
|
||||
text = ""
|
||||
self.active_tips_data = text
|
||||
if not text:
|
||||
if self.markup_enabled:
|
||||
self.tip_label.set_markup('')
|
||||
else:
|
||||
self.tip_label.set_text('')
|
||||
return False
|
||||
|
||||
if self.markup_enabled:
|
||||
self.tip_label.set_markup(text)
|
||||
else:
|
||||
self.tip_label.set_text(text)
|
||||
x, y = self.tip_label.size_request()
|
||||
self.tip_window.resize(x, y)
|
||||
windowWidth, windowHeight = self.tip_window.get_size()
|
||||
cellInfo = tree.get_cell_area(self.path, pathReturn[1])
|
||||
x, y = self.__compute_tooltip_position(cellInfo, windowWidth, windowHeight)
|
||||
self.tip_window.move(int(x), int(y))
|
||||
self.tip_window.show_all()
|
||||
|
||||
return False
|
||||
|
||||
def __compute_tooltip_position(self, cellInfo, popupWidth, popupHeight):
|
||||
"""Figures out where the tooltip should be placed on the page::
|
||||
|
||||
[p] = pointer
|
||||
x = [p]
|
||||
+---------+
|
||||
(half on each side)
|
||||
|
||||
y = [p]
|
||||
+------------+
|
||||
|____________|
|
||||
If it fits else:
|
||||
+------------+
|
||||
|____________|
|
||||
[p]
|
||||
"""
|
||||
|
||||
xOrigin, yOrigin = self.view.get_bin_window().get_origin()
|
||||
x = xOrigin + cellInfo.x + cellInfo.width/2 - popupWidth/2
|
||||
if x < 0:
|
||||
x = 0
|
||||
elif x + popupWidth > self.screenWidth:
|
||||
x = self.screenWidth - popupWidth
|
||||
|
||||
y = yOrigin + cellInfo.y + cellInfo.height + 3
|
||||
if y + popupHeight > self.screenHeight:
|
||||
y = yOrigin + cellInfo.y - 3 - popupHeight
|
||||
if y < 0:
|
||||
y = 0
|
||||
|
||||
return x, y
|
||||
|
||||
|
||||
if gtk.pygtk_version < (2,8,0):
|
||||
gobject.type_register(TreeTips)
|
@ -54,7 +54,6 @@ from gui.views.pageview import PageView
|
||||
from gui.views.navigationview import NavigationView
|
||||
from gui.columnorder import ColumnOrder
|
||||
import config
|
||||
import TreeTips
|
||||
from gen.errors import WindowActiveError
|
||||
from gui.filters import SearchBar
|
||||
from gui.utils import add_menuitem
|
||||
@ -297,8 +296,8 @@ class ListView(NavigationView):
|
||||
self.goto_active(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.set_tooltip_column(self.model.tooltip_column())
|
||||
|
||||
self.dirty = False
|
||||
cput4 = time.clock()
|
||||
self.uistate.show_filter_results(self.dbstate,
|
||||
|
@ -39,8 +39,6 @@ LOG = logging.getLogger(".citation")
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import ToolTips
|
||||
import gen.datehandler
|
||||
import gen.lib
|
||||
from Utils import confidence, format_time
|
||||
@ -175,15 +173,7 @@ class CitationBaseModel(object):
|
||||
return u''
|
||||
|
||||
def citation_tooltip(self, data):
|
||||
if const.USE_TIPS:
|
||||
try:
|
||||
t = ToolTips.TipFromFunction(self.db, lambda:
|
||||
self.db.get_citation_from_handle(data[0]))
|
||||
except:
|
||||
log.error("Failed to create tooltip.", exc_info=True)
|
||||
return t
|
||||
else:
|
||||
return u''
|
||||
return u'Citation tooltip'
|
||||
|
||||
# Fields access when 'data' is a Source
|
||||
|
||||
@ -212,17 +202,9 @@ class CitationBaseModel(object):
|
||||
return "%012x" % data[COLUMN2_CHANGE]
|
||||
|
||||
def source_tooltip(self, data):
|
||||
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''
|
||||
return u'Source tooltip'
|
||||
|
||||
def dummy_sort_key(self, data):
|
||||
# dummy sort key for columns that don't have data
|
||||
return None
|
||||
|
||||
|
||||
|
@ -40,7 +40,6 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import ToolTips
|
||||
import gen.datehandler
|
||||
import gen.lib
|
||||
import Utils
|
||||
@ -166,10 +165,4 @@ class EventModel(FlatBaseModel):
|
||||
return Utils.format_time(data[COLUMN_CHANGE])
|
||||
|
||||
def column_tooltip(self,data):
|
||||
try:
|
||||
t = ToolTips.TipFromFunction(
|
||||
self.db,
|
||||
lambda: self.db.get_event_from_handle(data[COLUMN_HANDLE]))
|
||||
except:
|
||||
log.error("Failed to create tooltip.", exc_info=True)
|
||||
return t
|
||||
return u'Event tooltip'
|
||||
|
@ -41,8 +41,6 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import ToolTips
|
||||
import Utils
|
||||
import gen.datehandler
|
||||
from gen.display.name import displayer as name_displayer
|
||||
@ -178,16 +176,7 @@ class FamilyModel(FlatBaseModel):
|
||||
return Utils.format_time(data[12])
|
||||
|
||||
def column_tooltip(self, data):
|
||||
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''
|
||||
return u'Family tooltip'
|
||||
|
||||
def get_tag_name(self, tag_handle):
|
||||
"""
|
||||
|
@ -42,8 +42,6 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import ToolTips
|
||||
import Utils
|
||||
import gen.datehandler
|
||||
import gen.lib
|
||||
@ -156,15 +154,7 @@ class MediaModel(FlatBaseModel):
|
||||
return Utils.format_time(data[8])
|
||||
|
||||
def column_tooltip(self,data):
|
||||
if const.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''
|
||||
return u'Media tooltip'
|
||||
|
||||
def get_tag_name(self, tag_handle):
|
||||
"""
|
||||
|
@ -56,11 +56,9 @@ _LOG = logging.getLogger(".")
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
from gen.lib import Name, EventRef, EventType, EventRoleType
|
||||
from gen.display.name import displayer as name_displayer
|
||||
import gen.datehandler
|
||||
import ToolTips
|
||||
import Utils
|
||||
from lru import LRU
|
||||
from gui.views.treemodels.flatbasemodel import FlatBaseModel
|
||||
@ -426,13 +424,7 @@ class PeopleBaseModel(object):
|
||||
return u""
|
||||
|
||||
def column_tooltip(self, data):
|
||||
if const.USE_TIPS:
|
||||
return ToolTips.TipFromFunction(
|
||||
self.db,
|
||||
lambda: self.db.get_person_from_handle(data[0])
|
||||
)
|
||||
else:
|
||||
return u''
|
||||
return u'Person tooltip'
|
||||
|
||||
def column_int_id(self, data):
|
||||
return data[0]
|
||||
@ -472,7 +464,7 @@ class PersonListModel(PeopleBaseModel, FlatBaseModel):
|
||||
skip=set(), sort_map=None):
|
||||
PeopleBaseModel.__init__(self, db)
|
||||
FlatBaseModel.__init__(self, db, search=search, skip=skip,
|
||||
tooltip_column=13,
|
||||
tooltip_column=12,
|
||||
scol=scol, order=order, sort_map=sort_map)
|
||||
|
||||
def clear_cache(self, handle=None):
|
||||
@ -494,7 +486,7 @@ class PersonTreeModel(PeopleBaseModel, TreeBaseModel):
|
||||
skip=set(), sort_map=None):
|
||||
|
||||
PeopleBaseModel.__init__(self, db)
|
||||
TreeBaseModel.__init__(self, db, 13, search=search, skip=skip,
|
||||
TreeBaseModel.__init__(self, db, 12, search=search, skip=skip,
|
||||
scol=scol, order=order, sort_map=sort_map)
|
||||
|
||||
def destroy(self):
|
||||
|
@ -46,8 +46,6 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import ToolTips
|
||||
import Utils
|
||||
from PlaceUtils import conv_lat_lon
|
||||
from gui.views.treemodels.flatbasemodel import FlatBaseModel
|
||||
@ -227,16 +225,7 @@ class PlaceBaseModel(object):
|
||||
return Utils.format_time(data[11])
|
||||
|
||||
def column_tooltip(self, data):
|
||||
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''
|
||||
return u'Place tooltip'
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -40,8 +40,6 @@ import gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import const
|
||||
import ToolTips
|
||||
import Utils
|
||||
from gui.views.treemodels.flatbasemodel import FlatBaseModel
|
||||
|
||||
@ -227,15 +225,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return u""
|
||||
|
||||
def column_tooltip(self,data):
|
||||
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''
|
||||
return u'Repository tooltip'
|
||||
|
||||
def sort_change(self,data):
|
||||
return "%012x" % data[7]
|
||||
|
@ -39,8 +39,6 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import ToolTips
|
||||
import Utils
|
||||
from gui.views.treemodels.flatbasemodel import FlatBaseModel
|
||||
|
||||
@ -115,12 +113,4 @@ class SourceModel(FlatBaseModel):
|
||||
return "%012x" % data[8]
|
||||
|
||||
def column_tooltip(self,data):
|
||||
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''
|
||||
return u'Source tooltip'
|
||||
|
Loading…
Reference in New Issue
Block a user