Add property keywords; removed unneeded files after merge fixes (#2059)
svn: r16059
This commit is contained in:
parent
5b449656ab
commit
e3fdeb363d
File diff suppressed because it is too large
Load Diff
@ -1,182 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-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
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
import ManagedWindow
|
||||
from glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % const.URL_MANUAL_PAGE
|
||||
WIKI_HELP_SEC = _('manual|Merge_Places')
|
||||
_GLADE_FILE = 'mergedata.glade'
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Merge Places
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MergePlaces(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Merges to places into a single place. Displays a dialog box that
|
||||
allows the places to be combined into one.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, new_handle, old_handle):
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
|
||||
self.db = dbstate.db
|
||||
self.new_handle = new_handle
|
||||
self.old_handle = old_handle
|
||||
self.p1 = self.db.get_place_from_handle(self.new_handle)
|
||||
self.p2 = self.db.get_place_from_handle(self.old_handle)
|
||||
|
||||
self.glade = Glade(_GLADE_FILE, toplevel='mergeplace')
|
||||
self.set_window(self.glade.toplevel,
|
||||
self.glade.get_object('place_title'),
|
||||
_("Merge Places"))
|
||||
|
||||
title1_text = self.glade.get_object("title1_text")
|
||||
title2_text = self.glade.get_object("title2_text")
|
||||
self.title3_entry = self.glade.get_object("title3_text")
|
||||
|
||||
title1_text.set_text(self.p1.get_title())
|
||||
title2_text.set_text(self.p2.get_title())
|
||||
self.title3_entry.set_text(self.p1.get_title())
|
||||
|
||||
self.glade.get_object('place_cancel').connect('clicked', self.close_window)
|
||||
self.glade.get_object('place_ok').connect('clicked', self.merge)
|
||||
self.glade.get_object('place_help').connect('clicked', self.help)
|
||||
|
||||
self.show()
|
||||
|
||||
def close_window(self, obj):
|
||||
self.close()
|
||||
|
||||
def build_menu_names(self, obj):
|
||||
return (_('Merge Places'),None)
|
||||
|
||||
def help(self, obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
GrampsDisplay.help(webpage = WIKI_HELP_PAGE, section = WIKI_HELP_SEC)
|
||||
|
||||
def merge(self, obj):
|
||||
"""
|
||||
Performs the merge of the places when the merge button is clicked.
|
||||
"""
|
||||
t2active = self.glade.get_object("place2").get_active()
|
||||
|
||||
if t2active:
|
||||
self.p1.set_title(self.p2.get_title())
|
||||
elif self.glade.get_object("place3").get_active():
|
||||
self.p1.set_title(unicode(self.title3_entry.get_text()))
|
||||
|
||||
# Set longitude
|
||||
if self.p1.get_longitude() == "" and self.p2.get_longitude() != "":
|
||||
self.p1.set_longitude(self.p2.get_longitude())
|
||||
|
||||
# Set latitude
|
||||
if self.p1.get_latitude() == "" and self.p2.get_latitude() != "":
|
||||
self.p1.set_latitude(self.p2.get_latitude())
|
||||
|
||||
# Add URLs from P2 to P1
|
||||
map(self.p1.add_url, self.p2.get_url_list())
|
||||
|
||||
# Copy photos from P2 to P1
|
||||
map(self.p1.add_media_reference, self.p2.get_media_list())
|
||||
|
||||
# Copy sources from P2 to P1
|
||||
map(self.p1.add_source_reference, self.p2.get_source_references())
|
||||
|
||||
# Add notes from P2 to P1
|
||||
self.p1.set_note_list(self.p1.get_note_list() +
|
||||
self.p2.get_note_list())
|
||||
|
||||
if t2active:
|
||||
lst = [self.p1.get_main_location()] + \
|
||||
self.p1.get_alternate_locations()
|
||||
self.p1.set_main_location(self.p2.get_main_location())
|
||||
for l in lst:
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
else:
|
||||
lst = [self.p2.get_main_location()] + \
|
||||
self.p2.get_alternate_locations()
|
||||
for l in lst:
|
||||
if not l.is_empty():
|
||||
self.p1.add_alternate_locations(l)
|
||||
|
||||
# remove old and commit new source
|
||||
trans = self.db.transaction_begin()
|
||||
|
||||
self.db.remove_place(self.old_handle,trans)
|
||||
self.db.commit_place(self.p1,trans)
|
||||
|
||||
# replace references in other objetcs
|
||||
# people
|
||||
for person in self.db.iter_people():
|
||||
if person.has_handle_reference('Place',self.old_handle):
|
||||
person.replace_handle_reference('Place',
|
||||
self.old_handle,self.new_handle)
|
||||
self.db.commit_person(person,trans)
|
||||
|
||||
# families
|
||||
for family in self.db.iter_families():
|
||||
if family.has_handle_reference('Place',self.old_handle):
|
||||
family.replace_handle_reference('Place',
|
||||
self.old_handle,self.new_handle)
|
||||
self.db.commit_family(family,trans)
|
||||
|
||||
# events
|
||||
for event in self.db.iter_events():
|
||||
if event.has_handle_reference('Place',self.old_handle):
|
||||
event.replace_handle_reference('Place',
|
||||
self.old_handle,self.new_handle)
|
||||
self.db.commit_event(event,trans)
|
||||
|
||||
self.db.transaction_commit(trans,_("Merge Places"))
|
||||
self.close()
|
@ -1,209 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.ggettext import sgettext as _
|
||||
import const
|
||||
import GrampsDisplay
|
||||
import ManagedWindow
|
||||
from glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
WIKI_HELP_PAGE = '%s_-_Entering_and_Editing_Data:_Detailed_-_part_3' % const.URL_MANUAL_PAGE
|
||||
WIKI_HELP_SEC = _('manual|Merge_Sources')
|
||||
_GLADE_FILE = 'mergedata.glade'
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Merge Sources
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MergeSources(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Merges to sources into a single source. Displays a dialog box that
|
||||
allows the sources to be combined into one.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, new_handle, old_handle):
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
|
||||
self.db = dbstate.db
|
||||
|
||||
self.new_handle = new_handle
|
||||
self.old_handle = old_handle
|
||||
self.s1 = self.db.get_source_from_handle(self.new_handle)
|
||||
self.s2 = self.db.get_source_from_handle(self.old_handle)
|
||||
|
||||
self.glade = Glade(_GLADE_FILE, toplevel='mergesource')
|
||||
|
||||
self.set_window(self.glade.toplevel,
|
||||
self.glade.get_object('source_title'),
|
||||
_("Merge Sources"))
|
||||
|
||||
self.title1 = self.glade.get_object("title1")
|
||||
self.title2 = self.glade.get_object("title2")
|
||||
self.title1.set_text(self.s1.get_title())
|
||||
self.title2.set_text(self.s2.get_title())
|
||||
|
||||
self.author1 = self.glade.get_object("author1")
|
||||
self.author2 = self.glade.get_object("author2")
|
||||
self.author1.set_text(self.s1.get_author())
|
||||
self.author2.set_text(self.s2.get_author())
|
||||
|
||||
self.abbrev1 = self.glade.get_object("abbrev1")
|
||||
self.abbrev2 = self.glade.get_object("abbrev2")
|
||||
self.abbrev1.set_text(self.s1.get_abbreviation())
|
||||
self.abbrev2.set_text(self.s2.get_abbreviation())
|
||||
|
||||
self.pub1 = self.glade.get_object("pub1")
|
||||
self.pub2 = self.glade.get_object("pub2")
|
||||
self.pub1.set_text(self.s1.get_publication_info())
|
||||
self.pub2.set_text(self.s2.get_publication_info())
|
||||
|
||||
self.gramps1 = self.glade.get_object("gramps1")
|
||||
self.gramps2 = self.glade.get_object("gramps2")
|
||||
self.gramps1.set_text(self.s1.get_gramps_id())
|
||||
self.gramps2.set_text(self.s2.get_gramps_id())
|
||||
|
||||
self.glade.get_object('source_ok').connect('clicked',self.merge)
|
||||
self.glade.get_object('source_cancel').connect('clicked',self.close_window)
|
||||
self.glade.get_object('source_help').connect('clicked',self.help)
|
||||
self.show()
|
||||
|
||||
def close_window(self, obj):
|
||||
self.close()
|
||||
|
||||
def help(self, obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
GrampsDisplay.help(webpage = WIKI_HELP_PAGE, section = WIKI_HELP_SEC)
|
||||
|
||||
def merge(self, obj):
|
||||
"""
|
||||
Performs the merge of the sources when the merge button is clicked.
|
||||
"""
|
||||
|
||||
use_title1 = self.glade.get_object("title_btn1").get_active()
|
||||
use_author1 = self.glade.get_object("author_btn1").get_active()
|
||||
use_abbrev1 = self.glade.get_object("abbrev_btn1").get_active()
|
||||
use_pub1 = self.glade.get_object("pub_btn1").get_active()
|
||||
use_gramps1 = self.glade.get_object("gramps_btn1").get_active()
|
||||
|
||||
if not use_title1:
|
||||
self.s1.set_title(self.s2.get_title())
|
||||
|
||||
if not use_author1:
|
||||
self.s1.set_author(self.s2.get_author())
|
||||
|
||||
if not use_abbrev1:
|
||||
self.s1.set_abbreviation(self.s2.get_abbreviation())
|
||||
|
||||
if not use_pub1:
|
||||
self.s1.set_publication_info(self.s2.get_publication_info())
|
||||
|
||||
if not use_gramps1:
|
||||
self.s1.set_gramps_id(self.s2.get_gramps_id())
|
||||
|
||||
# Copy photos from src2 to src1
|
||||
map(self.s1.add_media_reference, self.s2.get_media_list())
|
||||
|
||||
# Add notes from S2 to S1
|
||||
self.s1.set_note_list(self.s1.get_note_list() + self.s2.get_note_list())
|
||||
|
||||
src2_map = self.s2.get_data_map()
|
||||
src1_map = self.s1.get_data_map()
|
||||
for key in src2_map:
|
||||
if key not in src1_map:
|
||||
src1_map[key] = src2_map[key]
|
||||
|
||||
# replace references in other objetcs
|
||||
trans = self.db.transaction_begin()
|
||||
|
||||
self.db.remove_source(self.old_handle,trans)
|
||||
self.db.commit_source(self.s1,trans)
|
||||
|
||||
# replace handles
|
||||
|
||||
# people
|
||||
for person in self.db.iter_people():
|
||||
if person.has_source_reference(self.old_handle):
|
||||
person.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_person(person,trans)
|
||||
|
||||
# family
|
||||
for family in self.db.iter_families():
|
||||
if family.has_source_reference(self.old_handle):
|
||||
family.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_family(family,trans)
|
||||
|
||||
# events
|
||||
for event in self.db.iter_events():
|
||||
if event.has_source_reference(self.old_handle):
|
||||
event.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_event(event,trans)
|
||||
|
||||
# sources
|
||||
for source in self.db.iter_sources():
|
||||
if source.has_source_reference(self.old_handle):
|
||||
source.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_source(source,trans)
|
||||
|
||||
# places
|
||||
for place in self.db.iter_places():
|
||||
if place.has_source_reference(self.old_handle):
|
||||
place.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_place(place,trans)
|
||||
|
||||
# media
|
||||
for obj in self.db.iter_media_objects():
|
||||
if obj.has_source_reference(self.old_handle):
|
||||
obj.replace_source_references(self.old_handle,
|
||||
self.new_handle)
|
||||
self.db.commit_media_object(obj,trans)
|
||||
|
||||
self.db.transaction_commit(trans,_("Merge Sources"))
|
||||
self.close()
|
@ -18,7 +18,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
# $Id: __init__.py 15645 2010-07-22 02:16:32Z dsblank $
|
||||
|
||||
"""
|
||||
"""
|
||||
|
@ -19,7 +19,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id: _MergePlace.py 14135 2010-01-25 17:45:21Z gbritton $
|
||||
# $Id: $
|
||||
|
||||
"""
|
||||
Provide merge capabilities for places.
|
||||
|
@ -19,7 +19,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id: _MergeSource.py 14135 2010-01-25 17:45:21Z gbritton $
|
||||
# $Id: $
|
||||
|
||||
"""
|
||||
Provide merge capabilities for sources.
|
||||
|
Loading…
x
Reference in New Issue
Block a user