Allow the user to select the entries to be modified.
svn: r1452
This commit is contained in:
parent
43ebabd40c
commit
31c4ebcb7b
@ -1380,7 +1380,7 @@ class Gramps:
|
||||
def complete_rebuild(self):
|
||||
self.id2col = {}
|
||||
self.model_used = {}
|
||||
self.alpha_page = {}
|
||||
#self.alpha_page = {}
|
||||
self.tab_list = []
|
||||
self.apply_filter()
|
||||
self.goto_active_person()
|
||||
|
@ -25,7 +25,7 @@ import Utils
|
||||
from intl import gettext as _
|
||||
|
||||
import os
|
||||
|
||||
import cStringIO
|
||||
import gtk
|
||||
import gtk.glade
|
||||
from QuestionDialog import OkDialog
|
||||
@ -148,12 +148,12 @@ class CheckIntegrity:
|
||||
_('The database has passed internal checks'))
|
||||
return
|
||||
|
||||
text = ""
|
||||
text = cStringIO.StringIO;
|
||||
if blink > 0:
|
||||
if blink == 1:
|
||||
text = text + _("1 broken child/family link was fixed\n")
|
||||
text.write(_("1 broken child/family link was fixed\n"))
|
||||
else:
|
||||
text = text + _("%d broken child/family links were found\n") % blink
|
||||
text.write(_("%d broken child/family links were found\n") % blink)
|
||||
for c in self.broken_links:
|
||||
cn = c[0].getPrimaryName().getName()
|
||||
f = c[1].getFather()
|
||||
@ -165,14 +165,14 @@ class CheckIntegrity:
|
||||
pn = f.getPrimaryName().getName()
|
||||
else:
|
||||
pn = m.getPrimaryName().getName()
|
||||
text = text + '\t' + \
|
||||
_("%s was removed from the family of %s\n") % (cn,pn)
|
||||
text.write('\t')
|
||||
text.write('_("%s was removed from the family of %s\n") % (cn,pn)')
|
||||
|
||||
if plink > 0:
|
||||
if plink == 1:
|
||||
text = text + _("1 broken spouse/family link was fixed\n")
|
||||
text.write(_("1 broken spouse/family link was fixed\n"))
|
||||
else:
|
||||
text = text + _("%d broken spouse/family links were found\n") % plink
|
||||
text.write(_("%d broken spouse/family links were found\n") % plink)
|
||||
for c in self.broken_parent_links:
|
||||
cn = c[0].getPrimaryName().getName()
|
||||
f = c[1].getFather()
|
||||
@ -184,21 +184,21 @@ class CheckIntegrity:
|
||||
pn = f.getPrimaryName().getName()
|
||||
else:
|
||||
pn = m.getPrimaryName().getName()
|
||||
text = text + '\t' + \
|
||||
_("%s was restored to the family of %s\n") % (cn,pn)
|
||||
text.write('\t')
|
||||
text.write(_("%s was restored to the family of %s\n") % (cn,pn))
|
||||
|
||||
if efam == 1:
|
||||
text = text + _("1 empty family was found\n")
|
||||
text.write(_("1 empty family was found\n"))
|
||||
elif efam > 1:
|
||||
text = text + _("%d empty families were found\n") % efam
|
||||
text.write(_("%d empty families were found\n") % efam)
|
||||
if rel == 1:
|
||||
text = text + _("1 corrupted family relationship fixed\n")
|
||||
text.write(_("1 corrupted family relationship fixed\n"))
|
||||
elif rel > 1:
|
||||
text = text + _("%d corrupted family relationship fixed\n") % rel
|
||||
text.write(_("%d corrupted family relationship fixed\n") % rel)
|
||||
if photos == 1:
|
||||
text = text + _("1 media object was referenced, but not found\n")
|
||||
text.write(_("1 media object was referenced, but not found\n"))
|
||||
elif photos > 1:
|
||||
text = text + _("%d media objects were referenced, but not found\n") % photos
|
||||
text.write(_("%d media objects were referenced, but not found\n") % photos)
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "summary.glade"
|
||||
@ -211,7 +211,7 @@ class CheckIntegrity:
|
||||
textwindow = topDialog.get_widget("textwindow")
|
||||
|
||||
Utils.set_titles(top,topDialog.get_widget("title"),title)
|
||||
textwindow.get_buffer().set_text(text)
|
||||
textwindow.get_buffer().set_text(text.get_value())
|
||||
top.show()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
@ -33,6 +33,7 @@ import re
|
||||
# gnome/gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gobject
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
@ -95,52 +96,102 @@ class PatchNames:
|
||||
|
||||
msg = ""
|
||||
|
||||
|
||||
if len(self.nick_list) > 0 or len(self.title_list) > 0:
|
||||
for (id,name,nick) in self.nick_list:
|
||||
p = self.db.getPerson(id)
|
||||
msg = msg + _("%s will be extracted as a nickname from %s\n") % \
|
||||
(nick,p.getPrimaryName().getName())
|
||||
|
||||
for (id,title,nick) in self.title_list:
|
||||
p = self.db.getPerson(id)
|
||||
msg = msg + _("%s will be extracted as a title from %s\n") % \
|
||||
(title,p.getPrimaryName().getName())
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "patchnames.glade"
|
||||
|
||||
self.top = gtk.glade.XML(glade_file,"summary")
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.on_ok_clicked
|
||||
})
|
||||
|
||||
Utils.set_titles(self.top.get_widget('summary'),
|
||||
self.top.get_widget('title'),
|
||||
_('Name and title extraction tool'))
|
||||
|
||||
self.top.get_widget("textwindow").get_buffer().set_text(msg)
|
||||
self.display()
|
||||
else:
|
||||
OkDialog(_('No modifications made'),
|
||||
_("No titles or nicknames were found"))
|
||||
self.cb(0)
|
||||
|
||||
def toggled(self,cell,path_string):
|
||||
path = tuple([int (i) for i in path_string.split(':')])
|
||||
row = self.model[path]
|
||||
row[0] = not row[0]
|
||||
self.model.row_changed(path,row.iter)
|
||||
|
||||
def display(self):
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = base + os.sep + "patchnames.glade"
|
||||
|
||||
self.top = gtk.glade.XML(glade_file,"top")
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.on_ok_clicked
|
||||
})
|
||||
self.list = self.top.get_widget("list")
|
||||
Utils.set_titles(self.top.get_widget('top'),
|
||||
self.top.get_widget('title'),
|
||||
_('Name and title extraction tool'))
|
||||
|
||||
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING, gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING)
|
||||
|
||||
r = gtk.CellRendererToggle()
|
||||
r.connect('toggled',self.toggled)
|
||||
c = gtk.TreeViewColumn(_('Select'),r,active=0)
|
||||
self.list.append_column(c)
|
||||
|
||||
c = gtk.TreeViewColumn(_('ID'),gtk.CellRendererText(),text=1)
|
||||
self.list.append_column(c)
|
||||
|
||||
c = gtk.TreeViewColumn(_('Type'),gtk.CellRendererText(),text=2)
|
||||
self.list.append_column(c)
|
||||
|
||||
c = gtk.TreeViewColumn(_('Value'),gtk.CellRendererText(),text=3)
|
||||
self.list.append_column(c)
|
||||
|
||||
c = gtk.TreeViewColumn(_('Name'),gtk.CellRendererText(),text=4)
|
||||
self.list.append_column(c)
|
||||
|
||||
self.list.set_model(self.model)
|
||||
|
||||
self.nick_hash = {}
|
||||
self.title_hash = {}
|
||||
|
||||
for (id,name,nick) in self.nick_list:
|
||||
p = self.db.getPerson(id)
|
||||
iter = self.model.append()
|
||||
self.model.set_value(iter,0,1)
|
||||
self.model.set_value(iter,1,id)
|
||||
self.model.set_value(iter,2,_('Nickname'))
|
||||
self.model.set_value(iter,3,nick)
|
||||
self.model.set_value(iter,4,p.getPrimaryName().getName())
|
||||
self.nick_hash[id] = iter
|
||||
|
||||
for (id,title,nick) in self.title_list:
|
||||
p = self.db.getPerson(id)
|
||||
iter = self.model.append()
|
||||
self.model.set_value(iter,0,1)
|
||||
self.model.set_value(iter,1,id)
|
||||
self.model.set_value(iter,2,_('Title'))
|
||||
self.model.set_value(iter,3,nick)
|
||||
self.model.set_value(iter,4,p.getPrimaryName().getName())
|
||||
self.title_hash[id] = iter
|
||||
|
||||
def on_ok_clicked(self,obj):
|
||||
for grp in self.nick_list:
|
||||
p = self.db.getPerson(grp[0])
|
||||
name = p.getPrimaryName()
|
||||
name.setFirstName(grp[1])
|
||||
p.setNickName(grp[2])
|
||||
self.db.buildPersonDisplay(grp[0])
|
||||
Utils.modified()
|
||||
iter = self.nick_hash[grp[0]]
|
||||
val = self.model.get_value(iter,0)
|
||||
if val:
|
||||
p = self.db.getPerson(grp[0])
|
||||
name = p.getPrimaryName()
|
||||
name.setFirstName(grp[1])
|
||||
p.setNickName(grp[2])
|
||||
self.db.buildPersonDisplay(grp[0])
|
||||
Utils.modified()
|
||||
|
||||
for grp in self.title_list:
|
||||
p = self.db.getPerson(grp[0])
|
||||
name = p.getPrimaryName()
|
||||
name.setFirstName(grp[2])
|
||||
name.setTitle(grp[1])
|
||||
self.db.buildPersonDisplay(grp[0])
|
||||
Utils.modified()
|
||||
iter = self.title_hash[grp[0]]
|
||||
val = self.model.get_value(iter,0)
|
||||
if val:
|
||||
p = self.db.getPerson(grp[0])
|
||||
name = p.getPrimaryName()
|
||||
name.setFirstName(grp[2])
|
||||
name.setTitle(grp[1])
|
||||
self.db.buildPersonDisplay(grp[0])
|
||||
Utils.modified()
|
||||
|
||||
Utils.destroy_passed_object(obj)
|
||||
self.cb(1)
|
||||
|
@ -164,4 +164,133 @@ Should the following changes be made?</property>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="top">
|
||||
<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">False</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="default_height">450</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="title">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Below is a list of the nicknames and titles that GRAMPS can extract from the
|
||||
current database. If you accept the changes, GRAMPS will modify the entries
|
||||
that have been selected. </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">10</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="list">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Accept changes and close</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<signal name="clicked" handler="on_ok_clicked" object="top" last_modification_time="Wed, 16 Apr 2003 05:07:24 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<signal name="clicked" handler="destroy_passed_object" object="top" last_modification_time="Wed, 16 Apr 2003 05:06:50 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
|
Loading…
Reference in New Issue
Block a user