* src/Merge/_MergePlace.py: handle notes

* src/glade/mergedata.glade: handle notes


svn: r6779
This commit is contained in:
Don Allingham 2006-05-25 23:43:34 +00:00
parent 38556466b0
commit c2276f723d
3 changed files with 181 additions and 45 deletions

View File

@ -1,4 +1,6 @@
2006-05-25 Don Allingham <don@gramps-project.org>
* src/Merge/_MergePlace.py: handle notes
* src/glade/mergedata.glade: handle notes
* src/DataViews/_PersonView.py: Merge module support
* src/Merge/_MergeSource.py: broken out of MergeData.py
* src/Merge/__init__.py: support of module

View File

@ -66,12 +66,27 @@ class MergePlaces(ManagedWindow.ManagedWindow):
self.glade = gtk.glade.XML(const.merge_glade,"merge_places","gramps")
self.set_window(self.glade.get_widget("merge_places"),
self.glade.get_widget('title'),
_("Select title"))
_("Merge Places"))
self.glade.get_widget("title1_text").set_text(self.p1.get_title())
self.glade.get_widget("title2_text").set_text(self.p2.get_title())
self.t3 = self.glade.get_widget("title3_text")
self.t3.set_text(self.p1.get_title())
title1_text = self.glade.get_widget("title1_text")
title2_text = self.glade.get_widget("title2_text")
self.title3_entry = self.glade.get_widget("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.note_p1 = self.glade.get_widget('note_p1')
self.note_p2 = self.glade.get_widget('note_p2')
self.note_merge = self.glade.get_widget('note_merge')
self.note_title = self.glade.get_widget('note_title')
self.note_conflict = self.p1.get_note() and self.p2.get_note()
if self.note_conflict:
self.note_title.show()
self.note_p1.show()
self.note_p2.show()
self.note_merge.show()
self.glade.get_widget('cancel').connect('clicked', self.close_window)
self.glade.get_widget('ok').connect('clicked', self.merge)
@ -98,7 +113,7 @@ class MergePlaces(ManagedWindow.ManagedWindow):
if t2active:
self.p1.set_title(self.p2.get_title())
elif self.glade.get_widget("title3").get_active():
self.p1.set_title(unicode(self.t3.get_text()))
self.p1.set_title(unicode(self.title3_entry.get_text()))
# Set longitude
if self.p1.get_longitude() == "" and self.p2.get_longitude() != "":
@ -121,12 +136,17 @@ class MergePlaces(ManagedWindow.ManagedWindow):
self.p1.add_source(source)
# Add notes from P2 to P1
if self.note_conflict:
note1 = self.p1.get_note()
note2 = self.p2.get_note()
if self.note_p2.get_active():
self.p1.set_note(note2)
elif self.note_merge.get_active():
self.p1.set_note("%s\n\n%s" % (note1,note2))
else:
note = self.p2.get_note()
if note != "":
if self.p1.get_note() == "":
if note != "" and self.p1.get_note() == "":
self.p1.set_note(note)
elif self.p1.get_note() != note:
self.p1.set_note("%s\n\n%s" % (self.p1.get_note(),note))
if t2active:
lst = [self.p1.get_main_location()] + self.p1.get_alternate_locations()

View File

@ -4,11 +4,11 @@
<glade-interface>
<widget class="GtkDialog" id="merge_places">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
@ -116,10 +116,10 @@
<widget class="GtkTable" id="table5">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="n_rows">8</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
@ -135,10 +135,10 @@
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@ -162,10 +162,10 @@
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -189,11 +189,131 @@
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label86">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Title selection&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="note_title">
<property name="label" translatable="yes">&lt;b&gt;Note selection&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="note_p1">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Select note from Place 1</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="note_p2">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Select note from Place 2</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">note_p1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="note_merge">
<property name="can_focus">True</property>
<property name="label" translatable="yes">Merge notes</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">note_p1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -212,12 +332,10 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -237,12 +355,10 @@
<property name="group">title1</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -262,12 +378,10 @@
<property name="group">title1</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>