本文整理汇总了Python中gramps.gen.filters.CustomFilters类的典型用法代码示例。如果您正苦于以下问题:Python CustomFilters类的具体用法?Python CustomFilters怎么用?Python CustomFilters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomFilters类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_model
def build_model(self, namespace):
"""
Build a model for the combo box selector.
"""
from gi.repository import Gtk
from gi.repository import GObject
from gramps.gen.filters import CustomFilters
if namespace == "person":
# Populate the Person Filter
entire_db = GenericFilter()
entire_db.set_name(_("Include all selected people"))
the_filters = [entire_db]
if self.person:
the_filters += self.__define_person_filters()
the_filters.extend(CustomFilters.get_filters('Person'))
model = Gtk.ListStore(GObject.TYPE_STRING, object)
for item in the_filters:
model.append(row=[item.get_name(), item])
elif namespace == "note":
# Populate the Notes Filter
entire_db = GenericFilter()
entire_db.set_name(_("Include all selected notes"))
notes_filters = [entire_db]
notes_filters.extend(CustomFilters.get_filters('Note'))
model = Gtk.ListStore(GObject.TYPE_STRING, object)
for item in notes_filters:
model.append(row=[item.get_name(), item])
elif namespace == "living":
model = Gtk.ListStore(GObject.TYPE_STRING, int)
row = 0
for item in [_('Include all selected people'),
_('Replace given names of living people'),
_('Replace complete name of living people'),
_('Do not include living people'),
]:
model.append(row=[item, row])
row += 1
elif namespace == "reference":
model = Gtk.ListStore(GObject.TYPE_STRING, int)
row = 0
for item in [
_('Include all selected records'),
_('Do not include records not linked to a selected person'),]:
model.append(row=[item, row])
row += 1
return model
示例2: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
category_name = _("Report Options")
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
stdoptions.add_private_data_option(menu, category_name)
stdoptions.add_name_format_option(menu, category_name)
center = EnumeratedListOption(_("Center on"), "Event")
center.set_items([
("Event", _("Event")),
("Person", _("Person"))])
center.set_help(_("If report is event or person centered"))
menu.add_option(category_name, "center", center)
stdoptions.add_localization_option(menu, category_name)
示例3: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
category_name = _("Report Options")
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
reporttype = EnumeratedListOption(_("Type de Liste"), "ListeType")
reporttype.set_items([
("ListeEclair", _("Tiny Tafel")),
("cousingenweb", _("cousingenweb"))])
reporttype.set_help(_("Type de liste"))
menu.add_option(category_name, "reporttype", reporttype)
incpriv = BooleanOption(_("Include private data"), True)
incpriv.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incpriv", incpriv)
示例4: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
category_name = _("Report Options")
# Reload filters to pick any new ones
CustomFilters = None
#p from Filters import CustomFilters, GenericFilter
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
center = EnumeratedListOption(_("Center on"), "Event")
center.set_items([
("Event", _("Event")),
("Person", _("Person"))])
center.set_help(_("If report is event or person centered"))
menu.add_option(category_name, "center", center)
incpriv = BooleanOption(_("Include private data"), True)
incpriv.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incpriv", incpriv)
示例5: add_menu_options
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_('book|Title'), _('Title of the Book') )
title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", title)
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book') )
subtitle.set_help(_("Subtitle string for the book."))
menu.add_option(category_name, "subtitle", subtitle)
dateinfo = time.localtime(time.time())
#rname = self.__db.get_researcher().get_name()
rname = "researcher name"
footer_string = _('Copyright %(year)d %(name)s') % {
'year' : dateinfo[0], 'name' : rname }
footer = StringOption(_('Footer'), footer_string )
footer.set_help(_("Footer string for the page."))
menu.add_option(category_name, "footer", footer)
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Source'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
showperson = BooleanOption(_("Show persons"), True)
showperson.set_help(_("Whether to show events and persons mentioned in the note"))
menu.add_option(category_name, "showperson", showperson)
sort_by_citation = BooleanOption(_("Sort by Citation"), True)
sort_by_citation.set_help(_("Whether to sort lines by Citation or Date"))
menu.add_option(category_name, "sort_by_citation", sort_by_citation)
sort_by_date = BooleanOption(_("Sort by Date"), True)
sort_by_date.set_help(_("Whether to sort lines by Date or citation"))
menu.add_option(category_name, "sort_by_date", sort_by_date)
placeformat = EnumeratedListOption(_("Place Format"), "Default")
placeformat.set_items([
("default", _("Default")),
("first", _("First")),
("firstplace", _("Firstplace")),
("firstplace-country", _("Firstplace-Country")),
("country", _("Country")),
("long", _("Long"))])
placeformat.set_help(_("If Placename is given long or short"))
menu.add_option(category_name, "placeformat", placeformat)
示例6: set
def set(self,local_filters,default=""):
self.store = Gtk.ListStore(GObject.TYPE_STRING)
self.set_model(self.store)
cell = Gtk.CellRendererText()
self.pack_start(cell,True)
self.add_attribute(cell,'text',0)
self.map = {}
active = 0
cnt = 0
for filt in local_filters:
self.store.append(row=[filt.get_name()])
self.map[str(filt.get_name())] = filt
if default != "" and default == filt.get_name():
active = cnt
cnt += 1
#for filt in SystemFilters.get_filters():
#self.store.append(row=[filt.get_name()])
#self.map[unicode(filt.get_name())] = filt
#if default != "" and default == filt.get_name():
#active = cnt
#cnt += 1
for filt in CustomFilters.get_filters():
self.store.append(row=[filt.get_name()])
self.map[str(filt.get_name())] = filt
if default != "" and default == filt.get_name():
active = cnt
cnt += 1
if active:
self.set_active(active)
elif len(local_filters):
self.set_active(2)
#elif len(SystemFilters.get_filters()):
#self.set_active(4 + len(local_filters))
elif len(CustomFilters.get_filters()):
self.set_active(4 + len(local_filters))
else:
self.set_active(0)
示例7: build_filter_model
def build_filter_model(space, local = []):
from gramps.gen.filters import CustomFilters
model = Gtk.ListStore(GObject.TYPE_STRING, object)
if isinstance(space, str):
flist = local + CustomFilters.get_filters(space)
elif isinstance(space, (list, tuple)):
flist = space
else:
return None
for filt in flist:
model.append(row=[filt.get_name(), filt])
return model
示例8: add_menu_options
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_('book|Title'), _('Title of the Book') )
title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", title)
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book') )
subtitle.set_help(_("Subtitle string for the book."))
menu.add_option(category_name, "subtitle", subtitle)
dateinfo = time.localtime(time.time())
#rname = self.__db.get_researcher().get_name()
rname = "researcher name"
footer_string = _('Copyright %(year)d %(name)s') % {
'year' : dateinfo[0], 'name' : rname }
footer = StringOption(_('Footer'), footer_string )
footer.set_help(_("Footer string for the page."))
menu.add_option(category_name, "footer", footer)
# Reload filters to pick any new ones
CustomFilters = None
#p from Filters import CustomFilters, GenericFilter
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Source'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
showinlaw = BooleanOption(_("Show inlaw"), True)
showinlaw.set_help(_("Whether to show inlaw persons"))
menu.add_option(category_name, "showinlaw", showinlaw)
showperson = BooleanOption(_("Show persons"), True)
showperson.set_help(_("Whether to show events and persons mentioned in the note"))
menu.add_option(category_name, "showperson", showperson)
incphotos = BooleanOption(_("Include Photos"), True)
incphotos.set_help(_("Whether to show photos mentioned in the citation"))
menu.add_option(category_name, "incphotos", incphotos)
示例9: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
category_name = _("Report Options")
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
stdoptions.add_name_format_option(menu, category_name)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
placeformat = EnumeratedListOption(_("Place Format"), "Default")
placeformat.set_items([
("default", _("Default")),
("first", _("First")),
("firstplace", _("Firstplace")),
("firstplace-country", _("Firstplace-Country")),
("country", _("Country")),
("long", _("Long"))])
placeformat.set_help(_("If Placename is given long or short"))
menu.add_option(category_name, "placeformat", placeformat)
incpriv = BooleanOption(_("Include private data"), True)
incpriv.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incpriv", incpriv)
showgodparents = BooleanOption(_("show godparents"), True)
showgodparents.set_help(_("Whether to include and show godparents"))
menu.add_option(category_name, "showgodparents", showgodparents)
stdoptions.add_localization_option(menu, category_name)
示例10: __init__
def __init__(self, local_filters=[], namespace="generic", default=""):
Gtk.ListStore.__init__(self, str)
self.list_map = []
self.def_index = 0
cnt = 0
for filt in local_filters:
name = filt.get_name()
self.append(row=[name])
self.list_map.append(filt)
if default != "" and default == name:
self.def_index = cnt
cnt += 1
for filt in CustomFilters.get_filters(namespace):
name = _(filt.get_name())
self.append(row=[name])
self.list_map.append(filt)
if default != "" and default == name:
self.def_index = cnt
cnt += 1
示例11: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
category_name = _("Report Options")
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
stdoptions.add_name_format_option(menu, category_name)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
# classwidth = EnumeratedListOption(_("Class wdith"), "classwidth")
classwidth = EnumeratedListOption(_("Class wdith"), 10)
classwidth.set_items([
(10, _("10 Years")),
(20, _("20 Years")),
(40, _("40 Years")),
(50, _("50 Years"))])
classwidth.set_help(_("classwidth fpr Analysis"))
menu.add_option(category_name, "classwidth", classwidth)
incpriv = BooleanOption(_("Include private data"), True)
incpriv.set_help(_("Whether to include private data"))
menu.add_option(category_name, "incpriv", incpriv)
stdoptions.add_localization_option(menu, category_name)
示例12: add_menu_options
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_('Report Title'), _('Title of the Report') )
title.set_help(_("Title string for the report."))
menu.add_option(category_name, "title", title)
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Report') )
subtitle.set_help(_("Subtitle string for the report."))
menu.add_option(category_name, "subtitle", subtitle)
dateinfo = time.localtime(time.time())
#rname = self.__db.get_researcher().get_name()
rname = "researcher name"
footer_string = _('Copyright %(year)d %(name)s') % {
'year' : dateinfo[0], 'name' : rname }
footer = StringOption(_('Footer'), footer_string )
footer.set_help(_("Footer string for the page."))
menu.add_option(category_name, "footer", footer)
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
self.__filter = FilterOption(_("Select using filter"), 0)
self.__filter.set_help(_("Select sources using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Source'))
self.__filter.set_filters(filter_list)
menu.add_option(category_name, "filter", self.__filter)
showperson = BooleanOption(_("Show persons"), True)
showperson.set_help(_("Whether to show events and persons mentioned in the note"))
menu.add_option(category_name, "showperson", showperson)
locale_opt = stdoptions.add_localization_option(menu, category_name)
stdoptions.add_date_format_option(menu, category_name, locale_opt)
示例13: add_menu_options
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_('book|Title'), _('Title of the Book') )
title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", title)
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book') )
subtitle.set_help(_("Subtitle string for the book."))
menu.add_option(category_name, "subtitle", subtitle)
dateinfo = time.localtime(time.time())
#rname = self.__db.get_researcher().get_name()
rname = "researcher name"
footer_string = _('Copyright %(year)d %(name)s') % {
'year' : dateinfo[0], 'name' : rname }
footer = StringOption(_('Footer'), footer_string )
footer.set_help(_("Footer string for the page."))
menu.add_option(category_name, "footer", footer)
# Reload filters to pick any new ones
CustomFilters = None
#p- from Filters import CustomFilters, GenericFilter
from gramps.gen.filters import CustomFilters, GenericFilter
# opt = FilterOption(_("Select using filter"), 0)
# opt.set_help(_("Select places using a filter"))
# filter_list = []
# filter_list.append(GenericFilter())
# filter_list.extend(CustomFilters.get_filters('Source'))
# opt.set_filters(filter_list)
# menu.add_option(category_name, "filter", opt)
#
# showpersons = BooleanOption(_("Show persons"), True)
# showpersons.set_help(_("Whether to show events and persons mentioned in the note"))
# menu.add_option(category_name, "showpersons", showpersons)
#
# incphotos = BooleanOption(_("Include Photos"), True)
# incphotos.set_help(_("Whether to show photos mentioned in the citation"))
# menu.add_option(category_name, "incphotos", incphotos)
category_name = _("Calc Options")
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Source'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
# opt = FilterOption(_("Select Person filter"), 0)
# opt.set_help(_("Select places using a person filter"))
# filter_list = []
# filter_list.append(GenericFilter())
# filter_list.extend(CustomFilters.get_filters('Person'))
# opt.set_filters(filter_list)
# menu.add_option(category_name, "filter", opt)
showallfamilies = BooleanOption(_("Show surnames of all famiies in clans"), True)
showallfamilies.set_help(_("Whether to show the names of all families as surname"))
menu.add_option(category_name, "showallfamilies", showallfamilies)
placeformat = EnumeratedListOption(_("Place Format"), "Default")
placeformat.set_items([
("default", _("Default")),
("first", _("First")),
("firstplace", _("Firstplace")),
("firstplace-country", _("Firstplace-Country")),
("country", _("Country")),
("long", _("Long"))])
placeformat.set_help(_("If Placename is given long or short"))
menu.add_option(category_name, "placeformat", placeformat)
示例14: add_menu_options
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
"""
common_name = _('Report Options')
repository_name = _('Repositories')
source_name = _('Sources')
# Reload filters to pick any new ones
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Selection with a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Repository'))
opt.set_filters(filter_list)
menu.add_option(repository_name, "filter", opt)
from functools import partial
addopt = partial(menu.add_option, common_name)
raddopt = partial(menu.add_option, repository_name)
saddopt = partial(menu.add_option, source_name)
incintern = BooleanOption(_("Include repository's urls"), False)
incintern.set_help(_('Whether to include urls on repository.'))
raddopt('incintern', incintern)
incaddres = BooleanOption(_("Include repository's address"), False)
incaddres.set_help(_('Whether to include addresses on repository.'))
raddopt('incaddres', incaddres)
incauthor = BooleanOption(_("Include source's author"), False)
incauthor.set_help(_('Whether to include author.'))
saddopt('incauthor', incauthor)
incabbrev = BooleanOption(_("Include source's abbreviation"), False)
incabbrev.set_help(_('Whether to include abbreviation.'))
saddopt('incabbrev', incabbrev)
incpublic = BooleanOption(_("Include source's publication information"), False)
incpublic.set_help(_('Whether to include publication information.'))
saddopt('incpublic', incpublic)
incdatamp = BooleanOption(_("Include source's data"), False)
incdatamp.set_help(_('Whether to include keys and values.'))
saddopt('incdatamp', incdatamp)
inclunote = BooleanOption(_('Include notes'), False)
inclunote.set_help(_('Whether to include notes on repositories and sources.'))
addopt('inclunote', inclunote)
inclmedia = BooleanOption(_('Include media'), False)
inclmedia.set_help(_('Whether to include media.'))
addopt('inclmedia', inclmedia)
inclcitat = BooleanOption(_('Include citations'), False)
inclcitat.set_help(_('Whether to include citations on sources.'))
saddopt('inclcitat', inclcitat)
incprivat = BooleanOption(_('Include private records'), False)
incprivat.set_help(_('Whether to include repositories and sources marked as private.'))
addopt('incprivat', incprivat)
incempty = BooleanOption(_('Display empty values'), False)
incempty.set_help(_('Whether to include key records with empty values.'))
addopt('incempty', incempty)
stdoptions.add_localization_option(menu, common_name)