~ubuntu-branches/ubuntu/utopic/gramps/utopic

« back to all changes in this revision

Viewing changes to src/Merge/mergenote.py

  • Committer: Package Import Robot
  • Author(s): James A. Treacy
  • Date: 2012-05-22 17:18:36 UTC
  • mfrom: (39.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120522171836-35fi62lp4w7jnrd7
Tags: 3.4.0-1
* New upstream version
* Updated desktop file. Closes: #667472

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
#
20
20
 
21
 
# $Id$
 
21
# $Id: mergenote.py 19251 2012-04-06 17:15:34Z kulath $
22
22
 
23
23
"""
24
24
Provide merge capabilities for notes.
29
29
# Gramps modules
30
30
#
31
31
#-------------------------------------------------------------------------
32
 
from gen.lib import (Person, Family, Event, Place, Source, Repository,
 
32
from gen.lib import (Person, Family, Event, Place, Source, Citation, Repository,
33
33
                     MediaObject)
34
34
from gen.db import DbTxn
35
35
from gen.ggettext import sgettext as _
158
158
        if use_handle1:
159
159
            phoenix = self.no1
160
160
            titanic = self.no2
161
 
            unselect_path = (1,)
162
161
        else:
163
162
            phoenix = self.no2
164
163
            titanic = self.no1
165
 
            unselect_path = (0,)
 
164
            # Add second handle to history so that when merge is complete, 
 
165
            # phoenix is the selected row.
 
166
            self.uistate.viewmanager.active_page.get_history().push(
 
167
                    phoenix.get_handle())
166
168
 
167
169
        if self.get_widget("text_btn1").get_active() ^ use_handle1:
168
170
            phoenix.set_styledtext(titanic.get_styledtext())
175
177
 
176
178
        query = MergeNoteQuery(self.dbstate, phoenix, titanic)
177
179
        query.execute()
178
 
        if self.uistate.viewmanager.active_page.selection:
179
 
            self.uistate.viewmanager.active_page.selection.unselect_path(
180
 
                    unselect_path)
181
180
        self.close()
182
181
 
183
182
#-------------------------------------------------------------------------
225
224
                    assert(source.has_note_reference(old_handle))
226
225
                    source.replace_note_references(old_handle, new_handle)
227
226
                    self.database.commit_source(source, trans)
 
227
                elif class_name == Citation.__name__:
 
228
                    citation = self.database.get_citation_from_handle(handle)
 
229
                    assert(citation.has_note_reference(old_handle))
 
230
                    citation.replace_note_references(old_handle, new_handle)
 
231
                    self.database.commit_citation(citation, trans)
228
232
                elif class_name == Place.__name__:
229
233
                    place = self.database.get_place_from_handle(handle)
230
234
                    assert(place.has_note_reference(old_handle))