privacy information

svn: r4978
This commit is contained in:
Don Allingham 2005-07-29 20:32:46 +00:00
parent c56f94a52f
commit f031f80287
5 changed files with 116 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2005-07-29 Don Allingham <don@gramps-project.org>
* src/MergePeople.py: Fix wording of the message.
* src/Report.py: Don't force expansion of widgets
* src/ReportUtils.py: allow restriction of information
* src/plugins/NavWebPage.py: enable living restriction
2005-07-29 Alex Roitman <shura@gramps-project.org>
* src/GenericFilter.py (GrampsFilterComboBox.get_value): Do not
convert key to unicode.

View File

@ -86,14 +86,13 @@ class Compare:
QuestionDialog.ErrorDialog(
_("Cannot merge people"),
_("Spouses cannot be merged. To merge these people, "
"you must first break the relationship between the "
"two people."))
"you must first break the relationship between them."))
elif check_for_child(self.p1,self.p2):
QuestionDialog.ErrorDialog(
_("Cannot merge people"),
_("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between "
"the two people."))
"them."))
else:
if self.glade.get_widget('select1').get_active():
merge = MergePeople(self.db,self.p1,self.p2)

View File

@ -698,8 +698,9 @@ class BareReportDialog:
self.extra_menu.set_sensitive(len(extra_map) > 1)
self.add_tooltip(self.extra_menu,em_tip)
table.attach(self.extra_menu_label, 1, 2, row, row+1,
gtk.SHRINK|gtk.FILL)
table.attach(self.extra_menu,2,3,row,row+1)
gtk.SHRINK|gtk.FILL, gtk.SHRINK)
table.attach(self.extra_menu, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
row += 1
# Now the "extra" text box
@ -716,8 +717,9 @@ class BareReportDialog:
self.extra_textbox.set_editable(1)
self.add_tooltip(self.extra_textbox,et_tip)
table.attach(self.extra_textbox_label, 1, 2, row, row+1,
gtk.SHRINK|gtk.FILL)
table.attach(swin,2,3,row,row+1)
gtk.SHRINK|gtk.FILL,gtk.SHRINK)
table.attach(swin, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
row += 1
# Setup requested widgets
@ -725,10 +727,13 @@ class BareReportDialog:
if text:
text_widget = gtk.Label("%s:" % text)
text_widget.set_alignment(0.0,0.0)
table.attach(text_widget,1,2,row,row+1,gtk.SHRINK|gtk.FILL)
table.attach(widget,2,3,row,row+1)
table.attach(text_widget, 1, 2, row, row+1,
gtk.SHRINK|gtk.FILL, gtk.SHRINK)
table.attach(widget, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
else:
table.attach(widget,2,3,row,row+1)
table.attach(widget, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
row += 1
def setup_other_frames(self):
@ -747,10 +752,13 @@ class BareReportDialog:
if text:
text_widget = gtk.Label('%s:' % text)
text_widget.set_alignment(0.0,0.5)
table.attach(text_widget,1,2,row,row+1,gtk.SHRINK|gtk.FILL)
table.attach(widget,2,3,row,row+1)
table.attach(text_widget, 1, 2, row, row+1,
gtk.SHRINK|gtk.FILL, gtk.SHRINK)
table.attach(widget, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
else:
table.attach(widget,2,3,row,row+1)
table.attach(widget, 2, 3, row, row+1,
yoptions=gtk.SHRINK)
row = row + 1
#------------------------------------------------------------------------

View File

@ -376,6 +376,53 @@ def sanitize_person(db,person):
return new_person
def restrict_with_names(db,person):
return restrict_person(db,person,False)
def restrict_no_names(db,person):
return restrict_person(db,person,True)
def restrict_person(db,person,no_names=False):
"""
Creates a new Person instance based off the passed Person
instance. The returned instance has all private records
removed from it.
@param db: GRAMPS database to which the Person object belongs
@type db: GrampsDbBase
@param person: source Person object that will be copied with
privacy records removed
@type person: Person
@returns: 'cleansed' Person object
@rtype: Person
"""
new_person = RelLib.Person()
# copy gender
new_person.set_gender(person.get_gender())
new_person.set_gramps_id(person.get_gramps_id())
new_person.set_handle(person.get_handle())
# copy names if not private
if no_names:
name = RelLib.Name()
name.set_surname(_('Private'))
else:
name = person.get_primary_name()
name.set_source_reference_list([])
new_person.set_primary_name(name)
# copy Family reference list
for handle in person.get_family_handle_list():
new_person.add_family_handle(handle)
# copy Family reference list
for item in person.get_parent_family_handle_list():
new_person.add_parent_family_handle(item[0],item[1],item[2])
return new_person
#-------------------------------------------------------------------------
#
# Roman numbers

View File

@ -1613,7 +1613,9 @@ class WebReport(Report.Report):
filter
od
NWEBrestrictinfo
NWEBrestrictyears
NWEBincpriv
NWEBnonames
NWEBidxcol
NWEBincid
NWEBext
@ -1637,6 +1639,7 @@ class WebReport(Report.Report):
self.encoding = options.handler.options_dict['NWEBencoding']
self.css = options.handler.options_dict['NWEBcss']
self.restrict = options.handler.options_dict['NWEBrestrictinfo']
self.restrict_years = options.handler.options_dict['NWEBrestrictyears']
self.exclude_private = options.handler.options_dict['NWEBincpriv']
self.noid = options.handler.options_dict['NWEBnoid']
self.title = options.handler.options_dict['NWEBtitle']
@ -1699,10 +1702,18 @@ class WebReport(Report.Report):
if not self.exclude_private:
new_list = []
for key in ind_list:
if not self.database.get_person_from_handle(key).private:
if not self.database.get_person_from_handle(key).private :
new_list.append(key)
ind_list = new_list
if self.restrict:
new_list = []
for key in ind_list:
if not Utils.probably_alive(self.database.get_person_from_handle(key),
self.database):
new_list.append(key)
ind_list = new_list
progress_steps = len(ind_list)
if len(ind_list) > 1:
progress_steps = progress_steps+1
@ -1746,13 +1757,22 @@ class WebReport(Report.Report):
for person_handle in ind_list:
person = self.database.get_person_from_handle(person_handle)
if not self.exclude_private:
person = ReportUtils.sanitize_person(self.database,person)
if self.restrict:
years = time.localtime(time.time())[0] - self.restrict_years
else:
years = None
if self.restrict and Utils.probably_alive(person,self.database,years):
person = ReportUtils.restrict_no_names(self.database,person)
idoc = IndividualPage(self.database, person, self.title,
ind_list, place_list, source_list,
self.options, archive,
photo_list, levels)
self.options, archive, photo_list, levels)
self.progress_bar_step()
while gtk.events_pending():
gtk.main_iteration()
@ -1855,7 +1875,9 @@ class WebReportOptions(ReportOptions.ReportOptions):
'NWEBod' : './',
'NWEBcopyright' : 0,
'NWEBrestrictinfo' : 0,
'NWEBrestrictyears' : 30,
'NWEBincpriv' : 0,
'NWEBnonames' : 0,
'NWEBnoid' : 0,
'NWEBcontact' : '',
'NWEBheader' : '',
@ -1913,6 +1935,7 @@ class WebReportOptions(ReportOptions.ReportOptions):
def add_user_options(self,dialog):
priv_msg = _("Do not include records marked private")
restrict_msg = _("Restrict information on living people")
restrict_years = _("Years to restrict from person's death")
imgdir_msg = _("Image subdirectory")
title_msg = _("Web site title")
ext_msg = _("File extension")
@ -1928,7 +1951,18 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.noid.set_active(self.options_dict['NWEBnoid'])
self.restrict_living = gtk.CheckButton(restrict_msg)
self.restrict_living.connect('toggled',self.restrict_toggled)
self.restrict_years = gtk.Entry()
self.restrict_years.set_text(str(self.options_dict['NWEBrestrictyears']))
self.restrict_years.set_sensitive(False)
self.restrict_living.set_active(self.options_dict['NWEBrestrictinfo'])
self.hbox = gtk.HBox()
self.hbox.set_spacing(12)
self.hbox.pack_start(gtk.Label(" "),False,False)
self.hbox.pack_start(gtk.Label("%s:" % restrict_years),False,False)
self.hbox.add(self.restrict_years)
self.inc_download = gtk.CheckButton(download_msg)
self.inc_download.set_active(self.options_dict['NWEBdownload'])
@ -2032,6 +2066,10 @@ class WebReportOptions(ReportOptions.ReportOptions):
title = _("Privacy")
dialog.add_frame_option(title,None,self.no_private)
dialog.add_frame_option(title,None,self.restrict_living)
dialog.add_frame_option(title,None,self.hbox)
def restrict_toggled(self,obj):
self.restrict_years.set_sensitive(obj.get_active())
def parse_user_options(self,dialog):
"""Parse the privacy options frame of the dialog. Save the