Remove unnecessary line continuations and tidy up a bit

svn: r16458
This commit is contained in:
Gerald Britton
2011-01-24 16:27:23 +00:00
parent c84e1286d8
commit fe5887626c
7 changed files with 163 additions and 100 deletions

View File

@@ -575,8 +575,7 @@ class CheckIntegrity(object):
if cl: if cl:
# Convert to file system encoding before prining # Convert to file system encoding before prining
fn = os.path.basename(photo_name).encode(sys.getfilesystemencoding()) fn = os.path.basename(photo_name).encode(sys.getfilesystemencoding())
print "Warning: media file %s was not found." \ print "Warning: media file %s was not found." % fn
% fn
self.bad_photo.append(ObjectId) self.bad_photo.append(ObjectId)
else: else:
if missmedia_action == 0: if missmedia_action == 0:
@@ -585,7 +584,7 @@ class CheckIntegrity(object):
"The file may have been deleted or moved to a different location. " "The file may have been deleted or moved to a different location. "
"You may choose to either remove the reference from the database, " "You may choose to either remove the reference from the database, "
"keep the reference to the missing file, or select a new file." "keep the reference to the missing file, or select a new file."
) % { 'file_name' : '<b>%s</b>' % photo_name }, ) % {'file_name' : '<b>%s</b>' % photo_name},
remove_clicked, leave_clicked, select_clicked) remove_clicked, leave_clicked, select_clicked)
missmedia_action = mmd.default_action missmedia_action = mmd.default_action
elif missmedia_action == 1: elif missmedia_action == 1:
@@ -840,7 +839,7 @@ class CheckIntegrity(object):
# The event referenced by the family # The event referenced by the family
# does not exist in the database # does not exist in the database
print family.gramps_id print family.gramps_id
nlist = [ x for x in family.get_event_ref_list() \ nlist = [x for x in family.get_event_ref_list()
if x.ref != event_handle] if x.ref != event_handle]
family.set_event_ref_list(nlist) family.set_event_ref_list(nlist)
self.db.commit_family(family, self.trans) self.db.commit_family(family, self.trans)
@@ -1330,8 +1329,11 @@ class CheckIntegrity(object):
self.text = cStringIO.StringIO() self.text = cStringIO.StringIO()
if blink > 0: if blink > 0:
self.text.write(ngettext("%(quantity)d broken child/family link was fixed\n", \ self.text.write(
"%(quantity)d broken child-family links were fixed\n", blink) % { 'quantity' : blink } ) ngettext("%(quantity)d broken child/family link was fixed\n",
"%(quantity)d broken child-family links were fixed\n",
blink) % {'quantity': blink}
)
for (person_handle, family_handle) in self.broken_links: for (person_handle, family_handle) in self.broken_links:
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
if person: if person:
@@ -1344,13 +1346,17 @@ class CheckIntegrity(object):
except: except:
pn = _("Unknown") pn = _("Unknown")
self.text.write('\t') self.text.write('\t')
self.text.write(_("%(person)s was removed from the family of %(family)s\n") % { self.text.write(
'person' : cn, 'family' : pn } ) _("%(person)s was removed from the family of %(family)s\n")
% {'person': cn, 'family': pn}
)
if plink > 0: if plink > 0:
self.text.write(ngettext("%(quantity)d broken spouse/family link was fixed\n", self.text.write(
"%(quantity)d broken spouse/family links were fixed\n", plink) % { ngettext("%(quantity)d broken spouse/family link was fixed\n",
'quantity' : plink }) "%(quantity)d broken spouse/family links were fixed\n",
plink) % {'quantity' : plink}
)
for (person_handle, family_handle) in self.broken_parent_links: for (person_handle, family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
if person: if person:
@@ -1363,12 +1369,17 @@ class CheckIntegrity(object):
else: else:
pn = family_handle pn = family_handle
self.text.write('\t') self.text.write('\t')
self.text.write(_("%(person)s was restored to the family of %(family)s\n") % { self.text.write(
'person' : cn, 'family' : pn } ) _("%(person)s was restored to the family of %(family)s\n")
% {'person': cn, 'family': pn}
)
if slink > 0: if slink > 0:
self.text.write(ngettext("%(quantity)d duplicate spouse/family link was found\n", \ self.text.write(
"%(quantity)d duplicate spouse/family links were found\n", slink) % { 'quantity' : slink }) ngettext("%(quantity)d duplicate spouse/family link was found\n",
"%(quantity)d duplicate spouse/family links were found\n",
slink) % {'quantity': slink}
)
for (person_handle, family_handle) in self.broken_parent_links: for (person_handle, family_handle) in self.broken_parent_links:
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
if person: if person:
@@ -1381,24 +1392,35 @@ class CheckIntegrity(object):
else: else:
pn = _("None") pn = _("None")
self.text.write('\t') self.text.write('\t')
self.text.write(_("%(person)s was restored to the family of %(family)s\n") % { self.text.write(
'person' : cn, 'family' : pn } ) _("%(person)s was restored to the family of %(family)s\n")
% {'person': cn, 'family': pn}
)
if efam == 1: if efam == 1:
self.text.write(_("%d family with no parents or children found, removed.\n")) self.text.write(
_("1 family with no parents or children found, removed.\n")
)
self.text.write("\t%s\n" % self.empty_family[0]) self.text.write("\t%s\n" % self.empty_family[0])
elif efam > 1: elif efam > 1:
self.text.write(_("%(quantity)d families with no parents or children, removed.\n") % { self.text.write(
'quantity' : efam }) _("%(quantity)d families with no parents or children, "
"removed.\n") % {'quantity': efam}
)
if rel: if rel:
self.text.write(ngettext("%d corrupted family relationship fixed\n", self.text.write(
"%d corrupted family relationship fixed\n", rel) % rel ) ngettext("%d corrupted family relationship fixed\n",
"%d corrupted family relationship fixed\n",
rel) % rel
)
if person_references: if person_references:
self.text.write(ngettext("%d person was referenced but not found\n", self.text.write(
ngettext("%d person was referenced but not found\n",
"%d persons were referenced, but not found\n", "%d persons were referenced, but not found\n",
person_references) % person_references) person_references) % person_references
)
if invalid_dates: if invalid_dates:
self.text.write(ngettext("%d date was corrected\n", self.text.write(ngettext("%d date was corrected\n",
@@ -1406,67 +1428,93 @@ class CheckIntegrity(object):
invalid_dates) % invalid_dates) invalid_dates) % invalid_dates)
if repo_references: if repo_references:
self.text.write(ngettext("%(quantity)d repository was referenced but not found\n", \ self.text.write(
"%(quantity)d repositories were referenced, but not found\n", repo_references) % { ngettext("%(quantity)d repository was referenced but not found\n",
'quantity' : repo_references }) "%(quantity)d repositories were referenced, but not found\n",
repo_references) % {'quantity': repo_references})
if photos: if photos:
self.text.write(ngettext("%(quantity)d media object was referenced, but not found\n", \ self.text.write(
"%(quantity)d media objects were referenced, but not found\n", photos) % { 'quantity' : photos }) ngettext("%(quantity)d media object was referenced, but not found\n",
"%(quantity)d media objects were referenced, but not found\n",
photos) % {'quantity' :photos}
)
if bad_photos: if bad_photos:
self.text.write(ngettext("Reference to %(quantity)d missing media object was kept\n", \ self.text.write(
"References to %(quantity)d media objects were kept\n", bad_photos) % { ngettext("Reference to %(quantity)d missing media object was kept\n",
'quantity' : bad_photos }) "References to %(quantity)d media objects were kept\n",
bad_photos) % {'quantity' :bad_photos}
)
if replaced_photos: if replaced_photos:
self.text.write(ngettext("%(quantity)d missing media object was replaced\n", \ self.text.write(
"%(quantity)d missing media objects were replaced\n", replaced_photos) % { ngettext("%(quantity)d missing media object was replaced\n",
'quantity' : replaced_photos }) "%(quantity)d missing media objects were replaced\n",
replaced_photos) % {'quantity': replaced_photos}
)
if removed_photos: if removed_photos:
self.text.write(ngettext("%(quantity)d missing media object was removed\n", \ self.text.write(
"%(quantity)d missing media objects were removed\n", removed_photos) % { ngettext("%(quantity)d missing media object was removed\n",
'quantity' : removed_photos }) "%(quantity)d missing media objects were removed\n",
removed_photos) % {'quantity' : removed_photos}
)
if event_invalid: if event_invalid:
self.text.write(ngettext("%(quantity)d invalid event reference was removed\n", \ self.text.write(
"%(quantity)d invalid event references were removed\n", event_invalid) % { ngettext("%(quantity)d invalid event reference was removed\n",
'quantity' : event_invalid }) "%(quantity)d invalid event references were removed\n",
event_invalid) % {'quantity': event_invalid}
)
if birth_invalid: if birth_invalid:
self.text.write(ngettext("%(quantity)d invalid birth event name was fixed\n", \ self.text.write(
"%(quantity)d invalid birth event names were fixed\n", birth_invalid) % { ngettext("%(quantity)d invalid birth event name was fixed\n",
'quantity' : birth_invalid }) "%(quantity)d invalid birth event names were fixed\n",
birth_invalid) % {'quantity' : birth_invalid}
)
if death_invalid: if death_invalid:
self.text.write(ngettext("%(quantity)d invalid death event name was fixed\n", \ self.text.write(
"%(quantity)d invalid death event names were fixed\n", death_invalid) % { ngettext("%(quantity)d invalid death event name was fixed\n",
'quantity' : death_invalid }) "%(quantity)d invalid death event names were fixed\n",
death_invalid) % {'quantity': death_invalid}
)
if place_references: if place_references:
self.text.write(ngettext("%(quantity)d place was referenced but not found\n", \ self.text.write(
"%(quantity)d places were referenced, but not found\n", place_references) % { ngettext("%(quantity)d place was referenced but not found\n",
'quantity' : place_references }) "%(quantity)d places were referenced, but not found\n",
place_references) % {'quantity': place_references}
)
if source_references: if source_references:
self.text.write(ngettext("%(quantity)d source was referenced but not found\n", \ self.text.write(
"%(quantity)d sources were referenced, but not found\n", source_references) % { ngettext("%(quantity)d source was referenced but not found\n",
'quantity' : source_references }) "%(quantity)d sources were referenced, but not found\n",
source_references) % {'quantity': source_references}
)
if media_references: if media_references:
self.text.write(ngettext("%d media object was referenced but not found\n", \ self.text.write(
"%d media objects were referenced but not found\n", media_references) % media_references) ngettext("%(quantity)media object was referenced but not found\n",
"%(quantity)media objects were referenced but not found\n",
media_references) % {'quantity': media_references}
)
if note_references: if note_references:
self.text.write(ngettext("%(quantity)d note object was referenced but not found\n", \ self.text.write(
"%(quantity)d note objects were referenced but not found\n", note_references) % { ngettext("%(quantity)d note object was referenced but not found\n",
'quantity' : note_references }) "%(quantity)d note objects were referenced but not found\n",
note_references) % {'quantity': note_references})
if name_format: if name_format:
self.text.write(ngettext("%(quantity)d invalid name format reference was removed\n", \ self.text.write(
"%(quantity)d invalid name format references were removed\n", name_format) % { ngettext("%(quantity)d invalid name format reference was removed\n",
'quantity' : name_format }) "%(quantity)d invalid name format references were removed\n",
name_format) % {'quantity' : name_format}
)
if empty_objs > 0 : if empty_objs > 0 :
self.text.write(_("%(empty_obj)d empty objects removed:\n" self.text.write(_("%(empty_obj)d empty objects removed:\n"
@@ -1477,7 +1525,7 @@ class CheckIntegrity(object):
" %(media)d media objects\n" " %(media)d media objects\n"
" %(place)d place objects\n" " %(place)d place objects\n"
" %(repo)d repository objects\n" " %(repo)d repository objects\n"
" %(note)d note objects\n" ) % { " %(note)d note objects\n") % {
'empty_obj' : empty_objs, 'empty_obj' : empty_objs,
'person' : len(self.empty_objects['persons']), 'person' : len(self.empty_objects['persons']),
'family' : len(self.empty_objects['families']), 'family' : len(self.empty_objects['families']),
@@ -1486,7 +1534,9 @@ class CheckIntegrity(object):
'media' : len(self.empty_objects['media']), 'media' : len(self.empty_objects['media']),
'place' : len(self.empty_objects['places']), 'place' : len(self.empty_objects['places']),
'repo' : len(self.empty_objects['repos']), 'repo' : len(self.empty_objects['repos']),
'note' : len(self.empty_objects['notes']) } ) 'note' : len(self.empty_objects['notes'])
}
)
return errors return errors

View File

@@ -66,8 +66,9 @@ class DesBrowse(tool.ActivePersonTool, ManagedWindow.ManagedWindow):
active_handle = uistate.get_active('Person') active_handle = uistate.get_active('Person')
self.active = dbstate.db.get_person_from_handle(active_handle) self.active = dbstate.db.get_person_from_handle(active_handle)
self.callback = callback self.callback = callback
self.active_name = _("Descendant Browser: %s") \ self.active_name = _("Descendant Browser: %s") % (
% name_displayer.display(self.active) name_displayer.display(self.active)
)
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)

