27aa4ec6a2
* src/BasicUtils/_UpdateCallback.py: add support for text in progressbar * src/ExportAssistant.py: add support for text in progressbar * src/ExportOptions.py: add support for text in progressbar * src/GrampsDbUtils/_WriteGedcom.py: add support for text in progressbar 2007-08-30 Don Allingham <don@gramps-project.org> * src/GrampsDb/_GrampsDBDir.py: use types.InstanceType * src/RelLib/_SourceBase.py: use types.InstanceType * src/RelLib/_Source.py: use types.InstanceType * src/RelLib/_MediaObject.py: use types.InstanceType * src/RelLib/_Person.py: use types.InstanceType * src/RelLib/_DateBase.py: use types.InstanceType * src/RelLib/_ChildRef.py: use types.InstanceType * src/RelLib/_Family.py: use types.InstanceType * src/RelLib/_Place.py: use types.InstanceType * src/RelLib/_RepoRef.py: use types.InstanceType * src/RelLib/_Note.py: use types.InstanceType * src/RelLib/_EventRef.py: use types.InstanceType * src/RelLib/_Repository.py: use types.InstanceType * src/RelLib/_Event.py: use types.InstanceType svn: r8900
117 lines
3.9 KiB
Python
117 lines
3.9 KiB
Python
#
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
#
|
|
# Copyright (C) 2007 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
|
|
#
|
|
import gtk
|
|
from gettext import gettext as _
|
|
|
|
import RelLib
|
|
import Config
|
|
|
|
from BasicUtils import name_displayer
|
|
from Filters import GenericFilter, Rules
|
|
|
|
#-------------------------------------------------------------------------
|
|
#
|
|
#
|
|
#
|
|
#-------------------------------------------------------------------------
|
|
class WriterOptionBox:
|
|
"""
|
|
Create a VBox with the option widgets and define methods to retrieve
|
|
the options.
|
|
"""
|
|
def __init__(self, person):
|
|
self.person = person
|
|
|
|
def get_option_box(self):
|
|
table = gtk.Table(3, 2)
|
|
label = gtk.Label('Filter')
|
|
self.filter_obj = gtk.ComboBox()
|
|
self.private_check = gtk.CheckButton(_('Do not include records marked private'))
|
|
self.restrict_check = gtk.CheckButton(_('Restrict data on living people'))
|
|
|
|
self.private_check.set_active(Config.get(Config.EXPORT_NO_PRIVATE))
|
|
self.restrict_check.set_active(Config.get(Config.EXPORT_RESTRICT))
|
|
|
|
table.set_border_width(12)
|
|
table.set_row_spacings(6)
|
|
table.set_col_spacings(6)
|
|
table.attach(label, 0, 1, 0, 1, xoptions=0, yoptions=0)
|
|
table.attach(self.filter_obj, 1, 2, 0, 1, yoptions=0)
|
|
table.attach(self.private_check, 1, 2, 1, 2, yoptions=0)
|
|
table.attach(self.restrict_check, 1, 2, 2, 3, yoptions=0)
|
|
|
|
#filter_obj = self.topDialog.get_widget("filter")
|
|
|
|
all = GenericFilter()
|
|
all.set_name(_("Entire Database"))
|
|
|
|
the_filters = [all]
|
|
|
|
if self.person:
|
|
des = GenericFilter()
|
|
des.set_name(_("Descendants of %s") %
|
|
name_displayer.display(self.person))
|
|
des.add_rule(Rules.Person.IsDescendantOf(
|
|
[self.person.get_gramps_id(), 1]))
|
|
|
|
ans = GenericFilter()
|
|
ans.set_name(_("Ancestors of %s")
|
|
% name_displayer.display(self.person))
|
|
ans.add_rule(Rules.Person.IsAncestorOf(
|
|
[self.person.get_gramps_id(), 1]))
|
|
|
|
com = GenericFilter()
|
|
com.set_name(_("People with common ancestor with %s") %
|
|
name_displayer.display(self.person))
|
|
com.add_rule(Rules.Person.HasCommonAncestorWith(
|
|
[self.person.get_gramps_id()]))
|
|
|
|
the_filters += [des, ans, com]
|
|
|
|
from Filters import CustomFilters
|
|
the_filters.extend(CustomFilters.get_filters('Person'))
|
|
|
|
model = gtk.ListStore(str, object)
|
|
for f in the_filters:
|
|
model.append(row=[f.get_name(), f])
|
|
|
|
cell = gtk.CellRendererText()
|
|
self.filter_obj.pack_start(cell, True)
|
|
self.filter_obj.add_attribute(cell, 'text', 0)
|
|
self.filter_obj.set_model(model)
|
|
self.filter_obj.set_active(0)
|
|
|
|
table.show()
|
|
return table
|
|
|
|
def parse_options(self):
|
|
|
|
self.restrict = self.restrict_check.get_active()
|
|
self.private = self.private_check.get_active()
|
|
|
|
Config.set(Config.EXPORT_NO_PRIVATE, self.private)
|
|
Config.set(Config.EXPORT_RESTRICT, self.restrict)
|
|
Config.sync()
|
|
|
|
model = self.filter_obj.get_model()
|
|
node = self.filter_obj.get_active_iter()
|
|
self.cfilter = model[node][1]
|
|
|