5467: Selected object after merger is not always merged object

svn: r18670
This commit is contained in:
Michiel Nauta 2011-12-31 18:47:51 +00:00
parent 2fefd97642
commit 111cfce6fd
8 changed files with 33 additions and 40 deletions

View File

@ -165,11 +165,13 @@ class MergeEvents(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.ev1
titanic = self.ev2
unselect_path = (1,)
else:
phoenix = self.ev2
titanic = self.ev1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("type_btn1").get_active() ^ use_handle1:
phoenix.set_type(titanic.get_type())
@ -185,9 +187,6 @@ class MergeEvents(ManagedWindow.ManagedWindow):
query = MergeEventQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()

View File

@ -197,11 +197,13 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.fy1
titanic = self.fy2
unselect_path = (1,)
else:
phoenix = self.fy2
titanic = self.fy1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
phoenix_fh = phoenix.get_father_handle()
phoenix_mh = phoenix.get_mother_handle()
@ -221,9 +223,6 @@ class MergeFamilies(ManagedWindow.ManagedWindow):
query.execute()
except MergeError, err:
ErrorDialog( _("Cannot merge people"), str(err))
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()

View File

@ -147,11 +147,13 @@ class MergeMediaObjects(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.mo1
titanic = self.mo2
unselect_path = (1,)
else:
phoenix = self.mo2
titanic = self.mo1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("path_btn1").get_active() ^ use_handle1:
phoenix.set_path(titanic.get_path())
@ -165,9 +167,6 @@ class MergeMediaObjects(ManagedWindow.ManagedWindow):
query = MergeMediaQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.close()
class MergeMediaQuery(object):

View File

@ -158,11 +158,13 @@ class MergeNotes(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.no1
titanic = self.no2
unselect_path = (1,)
else:
phoenix = self.no2
titanic = self.no1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("text_btn1").get_active() ^ use_handle1:
phoenix.set_styledtext(titanic.get_styledtext())
@ -175,9 +177,6 @@ class MergeNotes(ManagedWindow.ManagedWindow):
query = MergeNoteQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.close()
#-------------------------------------------------------------------------

View File

@ -308,11 +308,13 @@ class MergePeople(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.pr1
titanic = self.pr2
unselect_path = (1,)
else:
phoenix = self.pr2
titanic = self.pr1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("name_btn1").get_active() ^ use_handle1:
swapname = phoenix.get_primary_name()
@ -330,9 +332,6 @@ class MergePeople(ManagedWindow.ManagedWindow):
query.execute()
except MergeError, err:
ErrorDialog( _("Cannot merge people"), str(err))
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()
if self.update:

View File

@ -169,11 +169,14 @@ class MergePlaces(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.pl1
titanic = self.pl2
unselect_path = (1,)
else:
phoenix = self.pl2
titanic = self.pl1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("title_btn1").get_active() ^ use_handle1:
phoenix.set_title(titanic.get_title())
@ -190,9 +193,6 @@ class MergePlaces(ManagedWindow.ManagedWindow):
query = MergePlaceQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()

View File

@ -136,11 +136,13 @@ class MergeRepositories(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.rp1
titanic = self.rp2
unselect_path = (1,)
else:
phoenix = self.rp2
titanic = self.rp1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("name_btn1").get_active() ^ use_handle1:
phoenix.set_name(titanic.get_name())
@ -151,9 +153,6 @@ class MergeRepositories(ManagedWindow.ManagedWindow):
query = MergeRepoQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()

View File

@ -159,11 +159,13 @@ class MergeSources(ManagedWindow.ManagedWindow):
if use_handle1:
phoenix = self.src1
titanic = self.src2
unselect_path = (1,)
else:
phoenix = self.src2
titanic = self.src1
unselect_path = (0,)
# Add second handle to history so that when merge is complete,
# phoenix is the selected row.
self.uistate.viewmanager.active_page.get_history().push(
phoenix.get_handle())
if self.get_widget("title_btn1").get_active() ^ use_handle1:
phoenix.set_title(titanic.get_title())
@ -178,9 +180,6 @@ class MergeSources(ManagedWindow.ManagedWindow):
query = MergeSourceQuery(self.dbstate, phoenix, titanic)
query.execute()
if self.uistate.viewmanager.active_page.selection:
self.uistate.viewmanager.active_page.selection.unselect_path(
unselect_path)
self.uistate.set_busy_cursor(False)
self.close()