View File

@@ -250,10 +250,12 @@ class DisplayChart(ManagedWindow.ManagedWindow):
self.table_titles = [_("Person"),_("ID")] self.table_titles = [_("Person"),_("ID")]
for event_name in self.event_titles: for event_name in self.event_titles:
self.table_titles.append(_("%(event_name)s Date") % self.table_titles.append(_("%(event_name)s Date") %
{'event_name' :event_name }) {'event_name' :event_name}
)
self.table_titles.append('sort') # This won't be shown in a tree self.table_titles.append('sort') # This won't be shown in a tree
self.table_titles.append(_("%(event_name)s Place") % self.table_titles.append(_("%(event_name)s Place") %
{'event_name' :event_name }) {'event_name' :event_name}
)
self.build_row_data() self.build_row_data()
self.draw_display() self.draw_display()

View File

@@ -300,9 +300,11 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
def findRelatedPeople(self) : def findRelatedPeople(self) :
#TRANS: No singular form is needed. #TRANS: No singular form is needed.
self.progress.set_pass(ngettext("Finding relationships between %d person", "Finding relationships between %d people",\ self.progress.set_pass(
self.numberOfPeopleInDatabase) \ ngettext("Finding relationships between %d person",
% self.numberOfPeopleInDatabase, \ "Finding relationships between %d people",
self.numberOfPeopleInDatabase) %
self.numberOfPeopleInDatabase,
self.numberOfPeopleInDatabase) self.numberOfPeopleInDatabase)
# as long as we have people we haven't processed yet, keep looping # as long as we have people we haven't processed yet, keep looping
@@ -368,9 +370,10 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
if self.numberOfUnrelatedPeople > 0: if self.numberOfUnrelatedPeople > 0:
# we have at least 1 "unrelated" person to find # we have at least 1 "unrelated" person to find
self.progress.set_pass( \ self.progress.set_pass(
ngettext("Looking for %d person", "Looking for %d people",\ ngettext("Looking for %d person", "Looking for %d people",
self.numberOfUnrelatedPeople) % self.numberOfUnrelatedPeople,\ self.numberOfUnrelatedPeople) %
self.numberOfUnrelatedPeople,
self.numberOfPeopleInDatabase) self.numberOfPeopleInDatabase)
# loop through everyone in the database # loop through everyone in the database
@@ -393,9 +396,11 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow.ManagedWindow) :
def populateModel(self) : def populateModel(self) :
self.progress.set_pass( \ self.progress.set_pass(
ngettext("Looking up the name of %d person", "Looking up the names of %d people", \ ngettext("Looking up the name of %d person",
self.numberOfUnrelatedPeople) % self.numberOfUnrelatedPeople,\ "Looking up the names of %d people",
self.numberOfUnrelatedPeople) %
self.numberOfUnrelatedPeople,
self.numberOfUnrelatedPeople) self.numberOfUnrelatedPeople)
# loop through the entire list of unrelated people # loop through the entire list of unrelated people

