8377: Slow scrolling in Gramps 4.X, on all platforms.
This commit is contained in:
67
gramps/gui/views/treemodels/basemodel.py
Normal file
67
gramps/gui/views/treemodels/basemodel.py
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||||
|
# Copyright (C) 2009 Benny Malengier
|
||||||
|
# Copyright (C) 2010 Nick Hall
|
||||||
|
#
|
||||||
|
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GRAMPS modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
from .lru import LRU
|
||||||
|
|
||||||
|
class BaseModel(object):
|
||||||
|
|
||||||
|
# LRU cache size
|
||||||
|
_CACHE_SIZE = 10000 # 250
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.lru_data = LRU(BaseModel._CACHE_SIZE)
|
||||||
|
|
||||||
|
def destroy(self):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
self.lru_data = None
|
||||||
|
|
||||||
|
def clear_cache(self, handle=None):
|
||||||
|
"""
|
||||||
|
Clear the LRU cache.
|
||||||
|
"""
|
||||||
|
if handle:
|
||||||
|
if handle in self.lru_data:
|
||||||
|
del self.lru_data[handle]
|
||||||
|
else:
|
||||||
|
self.lru_data.clear()
|
||||||
|
|
||||||
|
def get_cached_value(self, handle, col):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
if handle in self.lru_data and col in self.lru_data[handle]:
|
||||||
|
return (True, self.lru_data[handle][col])
|
||||||
|
return (False, None)
|
||||||
|
|
||||||
|
def set_cached_value(self, handle, col, data):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
if not self._in_build:
|
||||||
|
if handle not in self.lru_data:
|
||||||
|
self.lru_data[handle] = {}
|
||||||
|
self.lru_data[handle][col] = data
|
||||||
|
|
@@ -135,15 +135,18 @@ class CitationBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[COLUMN_TAGS]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
|
for handle in data[COLUMN_TAGS]:
|
||||||
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
this_priority = tag.get_priority()
|
this_priority = tag.get_priority()
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
tag_color = tag.get_color()
|
tag_color = tag.get_color()
|
||||||
tag_priority = this_priority
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def citation_change(self, data):
|
def citation_change(self, data):
|
||||||
@@ -157,72 +160,104 @@ class CitationBaseModel(object):
|
|||||||
|
|
||||||
def citation_src_title(self, data):
|
def citation_src_title(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_TITLE")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return str(source.get_title())
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = str(source.get_title())
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_TITLE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_id(self, data):
|
def citation_src_id(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_ID")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return str(source.gramps_id)
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = str(source.gramps_id)
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_ID", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_auth(self, data):
|
def citation_src_auth(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_AUTH")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return str(source.get_author())
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = str(source.get_author())
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_AUTH", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_abbr(self, data):
|
def citation_src_abbr(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_ABBR")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return str(source.get_abbreviation())
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = str(source.get_abbreviation())
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_ABBR", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_pinfo(self, data):
|
def citation_src_pinfo(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_PINFO")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return str(source.get_publication_info())
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = str(source.get_publication_info())
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_PINFO", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_private(self, data):
|
def citation_src_private(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_PRIVATE")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
if source.get_privacy():
|
try:
|
||||||
return 'gramps-lock'
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
else:
|
if source.get_privacy():
|
||||||
# There is a problem returning None here.
|
value = 'gramps-lock'
|
||||||
return ''
|
else:
|
||||||
except:
|
# There is a problem returning None here.
|
||||||
return ''
|
value = ''
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_PRIVATE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_tags(self, data):
|
def citation_src_tags(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_TAGS")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
tag_list = list(map(self.get_tag_name, source.get_tag_list()))
|
try:
|
||||||
return ', '.join(sorted(tag_list, key=glocale.sort_key))
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
except:
|
tag_list = list(map(self.get_tag_name, source.get_tag_list()))
|
||||||
return ''
|
value = ', '.join(sorted(tag_list, key=glocale.sort_key))
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_TAGS", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def citation_src_chan(self, data):
|
def citation_src_chan(self, data):
|
||||||
source_handle = data[COLUMN_SOURCE]
|
source_handle = data[COLUMN_SOURCE]
|
||||||
try:
|
cached, value = self.get_cached_value(source_handle, "SRC_CHAN")
|
||||||
source = self.db.get_source_from_handle(source_handle)
|
if not cached:
|
||||||
return format_time(source.change)
|
try:
|
||||||
except:
|
source = self.db.get_source_from_handle(source_handle)
|
||||||
return ''
|
value = format_time(source.change)
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(source_handle, "SRC_CHAN", value)
|
||||||
|
return value
|
||||||
|
|
||||||
# Fields access when 'data' is a Source
|
# Fields access when 'data' is a Source
|
||||||
|
|
||||||
@@ -259,15 +294,18 @@ class CitationBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[COLUMN2_TAGS]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
|
for handle in data[COLUMN2_TAGS]:
|
||||||
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
this_priority = tag.get_priority()
|
this_priority = tag.get_priority()
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
tag_color = tag.get_color()
|
tag_color = tag.get_color()
|
||||||
tag_priority = this_priority
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def source_src_chan(self, data):
|
def source_src_chan(self, data):
|
||||||
@@ -284,4 +322,8 @@ class CitationBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
@@ -49,7 +49,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# COLUMN constants
|
# Positions in raw data structure
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
COLUMN_HANDLE = 0
|
COLUMN_HANDLE = 0
|
||||||
@@ -75,7 +75,7 @@ class EventModel(FlatBaseModel):
|
|||||||
skip=set(), sort_map=None):
|
skip=set(), sort_map=None):
|
||||||
self.gen_cursor = db.get_event_cursor
|
self.gen_cursor = db.get_event_cursor
|
||||||
self.map = db.get_raw_event_data
|
self.map = db.get_raw_event_data
|
||||||
|
|
||||||
self.fmap = [
|
self.fmap = [
|
||||||
self.column_description,
|
self.column_description,
|
||||||
self.column_id,
|
self.column_id,
|
||||||
@@ -127,13 +127,22 @@ class EventModel(FlatBaseModel):
|
|||||||
return data[COLUMN_DESCRIPTION]
|
return data[COLUMN_DESCRIPTION]
|
||||||
|
|
||||||
def column_participant(self,data):
|
def column_participant(self,data):
|
||||||
return get_participant_from_event(self.db, data[COLUMN_HANDLE])
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "PARTICIPANT")
|
||||||
|
if not cached:
|
||||||
|
value = get_participant_from_event(self.db, data[COLUMN_HANDLE])
|
||||||
|
self.set_cached_value(handle, "PARTICIPANT", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_place(self,data):
|
def column_place(self,data):
|
||||||
if data[COLUMN_PLACE]:
|
if data[COLUMN_PLACE]:
|
||||||
event = Event()
|
cached, value = self.get_cached_value(data[0], "PLACE")
|
||||||
event.unserialize(data)
|
if not cached:
|
||||||
return place_displayer.display_event(self.db, event)
|
event = Event()
|
||||||
|
event.unserialize(data)
|
||||||
|
value = place_displayer.display_event(self.db, event)
|
||||||
|
self.set_cached_value(data[0], "PLACE", value)
|
||||||
|
return value
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@@ -185,21 +194,29 @@ class EventModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
# TAG_NAME isn't a column, but we cache it
|
||||||
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[COLUMN_TAGS]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
|
for handle in data[COLUMN_TAGS]:
|
||||||
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
this_priority = tag.get_priority()
|
this_priority = tag.get_priority()
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
tag_color = tag.get_color()
|
tag_color = tag.get_color()
|
||||||
tag_priority = this_priority
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
|
@@ -106,56 +106,86 @@ class FamilyModel(FlatBaseModel):
|
|||||||
return len(self.fmap)+1
|
return len(self.fmap)+1
|
||||||
|
|
||||||
def column_father(self, data):
|
def column_father(self, data):
|
||||||
if data[2]:
|
handle = data[0]
|
||||||
person = self.db.get_person_from_handle(data[2])
|
cached, value = self.get_cached_value(handle, "FATHER")
|
||||||
return name_displayer.display_name(person.primary_name)
|
if not cached:
|
||||||
else:
|
if data[2]:
|
||||||
return ""
|
person = self.db.get_person_from_handle(data[2])
|
||||||
|
value = name_displayer.display_name(person.primary_name)
|
||||||
|
else:
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "FATHER", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def sort_father(self, data):
|
def sort_father(self, data):
|
||||||
if data[2]:
|
handle = data[0]
|
||||||
person = self.db.get_person_from_handle(data[2])
|
cached, value = self.get_cached_value(handle, "SORT_FATHER")
|
||||||
return name_displayer.sorted_name(person.primary_name)
|
if not cached:
|
||||||
else:
|
if data[2]:
|
||||||
return ""
|
person = self.db.get_person_from_handle(data[2])
|
||||||
|
value = name_displayer.sorted_name(person.primary_name)
|
||||||
|
else:
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "SORT_FATHER", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_mother(self, data):
|
def column_mother(self, data):
|
||||||
if data[3]:
|
handle = data[0]
|
||||||
person = self.db.get_person_from_handle(data[3])
|
cached, value = self.get_cached_value(handle, "MOTHER")
|
||||||
return name_displayer.display_name(person.primary_name)
|
if not cached:
|
||||||
else:
|
if data[3]:
|
||||||
return ""
|
person = self.db.get_person_from_handle(data[3])
|
||||||
|
value = name_displayer.display_name(person.primary_name)
|
||||||
|
else:
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "MOTHER", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def sort_mother(self, data):
|
def sort_mother(self, data):
|
||||||
if data[3]:
|
handle = data[0]
|
||||||
person = self.db.get_person_from_handle(data[3])
|
cached, value = self.get_cached_value(handle, "SORT_MOTHER")
|
||||||
return name_displayer.sorted_name(person.primary_name)
|
if not cached:
|
||||||
else:
|
if data[3]:
|
||||||
return ""
|
person = self.db.get_person_from_handle(data[3])
|
||||||
|
value = name_displayer.sorted_name(person.primary_name)
|
||||||
|
else:
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "SORT_MOTHER", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_type(self, data):
|
def column_type(self, data):
|
||||||
return str(FamilyRelType(data[5]))
|
return str(FamilyRelType(data[5]))
|
||||||
|
|
||||||
def column_marriage(self, data):
|
def column_marriage(self, data):
|
||||||
family = self.db.get_family_from_handle(data[0])
|
handle = data[0]
|
||||||
event = get_marriage_or_fallback(self.db, family, "<i>%s</i>")
|
cached, value = self.get_cached_value(handle, "MARRIAGE")
|
||||||
if event:
|
if not cached:
|
||||||
if event.date.format:
|
family = self.db.get_family_from_handle(data[0])
|
||||||
return event.date.format % displayer.display(event.date)
|
event = get_marriage_or_fallback(self.db, family, "<i>%s</i>")
|
||||||
elif not get_date_valid(event):
|
if event:
|
||||||
return invalid_date_format % displayer.display(event.date)
|
if event.date.format:
|
||||||
|
value = event.date.format % displayer.display(event.date)
|
||||||
|
elif not get_date_valid(event):
|
||||||
|
value = invalid_date_format % displayer.display(event.date)
|
||||||
|
else:
|
||||||
|
value = "%s" % displayer.display(event.date)
|
||||||
else:
|
else:
|
||||||
return "%s" % displayer.display(event.date)
|
value = ''
|
||||||
else:
|
self.set_cached_value(handle, "MARRIAGE", value)
|
||||||
return ''
|
return value
|
||||||
|
|
||||||
def sort_marriage(self, data):
|
def sort_marriage(self, data):
|
||||||
family = self.db.get_family_from_handle(data[0])
|
handle = data[0]
|
||||||
event = get_marriage_or_fallback(self.db, family)
|
cached, value = self.get_cached_value(handle, "SORT_MARRIAGE")
|
||||||
if event:
|
if not cached:
|
||||||
return "%09d" % event.date.get_sort_value()
|
family = self.db.get_family_from_handle(data[0])
|
||||||
else:
|
event = get_marriage_or_fallback(self.db, family)
|
||||||
return ''
|
if event:
|
||||||
|
value = "%09d" % event.date.get_sort_value()
|
||||||
|
else:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(handle, "SORT_MARRIAGE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_id(self, data):
|
def column_id(self, data):
|
||||||
return str(data[1])
|
return str(data[1])
|
||||||
@@ -177,20 +207,28 @@ class FamilyModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[13]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
this_priority = tag.get_priority()
|
tag_priority = None
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
for handle in data[13]:
|
||||||
tag_color = tag.get_color()
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
|
@@ -73,6 +73,7 @@ from gi.repository import Gtk
|
|||||||
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
||||||
from gramps.gen.constfunc import conv_to_unicode, handle2internal
|
from gramps.gen.constfunc import conv_to_unicode, handle2internal
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
from .basemodel import BaseModel
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -442,7 +443,7 @@ class FlatNodeMap(object):
|
|||||||
# FlatBaseModel
|
# FlatBaseModel
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
class FlatBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
||||||
"""
|
"""
|
||||||
The base class for all flat treeview models.
|
The base class for all flat treeview models.
|
||||||
It keeps a FlatNodeMap, and obtains data from database as needed
|
It keeps a FlatNodeMap, and obtains data from database as needed
|
||||||
@@ -454,7 +455,8 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
search=None, skip=set(),
|
search=None, skip=set(),
|
||||||
sort_map=None):
|
sort_map=None):
|
||||||
cput = time.clock()
|
cput = time.clock()
|
||||||
super(FlatBaseModel, self).__init__()
|
GObject.GObject.__init__(self)
|
||||||
|
BaseModel.__init__(self)
|
||||||
#inheriting classes must set self.map to obtain the data
|
#inheriting classes must set self.map to obtain the data
|
||||||
self.prev_handle = None
|
self.prev_handle = None
|
||||||
self.prev_data = None
|
self.prev_data = None
|
||||||
@@ -491,6 +493,7 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
"""
|
"""
|
||||||
Unset all elements that prevent garbage collection
|
Unset all elements that prevent garbage collection
|
||||||
"""
|
"""
|
||||||
|
BaseModel.destroy(self)
|
||||||
self.db = None
|
self.db = None
|
||||||
self.sort_func = None
|
self.sort_func = None
|
||||||
if self.node_map:
|
if self.node_map:
|
||||||
@@ -556,15 +559,6 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def clear_cache(self, handle=None):
|
|
||||||
"""
|
|
||||||
If you use a cache, overwrite here so it is cleared when this
|
|
||||||
method is called (on rebuild)
|
|
||||||
:param handle: if None, clear entire cache, otherwise clear the handle
|
|
||||||
entry if present
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def sort_keys(self):
|
def sort_keys(self):
|
||||||
"""
|
"""
|
||||||
Return the (sort_key, handle) list of all data that can maximally
|
Return the (sort_key, handle) list of all data that can maximally
|
||||||
@@ -775,7 +769,10 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
We need this to search in the column in the GUI
|
We need this to search in the column in the GUI
|
||||||
"""
|
"""
|
||||||
if handle != self.prev_handle:
|
if handle != self.prev_handle:
|
||||||
data = self.map(handle)
|
cached, data = self.get_cached_value(handle, col)
|
||||||
|
if not cached:
|
||||||
|
data = self.map(handle)
|
||||||
|
self.set_cached_value(handle, col, data)
|
||||||
if data is None:
|
if data is None:
|
||||||
#object is no longer present
|
#object is no longer present
|
||||||
return ''
|
return ''
|
||||||
|
@@ -174,20 +174,28 @@ class MediaModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[11]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
this_priority = tag.get_priority()
|
tag_priority = None
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
for handle in data[11]:
|
||||||
tag_color = tag.get_color()
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
|
@@ -137,22 +137,31 @@ class NoteModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[Note.POS_TAGS]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
this_priority = tag.get_priority()
|
for handle in data[Note.POS_TAGS]:
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_color = tag.get_color()
|
if tag:
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
return tag_color
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
value = tag_color
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
"""
|
"""
|
||||||
|
@@ -38,6 +38,7 @@ from html import escape
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
from gi.repository import GObject
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -59,15 +60,15 @@ from gramps.gen.lib import (Name, EventRef, EventType, EventRoleType,
|
|||||||
from gramps.gen.display.name import displayer as name_displayer
|
from gramps.gen.display.name import displayer as name_displayer
|
||||||
from gramps.gen.display.place import displayer as place_displayer
|
from gramps.gen.display.place import displayer as place_displayer
|
||||||
from gramps.gen.datehandler import format_time, get_date, get_date_valid
|
from gramps.gen.datehandler import format_time, get_date, get_date_valid
|
||||||
from .lru import LRU
|
|
||||||
from .flatbasemodel import FlatBaseModel
|
from .flatbasemodel import FlatBaseModel
|
||||||
from .treebasemodel import TreeBaseModel
|
from .treebasemodel import TreeBaseModel
|
||||||
|
from .basemodel import BaseModel
|
||||||
from gramps.gen.config import config
|
from gramps.gen.config import config
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# COLUMN constants
|
# COLUMN constants; positions in raw data structure
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
COLUMN_ID = 1
|
COLUMN_ID = 1
|
||||||
@@ -90,19 +91,17 @@ invalid_date_format = config.get('preferences.invalid-date-format')
|
|||||||
# PeopleBaseModel
|
# PeopleBaseModel
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PeopleBaseModel(object):
|
class PeopleBaseModel(BaseModel):
|
||||||
"""
|
"""
|
||||||
Basic Model interface to handle the PersonViews
|
Basic Model interface to handle the PersonViews
|
||||||
"""
|
"""
|
||||||
_GENDER = [ _('female'), _('male'), _('unknown') ]
|
_GENDER = [ _('female'), _('male'), _('unknown') ]
|
||||||
|
|
||||||
# LRU cache size
|
|
||||||
_CACHE_SIZE = 250
|
|
||||||
|
|
||||||
def __init__(self, db):
|
def __init__(self, db):
|
||||||
"""
|
"""
|
||||||
Initialize the model building the initial data
|
Initialize the model building the initial data
|
||||||
"""
|
"""
|
||||||
|
BaseModel.__init__(self)
|
||||||
self.db = db
|
self.db = db
|
||||||
self.gen_cursor = db.get_person_cursor
|
self.gen_cursor = db.get_person_cursor
|
||||||
self.map = db.get_raw_person_data
|
self.map = db.get_raw_person_data
|
||||||
@@ -144,24 +143,16 @@ class PeopleBaseModel(object):
|
|||||||
self.column_tag_color,
|
self.column_tag_color,
|
||||||
]
|
]
|
||||||
|
|
||||||
#columns are accessed on every mouse over, so it is worthwhile to
|
|
||||||
#cache columns visible in one screen to avoid expensive database
|
|
||||||
#lookup of derived values
|
|
||||||
self.lru_name = LRU(PeopleBaseModel._CACHE_SIZE)
|
|
||||||
self.lru_spouse = LRU(PeopleBaseModel._CACHE_SIZE)
|
|
||||||
self.lru_bdate = LRU(PeopleBaseModel._CACHE_SIZE)
|
|
||||||
self.lru_ddate = LRU(PeopleBaseModel._CACHE_SIZE)
|
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
"""
|
"""
|
||||||
Unset all elements that can prevent garbage collection
|
Unset all elements that can prevent garbage collection
|
||||||
"""
|
"""
|
||||||
|
BaseModel.destroy(self)
|
||||||
self.db = None
|
self.db = None
|
||||||
self.gen_cursor = None
|
self.gen_cursor = None
|
||||||
self.map = None
|
self.map = None
|
||||||
self.fmap = None
|
self.fmap = None
|
||||||
self.smap = None
|
self.smap = None
|
||||||
self.clear_local_cache()
|
|
||||||
|
|
||||||
def color_column(self):
|
def color_column(self):
|
||||||
"""
|
"""
|
||||||
@@ -169,63 +160,38 @@ class PeopleBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
return 15
|
return 15
|
||||||
|
|
||||||
def clear_local_cache(self, handle=None):
|
|
||||||
""" Clear the LRU cache """
|
|
||||||
if handle:
|
|
||||||
try:
|
|
||||||
del self.lru_name[handle]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
del self.lru_spouse[handle]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
del self.lru_bdate[handle]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
del self.lru_ddate[handle]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.lru_name.clear()
|
|
||||||
self.lru_spouse.clear()
|
|
||||||
self.lru_bdate.clear()
|
|
||||||
self.lru_ddate.clear()
|
|
||||||
|
|
||||||
def on_get_n_columns(self):
|
def on_get_n_columns(self):
|
||||||
""" Return the number of columns in the model """
|
""" Return the number of columns in the model """
|
||||||
return len(self.fmap)+1
|
return len(self.fmap)+1
|
||||||
|
|
||||||
def sort_name(self, data):
|
def sort_name(self, data):
|
||||||
name = name_displayer.raw_sorted_name(data[COLUMN_NAME])
|
handle = data[0]
|
||||||
# internally we work with utf-8
|
cached, name = self.get_cached_value(handle, "SORT_NAME")
|
||||||
if not isinstance(name, str):
|
if not cached:
|
||||||
name = name.decode('utf-8')
|
name = name_displayer.raw_sorted_name(data[COLUMN_NAME])
|
||||||
|
# internally we work with utf-8
|
||||||
|
if not isinstance(name, str):
|
||||||
|
name = name.decode('utf-8')
|
||||||
|
self.set_cached_value(handle, "SORT_NAME", name)
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def column_name(self, data):
|
def column_name(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
if handle in self.lru_name:
|
cached, name = self.get_cached_value(handle, "NAME")
|
||||||
name = self.lru_name[handle]
|
if not cached:
|
||||||
else:
|
|
||||||
name = name_displayer.raw_display_name(data[COLUMN_NAME])
|
name = name_displayer.raw_display_name(data[COLUMN_NAME])
|
||||||
# internally we work with utf-8 for python 2.7
|
# internally we work with utf-8 for python 2.7
|
||||||
if not isinstance(name, str):
|
if not isinstance(name, str):
|
||||||
name = name.encode('utf-8')
|
name = name.encode('utf-8')
|
||||||
if not self._in_build:
|
self.set_cached_value(handle, "NAME", name)
|
||||||
self.lru_name[handle] = name
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def column_spouse(self, data):
|
def column_spouse(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
if handle in self.lru_spouse:
|
cached, value = self.get_cached_value(handle, "SPOUSE")
|
||||||
value = self.lru_spouse[handle]
|
if not cached:
|
||||||
else:
|
|
||||||
value = self._get_spouse_data(data)
|
value = self._get_spouse_data(data)
|
||||||
if not self._in_build:
|
self.set_cached_value(handle, "SPOUSE", value)
|
||||||
self.lru_spouse[handle] = value
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def column_private(self, data):
|
def column_private(self, data):
|
||||||
@@ -265,17 +231,19 @@ class PeopleBaseModel(object):
|
|||||||
|
|
||||||
def column_birth_day(self, data):
|
def column_birth_day(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
if handle in self.lru_bdate:
|
cached, value = self.get_cached_value(handle, "BIRTH_DAY")
|
||||||
value = self.lru_bdate[handle]
|
if not cached:
|
||||||
else:
|
|
||||||
value = self._get_birth_data(data, False)
|
value = self._get_birth_data(data, False)
|
||||||
if not self._in_build:
|
self.set_cached_value(handle, "BIRTH_DAY", value)
|
||||||
self.lru_bdate[handle] = value
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def sort_birth_day(self, data):
|
def sort_birth_day(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
return self._get_birth_data(data, True)
|
cached, value = self.get_cached_value(handle, "SORT_BIRTH_DAY")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_birth_data(data, True)
|
||||||
|
self.set_cached_value(handle, "SORT_BIRTH_DAY", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def _get_birth_data(self, data, sort_mode):
|
def _get_birth_data(self, data, sort_mode):
|
||||||
index = data[COLUMN_BIRTH]
|
index = data[COLUMN_BIRTH]
|
||||||
@@ -320,17 +288,19 @@ class PeopleBaseModel(object):
|
|||||||
|
|
||||||
def column_death_day(self, data):
|
def column_death_day(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
if handle in self.lru_ddate:
|
cached, value = self.get_cached_value(handle, "DEATH_DAY")
|
||||||
value = self.lru_ddate[handle]
|
if not cached:
|
||||||
else:
|
|
||||||
value = self._get_death_data(data, False)
|
value = self._get_death_data(data, False)
|
||||||
if not self._in_build:
|
self.set_cached_value(handle, "DEATH_DAY", value)
|
||||||
self.lru_ddate[handle] = value
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def sort_death_day(self, data):
|
def sort_death_day(self, data):
|
||||||
handle = data[0]
|
handle = data[0]
|
||||||
return self._get_death_data(data, True)
|
cached, value = self.get_cached_value(handle, "SORT_DEATH_DAY")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_death_data(data, True)
|
||||||
|
self.set_cached_value(handle, "SORT_DEATH_DAY", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def _get_death_data(self, data, sort_mode):
|
def _get_death_data(self, data, sort_mode):
|
||||||
index = data[COLUMN_DEATH]
|
index = data[COLUMN_DEATH]
|
||||||
@@ -375,61 +345,86 @@ class PeopleBaseModel(object):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def column_birth_place(self, data):
|
def column_birth_place(self, data):
|
||||||
index = data[COLUMN_BIRTH]
|
handle = data[0]
|
||||||
if index != -1:
|
cached, value = self.get_cached_value(handle, "BIRTH_PLACE")
|
||||||
try:
|
if cached:
|
||||||
local = data[COLUMN_EVENT][index]
|
return value
|
||||||
br = EventRef()
|
else:
|
||||||
br.unserialize(local)
|
index = data[COLUMN_BIRTH]
|
||||||
event = self.db.get_event_from_handle(br.ref)
|
if index != -1:
|
||||||
if event:
|
try:
|
||||||
place_title = place_displayer.display_event(self.db, event)
|
local = data[COLUMN_EVENT][index]
|
||||||
if place_title:
|
br = EventRef()
|
||||||
return escape(place_title)
|
br.unserialize(local)
|
||||||
except:
|
event = self.db.get_event_from_handle(br.ref)
|
||||||
return ''
|
if event:
|
||||||
|
place_title = place_displayer.display_event(self.db, event)
|
||||||
|
if place_title:
|
||||||
|
value = escape(place_title)
|
||||||
|
self.set_cached_value(handle, "BIRTH_PLACE", value)
|
||||||
|
return value
|
||||||
|
except:
|
||||||
|
value = ''
|
||||||
|
self.set_cached_value(handle, "BIRTH_PLACE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
for event_ref in data[COLUMN_EVENT]:
|
for event_ref in data[COLUMN_EVENT]:
|
||||||
er = EventRef()
|
er = EventRef()
|
||||||
er.unserialize(event_ref)
|
er.unserialize(event_ref)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
etype = event.get_type()
|
etype = event.get_type()
|
||||||
if (etype in [EventType.BAPTISM, EventType.CHRISTEN] and
|
if (etype in [EventType.BAPTISM, EventType.CHRISTEN] and
|
||||||
er.get_role() == EventRoleType.PRIMARY):
|
er.get_role() == EventRoleType.PRIMARY):
|
||||||
|
place_title = place_displayer.display_event(self.db, event)
|
||||||
place_title = place_displayer.display_event(self.db, event)
|
if place_title:
|
||||||
if place_title:
|
value = "<i>%s</i>" % escape(place_title)
|
||||||
return "<i>%s</i>" % escape(place_title)
|
self.set_cached_value(handle, "BIRTH_PLACE", value)
|
||||||
return ""
|
return value
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "BIRTH_PLACE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_death_place(self, data):
|
def column_death_place(self, data):
|
||||||
index = data[COLUMN_DEATH]
|
handle = data[0]
|
||||||
if index != -1:
|
cached, value = self.get_cached_value(handle, "DEATH_PLACE")
|
||||||
try:
|
if cached:
|
||||||
local = data[COLUMN_EVENT][index]
|
return value
|
||||||
dr = EventRef()
|
else:
|
||||||
dr.unserialize(local)
|
index = data[COLUMN_DEATH]
|
||||||
event = self.db.get_event_from_handle(dr.ref)
|
if index != -1:
|
||||||
if event:
|
try:
|
||||||
place_title = place_displayer.display_event(self.db, event)
|
local = data[COLUMN_EVENT][index]
|
||||||
if place_title:
|
dr = EventRef()
|
||||||
return escape(place_title)
|
dr.unserialize(local)
|
||||||
except:
|
event = self.db.get_event_from_handle(dr.ref)
|
||||||
return ''
|
if event:
|
||||||
|
place_title = place_displayer.display_event(self.db, event)
|
||||||
for event_ref in data[COLUMN_EVENT]:
|
if place_title:
|
||||||
er = EventRef()
|
value = escape(place_title)
|
||||||
er.unserialize(event_ref)
|
self.set_cached_value(handle, "DEATH_PLACE", value)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
return value
|
||||||
etype = event.get_type()
|
except:
|
||||||
if (etype in [EventType.BURIAL, EventType.CREMATION,
|
value = ''
|
||||||
EventType.CAUSE_DEATH]
|
self.set_cached_value(handle, "DEATH_PLACE", value)
|
||||||
and er.get_role() == EventRoleType.PRIMARY):
|
return value
|
||||||
|
|
||||||
place_title = place_displayer.display_event(self.db, event)
|
for event_ref in data[COLUMN_EVENT]:
|
||||||
if place_title:
|
er = EventRef()
|
||||||
return "<i>%s</i>" % escape(place_title)
|
er.unserialize(event_ref)
|
||||||
return ""
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
|
etype = event.get_type()
|
||||||
|
if (etype in [EventType.BURIAL, EventType.CREMATION,
|
||||||
|
EventType.CAUSE_DEATH]
|
||||||
|
and er.get_role() == EventRoleType.PRIMARY):
|
||||||
|
|
||||||
|
place_title = place_displayer.display_event(self.db, event)
|
||||||
|
if place_title:
|
||||||
|
value = "<i>%s</i>" % escape(place_title)
|
||||||
|
self.set_cached_value(handle, "DEATH_PLACE", value)
|
||||||
|
return value
|
||||||
|
value = ""
|
||||||
|
self.set_cached_value(handle, "DEATH_PLACE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def _get_parents_data(self, data):
|
def _get_parents_data(self, data):
|
||||||
parents = 0
|
parents = 0
|
||||||
@@ -468,56 +463,110 @@ class PeopleBaseModel(object):
|
|||||||
return todo
|
return todo
|
||||||
|
|
||||||
def column_parents(self, data):
|
def column_parents(self, data):
|
||||||
return str(self._get_parents_data(data))
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "PARENTS")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_parents_data(data)
|
||||||
|
self.set_cached_value(handle, "PARENTS", value)
|
||||||
|
return str(value)
|
||||||
|
|
||||||
def sort_parents(self, data):
|
def sort_parents(self, data):
|
||||||
return '%06d' % self._get_parents_data(data)
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "SORT_PARENTS")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_parents_data(data)
|
||||||
|
self.set_cached_value(handle, "SORT_PARENTS", value)
|
||||||
|
return '%06d' % value
|
||||||
|
|
||||||
def column_marriages(self, data):
|
def column_marriages(self, data):
|
||||||
return str(self._get_marriages_data(data))
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "MARRIAGES")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_marriages_data(data)
|
||||||
|
self.set_cached_value(handle, "MARRIAGES", value)
|
||||||
|
return str(value)
|
||||||
|
|
||||||
def sort_marriages(self, data):
|
def sort_marriages(self, data):
|
||||||
return '%06d' % self._get_marriages_data(data)
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "SORT_MARRIAGES")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_marriages_data(data)
|
||||||
|
self.set_cached_value(handle, "SORT_MARRIAGES", value)
|
||||||
|
return '%06d' % value
|
||||||
|
|
||||||
def column_children(self, data):
|
def column_children(self, data):
|
||||||
return str(self._get_children_data(data))
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "CHILDREN")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_children_data(data)
|
||||||
|
self.set_cached_value(handle, "CHILDREN", value)
|
||||||
|
return str(value)
|
||||||
|
|
||||||
def sort_children(self, data):
|
def sort_children(self, data):
|
||||||
return '%06d' % self._get_children_data(data)
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "SORT_CHILDREN")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_children_data(data)
|
||||||
|
self.set_cached_value(handle, "SORT_CHILDREN", value)
|
||||||
|
return '%06d' % value
|
||||||
|
|
||||||
def column_todo(self, data):
|
def column_todo(self, data):
|
||||||
return str(self._get_todo_data(data))
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "TODO")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_todo_data(data)
|
||||||
|
self.set_cached_value(handle, "TODO", value)
|
||||||
|
return str(value)
|
||||||
|
|
||||||
def sort_todo(self, data):
|
def sort_todo(self, data):
|
||||||
return '%06d' % self._get_todo_data(data)
|
handle = data[0]
|
||||||
|
cached, value = self.get_cached_value(handle, "SORT_TODO")
|
||||||
|
if not cached:
|
||||||
|
value = self._get_todo_data(data)
|
||||||
|
self.set_cached_value(handle, "SORT_TODO", value)
|
||||||
|
return '%06d' % value
|
||||||
|
|
||||||
def get_tag_name(self, tag_handle):
|
def get_tag_name(self, tag_handle):
|
||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[COLUMN_TAGS]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
this_priority = tag.get_priority()
|
for handle in data[COLUMN_TAGS]:
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_color = tag.get_color()
|
if tag:
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
return tag_color
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
value = tag_color
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
"""
|
"""
|
||||||
Return the sorted list of tags.
|
Return the sorted list of tags.
|
||||||
"""
|
"""
|
||||||
tag_list = list(map(self.get_tag_name, data[COLUMN_TAGS]))
|
handle = data[0]
|
||||||
return ', '.join(sorted(tag_list, key=glocale.sort_key))
|
cached, value = self.get_cached_value(handle, "TAGS")
|
||||||
|
if not cached:
|
||||||
|
tag_list = list(map(self.get_tag_name, data[COLUMN_TAGS]))
|
||||||
|
value = ', '.join(sorted(tag_list, key=glocale.sort_key))
|
||||||
|
self.set_cached_value(handle, "TAGS", value)
|
||||||
|
return value
|
||||||
|
|
||||||
class PersonListModel(PeopleBaseModel, FlatBaseModel):
|
class PersonListModel(PeopleBaseModel, FlatBaseModel):
|
||||||
"""
|
"""
|
||||||
@@ -529,10 +578,6 @@ class PersonListModel(PeopleBaseModel, FlatBaseModel):
|
|||||||
FlatBaseModel.__init__(self, db, search=search, skip=skip, scol=scol,
|
FlatBaseModel.__init__(self, db, search=search, skip=skip, scol=scol,
|
||||||
order=order, sort_map=sort_map)
|
order=order, sort_map=sort_map)
|
||||||
|
|
||||||
def clear_cache(self, handle=None):
|
|
||||||
""" Clear the LRU cache """
|
|
||||||
PeopleBaseModel.clear_local_cache(self, handle)
|
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
"""
|
"""
|
||||||
Unset all elements that can prevent garbage collection
|
Unset all elements that can prevent garbage collection
|
||||||
@@ -546,7 +591,6 @@ class PersonTreeModel(PeopleBaseModel, TreeBaseModel):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, db, scol=0, order=Gtk.SortType.ASCENDING, search=None,
|
def __init__(self, db, scol=0, order=Gtk.SortType.ASCENDING, search=None,
|
||||||
skip=set(), sort_map=None):
|
skip=set(), sort_map=None):
|
||||||
|
|
||||||
PeopleBaseModel.__init__(self, db)
|
PeopleBaseModel.__init__(self, db)
|
||||||
TreeBaseModel.__init__(self, db, search=search, skip=skip, scol=scol,
|
TreeBaseModel.__init__(self, db, search=search, skip=skip, scol=scol,
|
||||||
order=order, sort_map=sort_map)
|
order=order, sort_map=sort_map)
|
||||||
@@ -564,13 +608,6 @@ class PersonTreeModel(PeopleBaseModel, TreeBaseModel):
|
|||||||
"""
|
"""
|
||||||
self.number_items = self.db.get_number_of_people
|
self.number_items = self.db.get_number_of_people
|
||||||
|
|
||||||
def clear_cache(self, handle=None):
|
|
||||||
""" Clear the LRU cache
|
|
||||||
overwrite of base methods
|
|
||||||
"""
|
|
||||||
TreeBaseModel.clear_cache(self, handle)
|
|
||||||
PeopleBaseModel.clear_local_cache(self, handle)
|
|
||||||
|
|
||||||
def get_tree_levels(self):
|
def get_tree_levels(self):
|
||||||
"""
|
"""
|
||||||
Return the headings of the levels in the hierarchy.
|
Return the headings of the levels in the hierarchy.
|
||||||
|
@@ -116,9 +116,14 @@ class PlaceBaseModel(object):
|
|||||||
return len(self.fmap)+1
|
return len(self.fmap)+1
|
||||||
|
|
||||||
def column_title(self, data):
|
def column_title(self, data):
|
||||||
place = Place()
|
handle = data[0]
|
||||||
place.unserialize(data)
|
cached, value = self.get_cached_value(handle, "PLACE")
|
||||||
return place_displayer.display(self.db, place)
|
if not cached:
|
||||||
|
place = Place()
|
||||||
|
place.unserialize(data)
|
||||||
|
value = place_displayer.display(self.db, place)
|
||||||
|
self.set_cached_value(handle, "PLACE", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_name(self, data):
|
def column_name(self, data):
|
||||||
return str(data[6][0])
|
return str(data[6][0])
|
||||||
@@ -181,22 +186,31 @@ class PlaceBaseModel(object):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[16]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
this_priority = tag.get_priority()
|
for handle in data[16]:
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_color = tag.get_color()
|
if tag:
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
return tag_color
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
value = tag_color
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
"""
|
"""
|
||||||
|
@@ -239,21 +239,29 @@ class RepositoryModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
# TAG_NAME isn't a column, but we cache it
|
||||||
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[8]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
|
for handle in data[8]:
|
||||||
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
this_priority = tag.get_priority()
|
this_priority = tag.get_priority()
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
tag_color = tag.get_color()
|
tag_color = tag.get_color()
|
||||||
tag_priority = this_priority
|
tag_priority = this_priority
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", tag_color)
|
||||||
return tag_color
|
return tag_color
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
|
@@ -130,22 +130,31 @@ class SourceModel(FlatBaseModel):
|
|||||||
"""
|
"""
|
||||||
Return the tag name from the given tag handle.
|
Return the tag name from the given tag handle.
|
||||||
"""
|
"""
|
||||||
return self.db.get_tag_from_handle(tag_handle).get_name()
|
cached, value = self.get_cached_value(tag_handle, "TAG_NAME")
|
||||||
|
if not cached:
|
||||||
|
value = self.db.get_tag_from_handle(tag_handle).get_name()
|
||||||
|
self.set_cached_value(tag_handle, "TAG_NAME", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tag_color(self, data):
|
def column_tag_color(self, data):
|
||||||
"""
|
"""
|
||||||
Return the tag color.
|
Return the tag color.
|
||||||
"""
|
"""
|
||||||
tag_color = "#000000000000"
|
tag_handle = data[0]
|
||||||
tag_priority = None
|
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
|
||||||
for handle in data[11]:
|
if not cached:
|
||||||
tag = self.db.get_tag_from_handle(handle)
|
tag_color = "#000000000000"
|
||||||
if tag:
|
tag_priority = None
|
||||||
this_priority = tag.get_priority()
|
for handle in data[11]:
|
||||||
if tag_priority is None or this_priority < tag_priority:
|
tag = self.db.get_tag_from_handle(handle)
|
||||||
tag_color = tag.get_color()
|
if tag:
|
||||||
tag_priority = this_priority
|
this_priority = tag.get_priority()
|
||||||
return tag_color
|
if tag_priority is None or this_priority < tag_priority:
|
||||||
|
tag_color = tag.get_color()
|
||||||
|
tag_priority = this_priority
|
||||||
|
value = tag_color
|
||||||
|
self.set_cached_value(tag_handle, "TAG_COLOR", value)
|
||||||
|
return value
|
||||||
|
|
||||||
def column_tags(self, data):
|
def column_tags(self, data):
|
||||||
"""
|
"""
|
||||||
|
@@ -53,9 +53,9 @@ from gi.repository import Gtk
|
|||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
import gramps.gui.widgets.progressdialog as progressdlg
|
import gramps.gui.widgets.progressdialog as progressdlg
|
||||||
from .lru import LRU
|
|
||||||
from bisect import bisect_right
|
from bisect import bisect_right
|
||||||
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
||||||
|
from .basemodel import BaseModel
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -231,7 +231,7 @@ class NodeMap(object):
|
|||||||
# TreeBaseModel
|
# TreeBaseModel
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
||||||
"""
|
"""
|
||||||
The base class for all hierarchical treeview models. The model defines the
|
The base class for all hierarchical treeview models. The model defines the
|
||||||
mapping between a unique node and a path. Paths are defined by a tuple.
|
mapping between a unique node and a path. Paths are defined by a tuple.
|
||||||
@@ -274,9 +274,6 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
secondary object type.
|
secondary object type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# LRU cache size
|
|
||||||
_CACHE_SIZE = 250
|
|
||||||
|
|
||||||
def __init__(self, db,
|
def __init__(self, db,
|
||||||
search=None, skip=set(),
|
search=None, skip=set(),
|
||||||
scol=0, order=Gtk.SortType.ASCENDING, sort_map=None,
|
scol=0, order=Gtk.SortType.ASCENDING, sort_map=None,
|
||||||
@@ -284,7 +281,8 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
group_can_have_handle = False,
|
group_can_have_handle = False,
|
||||||
has_secondary=False):
|
has_secondary=False):
|
||||||
cput = time.clock()
|
cput = time.clock()
|
||||||
super(TreeBaseModel, self).__init__()
|
GObject.GObject.__init__(self)
|
||||||
|
BaseModel.__init__(self)
|
||||||
#We create a stamp to recognize invalid iterators. From the docs:
|
#We create a stamp to recognize invalid iterators. From the docs:
|
||||||
#Set the stamp to be equal to your model's stamp, to mark the
|
#Set the stamp to be equal to your model's stamp, to mark the
|
||||||
#iterator as valid. When your model's structure changes, you should
|
#iterator as valid. When your model's structure changes, you should
|
||||||
@@ -332,8 +330,6 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
|
|
||||||
self._in_build = False
|
self._in_build = False
|
||||||
|
|
||||||
self.lru_data = LRU(TreeBaseModel._CACHE_SIZE)
|
|
||||||
|
|
||||||
self.__total = 0
|
self.__total = 0
|
||||||
self.__displayed = 0
|
self.__displayed = 0
|
||||||
|
|
||||||
@@ -350,6 +346,7 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
"""
|
"""
|
||||||
Unset all elements that prevent garbage collection
|
Unset all elements that prevent garbage collection
|
||||||
"""
|
"""
|
||||||
|
BaseModel.destroy(self)
|
||||||
self.db = None
|
self.db = None
|
||||||
self.sort_func = None
|
self.sort_func = None
|
||||||
if self.has_secondary:
|
if self.has_secondary:
|
||||||
@@ -364,8 +361,6 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
self.search2 = None
|
self.search2 = None
|
||||||
self.current_filter = None
|
self.current_filter = None
|
||||||
self.current_filter2 = None
|
self.current_filter2 = None
|
||||||
self.clear_cache()
|
|
||||||
self.lru_data = None
|
|
||||||
|
|
||||||
def _set_base_data(self):
|
def _set_base_data(self):
|
||||||
"""
|
"""
|
||||||
@@ -410,18 +405,6 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def clear_cache(self, handle=None):
|
|
||||||
"""
|
|
||||||
Clear the LRU cache.
|
|
||||||
"""
|
|
||||||
if handle:
|
|
||||||
try:
|
|
||||||
del self.lru_data[handle]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.lru_data.clear()
|
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
"""
|
"""
|
||||||
Clear the data map.
|
Clear the data map.
|
||||||
@@ -958,16 +941,16 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
"""
|
"""
|
||||||
if secondary is None:
|
if secondary is None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
cached, data = self.get_cached_value(handle, col)
|
||||||
|
|
||||||
if handle in self.lru_data:
|
if not cached:
|
||||||
data = self.lru_data[handle]
|
|
||||||
else:
|
|
||||||
if not secondary:
|
if not secondary:
|
||||||
data = self.map(handle)
|
data = self.map(handle)
|
||||||
else:
|
else:
|
||||||
data = self.map2(handle)
|
data = self.map2(handle)
|
||||||
if not self._in_build:
|
if store_cache:
|
||||||
self.lru_data[handle] = data
|
self.set_cached_value(handle, col, data)
|
||||||
|
|
||||||
if not secondary:
|
if not secondary:
|
||||||
# None is used to indicate this column has no data
|
# None is used to indicate this column has no data
|
||||||
|
Reference in New Issue
Block a user