View File

@@ -316,7 +316,7 @@ class PatchNames(tool.BatchTool, ManagedWindow.ManagedWindow):
cont = False cont = False
# if previous is non-splitting connector, then add new val to # if previous is non-splitting connector, then add new val to
# current surname # current surname
if cont and (new_surname_list[-1].split()[-1].lower() \ if cont and (new_surname_list[-1].split()[-1].lower()
in self.connector_list_nonsplit): in self.connector_list_nonsplit):
new_surname_list[-1] += ' ' + val new_surname_list[-1] += ' ' + val
try: try:

View File

@@ -108,7 +108,7 @@ class RelCalc(tool.Tool, ManagedWindow.ManagedWindow):
self.titlelabel = self.glade.get_object('title') self.titlelabel = self.glade.get_object('title')
self.set_window(window, self.titlelabel, self.set_window(window, self.titlelabel,
_('Relationship to %(person_name)s' _('Relationship to %(person_name)s'
) % {'person_name' : name }, ) % {'person_name' : name},
self.title) self.title)
self.tree = self.glade.get_object("peopleList") self.tree = self.glade.get_object("peopleList")
@@ -187,17 +187,23 @@ class RelCalc(tool.Tool, ManagedWindow.ManagedWindow):
pass pass
elif self.person.handle == other_person.handle: elif self.person.handle == other_person.handle:
rstr = _("%(person)s and %(active_person)s are the same person.") % { rstr = _("%(person)s and %(active_person)s are the same person.") % {
'person' : p1, 'active_person' : p2 } 'person': p1,
'active_person': p2
}
text.append((rstr, "")) text.append((rstr, ""))
elif len(rel_strings) == 0: elif len(rel_strings) == 0:
rstr = _("%(person)s and %(active_person)s are not related.") % { rstr = _("%(person)s and %(active_person)s are not related.") % {
'person' : p2, 'active_person' : p1 } 'person': p2,
'active_person': p1
}
text.append((rstr, "")) text.append((rstr, ""))
for rel_string, common in zip(rel_strings, common_an): for rel_string, common in zip(rel_strings, common_an):
rstr = _("%(person)s is the %(relationship)s of %(active_person)s." rstr = _("%(person)s is the %(relationship)s of %(active_person)s."
) % {'person' : p2, 'relationship' : rel_string, ) % {'person': p2,
'active_person' : p1 } 'relationship': rel_string,
'active_person': p1
}
length = len(common) length = len(common)
if length == 1: if length == 1:
person = self.db.get_person_from_handle(common[0]) person = self.db.get_person_from_handle(common[0])
@@ -212,7 +218,9 @@ class RelCalc(tool.Tool, ManagedWindow.ManagedWindow):
p1str = name_displayer.display(p1c) p1str = name_displayer.display(p1c)
p2str = name_displayer.display(p2c) p2str = name_displayer.display(p2c)
commontext = " " + _("Their common ancestors are %(ancestor1)s and %(ancestor2)s.") % { commontext = " " + _("Their common ancestors are %(ancestor1)s and %(ancestor2)s.") % {
'ancestor1' : p1str, 'ancestor2' : p2str } 'ancestor1': p1str,
'ancestor2': p2str
}
elif length > 2: elif length > 2:
index = 0 index = 0
commontext = " " + _("Their common ancestors are: ") commontext = " " + _("Their common ancestors are: ")

View File

@@ -223,18 +223,14 @@ class RemoveUnused(tool.Tool, ManagedWindow.ManagedWindow, UpdateCallback):
return (self.title, None) return (self.title, None)
def find(self, obj): def find(self, obj):
self.options.handler.options_dict['events'] = \ self.options.handler.options_dict.update(
int(self.events_box.get_active()) events = self.events_box.get_active(),
self.options.handler.options_dict['sources'] = \ sources = self.sources_box.get_active(),
int(self.sources_box.get_active()) places = self.places_box.get_active(),
self.options.handler.options_dict['places'] = \ media = self.media_box.get_active(),
int(self.places_box.get_active()) repos = self.repos_box.get_active(),
self.options.handler.options_dict['media'] = \ notes = self.notes_box.get_active(),
int(self.media_box.get_active()) )
self.options.handler.options_dict['repos'] = \
int(self.repos_box.get_active())
self.options.handler.options_dict['notes'] = \
int(self.notes_box.get_active())
for item in self.sensitive_list: for item in self.sensitive_list:
item.set_sensitive(True) item.set_sensitive(True)
@@ -349,8 +345,9 @@ class RemoveUnused(tool.Tool, ManagedWindow.ManagedWindow, UpdateCallback):
def call_editor(self, the_type, handle): def call_editor(self, the_type, handle):
try: try:
obj = self.tables[the_type]['get_func'](handle) obj = self.tables[the_type]['get_func'](handle)
editor_str = 'from gui.editors import %s as editor' \ editor_str = 'from gui.editors import %s as editor' % (
% self.tables[the_type]['editor'] self.tables[the_type]['editor']
)
exec(editor_str) exec(editor_str)
editor(self.dbstate, self.uistate, [], obj) editor(self.dbstate, self.uistate, [], obj)
except Errors.WindowActiveError: except Errors.WindowActiveError: