Remove unneeded line continuations and tidy up

svn: r16472
This commit is contained in:
Gerald Britton 2011-01-25 18:47:12 +00:00
parent 891b3d66c1
commit adf976821f
13 changed files with 219 additions and 175 deletions

View File

@ -445,8 +445,9 @@ class BookList(object):
escape(option_name), escape(option_name),
len(options[option_name]) ) ) len(options[option_name]) ) )
for list_index in range(len(option_value)): for list_index in range(len(option_value)):
option_type = \ option_type = Utils.type_name(
Utils.type_name(option_value[list_index]) option_value[list_index]
)
value = escape(unicode(option_value[list_index])) value = escape(unicode(option_value[list_index]))
value = value.replace('"', '"') value = value.replace('"', '"')
f.write(' <listitem number="%d" type="%s" ' f.write(' <listitem number="%d" type="%s" '
@ -482,7 +483,7 @@ class BookList(object):
the_file = open(self.file) the_file = open(self.file)
p.parse(the_file) p.parse(the_file)
the_file.close() the_file.close()
except (IOError, OSError, ValueError, SAXParseException, KeyError, \ except (IOError, OSError, ValueError, SAXParseException, KeyError,
AttributeError): AttributeError):
pass pass

View File

@ -36,8 +36,8 @@ from gen.ggettext import gettext as _
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gui.utils import open_file_with_default_application from gui.utils import open_file_with_default_application
from gen.plug.docgen import BaseDoc, TextDoc,\ from gen.plug.docgen import (BaseDoc, TextDoc,
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER)
import Errors import Errors
import Utils import Utils
@ -247,8 +247,10 @@ class AsciiDoc(BaseDoc,TextDoc):
start_at = regular_indent + min(len(self.leader)+first_indent,0) start_at = regular_indent + min(len(self.leader)+first_indent,0)
this_text = reformat_para(self.text,regular_indent,right,fmt, this_text = reformat_para(self.text,regular_indent,right,fmt,
right_pad) right_pad)
this_text = ' '*(regular_indent+first_indent) + \ this_text = (' '*(regular_indent+first_indent) +
self.leader + this_text[start_at:] self.leader +
this_text[start_at:]
)
else: else:
this_text = self.text this_text = self.text
else: else:
@ -270,8 +272,7 @@ class AsciiDoc(BaseDoc,TextDoc):
this_text += '\n' + the_pad + '\n' this_text += '\n' + the_pad + '\n'
if self.in_cell: if self.in_cell:
self.cellpars[self.cellnum] = self.cellpars[self.cellnum] + \ self.cellpars[self.cellnum] += this_text
this_text
else: else:
self.f.write(this_text) self.f.write(this_text)
@ -310,8 +311,8 @@ class AsciiDoc(BaseDoc,TextDoc):
self.maxlines = 0 self.maxlines = 0
table_width = self.get_usable_width() * self.tbl_style.get_width() / 100.0 table_width = self.get_usable_width() * self.tbl_style.get_width() / 100.0
for cell in range(self.ncols): for cell in range(self.ncols):
self.cell_widths[cell] = int( table_width * \ self.cell_widths[cell] = int(table_width *
self.tbl_style.get_column_width(cell) / 100.0 ) self.tbl_style.get_column_width(cell) / 100.0)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# #
@ -326,8 +327,9 @@ class AsciiDoc(BaseDoc,TextDoc):
if self.cell_widths[cell]: if self.cell_widths[cell]:
blanks = ' '*self.cell_widths[cell] + '\n' blanks = ' '*self.cell_widths[cell] + '\n'
if self.cell_lines[cell] < self.maxlines: if self.cell_lines[cell] < self.maxlines:
self.cellpars[cell] = self.cellpars[cell] \ self.cellpars[cell] += blanks * (
+ blanks * (self.maxlines-self.cell_lines[cell]) self.maxlines - self.cell_lines[cell]
)
cell_text[cell] = self.cellpars[cell].split('\n') cell_text[cell] = self.cellpars[cell].split('\n')
for line in range(self.maxlines): for line in range(self.maxlines):
for cell in range(self.ncols): for cell in range(self.ncols):
@ -345,8 +347,9 @@ class AsciiDoc(BaseDoc,TextDoc):
self.cellnum = self.cellnum + span self.cellnum = self.cellnum + span
span -= 1 span -= 1
while span: while span:
self.cell_widths[self.cellnum] += \ self.cell_widths[self.cellnum] += (
self.cell_widths[self.cellnum-span] self.cell_widths[self.cellnum-span]
)
self.cell_widths[self.cellnum-span] = 0 self.cell_widths[self.cellnum-span] = 0
span -= 1 span -= 1
@ -366,7 +369,7 @@ class AsciiDoc(BaseDoc,TextDoc):
def add_media_object(self, name, align, w_cm, h_cm, alt=''): def add_media_object(self, name, align, w_cm, h_cm, alt=''):
this_text = '(photo)' this_text = '(photo)'
if self.in_cell: if self.in_cell:
self.cellpars[self.cellnum] = self.cellpars[self.cellnum] + this_text self.cellpars[self.cellnum] += this_text
else: else:
self.f.write(this_text) self.f.write(this_text)

View File

@ -368,10 +368,10 @@ class Calendar(Report):
'person' : short_name, 'person' : short_name,
'nyears' : nyears}) 'nyears' : nyears})
alive1 = probably_alive(person, self.database, \ alive1 = probably_alive(person, self.database,
prob_alive_date) prob_alive_date)
alive2 = probably_alive(spouse, self.database, \ alive2 = probably_alive(spouse, self.database,
prob_alive_date) prob_alive_date)
if ((self.alive and alive1 and alive2) or not self.alive): if ((self.alive and alive1 and alive2) or not self.alive):
self.add_day_item(text, month, day) self.add_day_item(text, month, day)

View File

@ -207,8 +207,9 @@ class GrampsXmlWriter(UpdateCallback):
note_len = self.db.get_number_of_notes() note_len = self.db.get_number_of_notes()
tag_len = self.db.get_number_of_tags() tag_len = self.db.get_number_of_tags()
total_steps = person_len + family_len + event_len + source_len \ total_steps = (person_len + family_len + event_len + source_len +
+ place_len + repo_len + obj_len + note_len + tag_len place_len + repo_len + obj_len + note_len + tag_len
)
self.set_total(total_steps) self.set_total(total_steps)
@ -359,9 +360,10 @@ class GrampsXmlWriter(UpdateCallback):
bm_obj_len = len(self.db.media_bookmarks.get()) bm_obj_len = len(self.db.media_bookmarks.get())
bm_note_len = len(self.db.note_bookmarks.get()) bm_note_len = len(self.db.note_bookmarks.get())
bm_len = bm_person_len + bm_family_len + bm_event_len \ bm_len = (bm_person_len + bm_family_len + bm_event_len +
+ bm_source_len + bm_place_len + bm_repo_len \ bm_source_len + bm_place_len + bm_repo_len +
+ bm_obj_len + bm_note_len bm_obj_len + bm_note_len
)
if bm_len > 0: if bm_len > 0:
self.g.write(" <bookmarks>\n") self.g.write(" <bookmarks>\n")
@ -732,13 +734,18 @@ class GrampsXmlWriter(UpdateCallback):
priv = conf_priv(source_ref) priv = conf_priv(source_ref)
if p == "" and n == [] and d.is_empty() and q == 2: if p == "" and n == [] and d.is_empty() and q == 2:
self.g.write('<sourceref hlink="%s"%s/>\n' % ("_"+source.get_handle(), priv)) self.g.write('<sourceref hlink="%s"%s/>\n'
% ("_"+source.get_handle(), priv)
)
else: else:
if q == 2: if q == 2:
self.g.write('<sourceref hlink="%s"%s>\n' % ("_"+source.get_handle(), priv)) self.g.write('<sourceref hlink="%s"%s>\n'
% ("_"+source.get_handle(), priv)
)
else: else:
self.g.write('<sourceref hlink="%s" conf="%d"%s>\n' % ( self.g.write('<sourceref hlink="%s" conf="%d"%s>\n'
"_"+source.get_handle(),q, priv)) % ("_"+source.get_handle(), q, priv)
)
self.write_line("spage",p,index+1) self.write_line("spage",p,index+1)
self.write_note_list(n,index+1) self.write_note_list(n,index+1)
self.write_date(d,index+1) self.write_date(d,index+1)
@ -775,7 +782,7 @@ class GrampsXmlWriter(UpdateCallback):
if not obj: if not obj:
return return
sp = " " * index sp = " " * index
change_text = ' change="%d"' % obj.get_change_time() change_text = ' change="%d"' % obj.get_change_time()
handle_text = ' handle="_%s"' % obj.get_handle() handle_text = ' handle="_%s"' % obj.get_handle()
obj_text = '%s<%s' % (sp, tagname) obj_text = '%s<%s' % (sp, tagname)
@ -1022,9 +1029,10 @@ class GrampsXmlWriter(UpdateCallback):
def write_attribute_list(self, list, indent=3): def write_attribute_list(self, list, indent=3):
sp = ' ' * indent sp = ' ' * indent
for attr in list: for attr in list:
self.g.write('%s<attribute%s type="%s" value="%s"' % \ self.g.write('%s<attribute%s type="%s" value="%s"' %
(sp,conf_priv(attr),escxml(attr.get_type().xml_str()), (sp,conf_priv(attr),escxml(attr.get_type().xml_str()),
self.fix(attr.get_value()))) self.fix(attr.get_value()))
)
slist = attr.get_source_references() slist = attr.get_source_references()
nlist = attr.get_note_list() nlist = attr.get_note_list()
if (len(nlist)+len(slist)) == 0: if (len(nlist)+len(slist)) == 0:
@ -1057,19 +1065,25 @@ class GrampsXmlWriter(UpdateCallback):
if corner2_x is None : corner2_x = 100 if corner2_x is None : corner2_x = 100
if corner2_y is None : corner2_y = 100 if corner2_y is None : corner2_y = 100
#don't output not set rectangle #don't output not set rectangle
if (corner1_x == corner1_y == corner2_x == corner2_y == 0) or \ if (corner1_x == corner1_y == corner2_x == corner2_y == 0 or
(corner1_x == corner1_y == 0 and corner2_x == corner2_y == 100 corner1_x == corner1_y == 0 and
): corner2_x == corner2_y == 100):
rect = None rect = None
if (len(proplist) + len(nreflist) + len(refslist)) == 0 \ if (len(proplist) + len(nreflist) + len(refslist) == 0 and
and rect is None: rect is None):
self.g.write("/>\n") self.g.write("/>\n")
else: else:
self.g.write(">\n") self.g.write(">\n")
if rect is not None : if rect is not None :
self.g.write(' %s<region corner1_x="%d" corner1_y="%d" ' self.g.write(' %s<region corner1_x="%d" corner1_y="%d" '
'corner2_x="%d" corner2_y="%d"/>\n' % 'corner2_x="%d" corner2_y="%d"/>\n' % (
(sp,corner1_x,corner1_y,corner2_x,corner2_y)) sp,
corner1_x,
corner1_y,
corner2_x,
corner2_y
)
)
self.write_attribute_list(proplist,indent+1) self.write_attribute_list(proplist,indent+1)
for ref in refslist: for ref in refslist:
self.dump_source_ref(ref, indent+1) self.dump_source_ref(ref, indent+1)
@ -1132,8 +1146,14 @@ class GrampsXmlWriter(UpdateCallback):
else: else:
desc_text = '' desc_text = ''
path_text = ' href="%s"' % self.fix(url.get_path()) path_text = ' href="%s"' % self.fix(url.get_path())
self.g.write('%s<url%s%s%s%s/>\n' % \ self.g.write('%s<url%s%s%s%s/>\n' % (
(sp, priv_text, path_text, type_text, desc_text)) sp,
priv_text,
path_text,
type_text,
desc_text
)
)
def write_place_obj(self, place, index=1): def write_place_obj(self, place, index=1):
self.write_primary_tag("placeobj", place, index) self.write_primary_tag("placeobj", place, index)
@ -1142,10 +1162,11 @@ class GrampsXmlWriter(UpdateCallback):
longitude = self.fix(place.get_longitude()) longitude = self.fix(place.get_longitude())
lat = self.fix(place.get_latitude()) lat = self.fix(place.get_latitude())
main_loc = place.get_main_location() main_loc = place.get_main_location()
llen = len(place.get_alternate_locations()) \ llen = (len(place.get_alternate_locations()) +
+ len(place.get_url_list()) + \ len(place.get_url_list()) +
len(place.get_media_list()) + \ len(place.get_media_list()) +
len(place.get_source_references()) len(place.get_source_references())
)
ml_empty = main_loc.is_empty() ml_empty = main_loc.is_empty()

View File

@ -39,7 +39,7 @@ class PersonAttributes(Gramplet):
""" """
Build the GUI interface. Build the GUI interface.
""" """
tip = _('Double-click on a row to view a quick report showing ' + \ tip = _('Double-click on a row to view a quick report showing '
'all people with the selected attribute.') 'all people with the selected attribute.')
self.gui.tooltip = tip self.gui.tooltip = tip
top = gtk.TreeView() top = gtk.TreeView()

View File

@ -38,7 +38,7 @@ class PersonGallery(Gramplet):
""" """
Build the GUI interface. Build the GUI interface.
""" """
tip = _('Double-click on a picture to view it in the default image ' + \ tip = _('Double-click on a picture to view it in the default image '
'viewer application.') 'viewer application.')
self.gui.tooltip = tip self.gui.tooltip = tip
self.image_list = [] self.image_list = []

View File

@ -56,9 +56,9 @@ from DateHandler import displayer as _dd
from gen.plug.report import Report from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils from gen.plug.report import utils as ReportUtils
from gui.plug.report import MenuReportOptions from gui.plug.report import MenuReportOptions
from gen.plug.menu import NumberOption, ColorOption, BooleanOption, \ from gen.plug.menu import (NumberOption, ColorOption, BooleanOption,
EnumeratedListOption, PersonListOption, \ EnumeratedListOption, PersonListOption,
SurnameColorOption SurnameColorOption)
from gen.utils import get_birth_or_fallback, get_death_or_fallback from gen.utils import get_birth_or_fallback, get_death_or_fallback
from gen.display.name import displayer as name_displayer from gen.display.name import displayer as name_displayer
@ -111,27 +111,27 @@ class FamilyLinesOptions(MenuReportOptions):
# -------------------------------- # --------------------------------
person_list = PersonListOption(_('People of interest')) person_list = PersonListOption(_('People of interest'))
person_list.set_help(_('People of interest are used as a starting ' \ person_list.set_help(_('People of interest are used as a starting '
'point when determining "family lines".')) 'point when determining "family lines".'))
menu.add_option(category, 'gidlist', person_list) menu.add_option(category, 'gidlist', person_list)
followpar = BooleanOption( followpar = BooleanOption(
_('Follow parents to determine family lines'), True) _('Follow parents to determine family lines'), True)
followpar.set_help(_('Parents and their ancestors will be ' \ followpar.set_help(_('Parents and their ancestors will be '
'considered when determining "family lines".')) 'considered when determining "family lines".'))
menu.add_option(category, 'followpar', followpar) menu.add_option(category, 'followpar', followpar)
followchild = BooleanOption(_('Follow children to determine ' \ followchild = BooleanOption(_('Follow children to determine '
'"family lines"'), True) '"family lines"'), True)
followchild.set_help(_('Children will be considered when ' \ followchild.set_help(_('Children will be considered when '
'determining "family lines".')) 'determining "family lines".'))
menu.add_option(category, 'followchild', followchild) menu.add_option(category, 'followchild', followchild)
remove_extra_people = BooleanOption( remove_extra_people = BooleanOption(
_('Try to remove extra people and families'), True) _('Try to remove extra people and families'), True)
remove_extra_people.set_help(_('People and families not directly ' \ remove_extra_people.set_help(_('People and families not directly '
'related to people of interest will ' \ 'related to people of interest will '
'be removed when determining ' \ 'be removed when determining '
'"family lines".')) '"family lines".'))
menu.add_option(category, 'removeextra', remove_extra_people) menu.add_option(category, 'removeextra', remove_extra_people)
@ -156,8 +156,8 @@ class FamilyLinesOptions(MenuReportOptions):
menu.add_option(category, 'colorfemales', color_females) menu.add_option(category, 'colorfemales', color_females)
color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown = ColorOption(_('Unknown'), '#e0e0e0')
color_unknown.set_help(_('The colour to use when the gender is ' \ color_unknown.set_help(
'unknown.')) _('The colour to use when the gender is unknown.'))
menu.add_option(category, 'colorunknown', color_unknown) menu.add_option(category, 'colorunknown', color_unknown)
color_family = ColorOption(_('Families'), '#ffffe0') color_family = ColorOption(_('Families'), '#ffffe0')
@ -225,7 +225,7 @@ class FamilyLinesOptions(MenuReportOptions):
menu.add_option(category, "useroundedcorners", use_roundedcorners) menu.add_option(category, "useroundedcorners", use_roundedcorners)
self.include_dates = BooleanOption(_('Include dates'), True) self.include_dates = BooleanOption(_('Include dates'), True)
self.include_dates.set_help(_('Whether to include dates for people ' \ self.include_dates.set_help(_('Whether to include dates for people '
'and families.')) 'and families.'))
menu.add_option(category, 'incdates', self.include_dates) menu.add_option(category, 'incdates', self.include_dates)
self.include_dates.connect('value-changed', self.include_dates_changed) self.include_dates.connect('value-changed', self.include_dates_changed)
@ -237,19 +237,19 @@ class FamilyLinesOptions(MenuReportOptions):
menu.add_option(category, "justyears", self.justyears) menu.add_option(category, "justyears", self.justyears)
include_places = BooleanOption(_('Include places'), True) include_places = BooleanOption(_('Include places'), True)
include_places.set_help(_('Whether to include placenames for people ' \ include_places.set_help(_('Whether to include placenames for people '
'and families.')) 'and families.'))
menu.add_option(category, 'incplaces', include_places) menu.add_option(category, 'incplaces', include_places)
include_num_children = BooleanOption( include_num_children = BooleanOption(
_('Include the number of children'), True) _('Include the number of children'), True)
include_num_children.set_help(_('Whether to include the number of ' \ include_num_children.set_help(_('Whether to include the number of '
'children for families with more ' \ 'children for families with more '
'than 1 child.')) 'than 1 child.'))
menu.add_option(category, 'incchildcnt', include_num_children) menu.add_option(category, 'incchildcnt', include_num_children)
include_private = BooleanOption(_('Include private records'), False) include_private = BooleanOption(_('Include private records'), False)
include_private.set_help(_('Whether to include names, dates, and ' \ include_private.set_help(_('Whether to include names, dates, and '
'families that are marked as private.')) 'families that are marked as private.'))
menu.add_option(category, 'incprivate', include_private) menu.add_option(category, 'incprivate', include_private)
@ -507,16 +507,15 @@ class FamilyLinesReport(Report):
family = self._db.get_family_from_handle(family_handle) family = self._db.get_family_from_handle(family_handle)
spouse_handle = ReportUtils.find_spouse(person, family) spouse_handle = ReportUtils.find_spouse(person, family)
if spouse_handle: if spouse_handle:
if spouse_handle in self._people or \ if (spouse_handle in self._people or
spouse_handle in ancestorsNotYetProcessed: spouse_handle in ancestorsNotYetProcessed):
self._families.add(family_handle) self._families.add(family_handle)
# if we have a limit on the number of people, and we've # if we have a limit on the number of people, and we've
# reached that limit, then don't attempt to find any # reached that limit, then don't attempt to find any
# more ancestors # more ancestors
if self._limitparents and \ if self._limitparents and (self._maxparents <
( self._maxparents < \ len(ancestorsNotYetProcessed) + len(self._people)):
( len(ancestorsNotYetProcessed) + len(self._people) ) ):
# get back to the top of the while loop so we can finish # get back to the top of the while loop so we can finish
# processing the people queued up in the "not yet # processing the people queued up in the "not yet
# processed" list # processed" list
@ -526,24 +525,20 @@ class FamilyLinesReport(Report):
for family_handle in person.get_parent_family_handle_list(): for family_handle in person.get_parent_family_handle_list():
family = self._db.get_family_from_handle(family_handle) family = self._db.get_family_from_handle(family_handle)
if (family.private and self._incprivate) or \ if not family.private or self._incprivate:
not family.private:
father = self._db.get_person_from_handle( father = self._db.get_person_from_handle(
family.get_father_handle()) family.get_father_handle())
mother = self._db.get_person_from_handle( mother = self._db.get_person_from_handle(
family.get_mother_handle()) family.get_mother_handle())
if father: if father:
if (father.private and self._incprivate) or \ if not father.private or self._incprivate:
not father.private:
ancestorsNotYetProcessed.add( ancestorsNotYetProcessed.add(
family.get_father_handle()) family.get_father_handle())
self._families.add(family_handle) self._families.add(family_handle)
if mother: if mother:
if (mother.private and self._incprivate) or \ if not mother.private or self._incprivate:
not mother.private:
ancestorsNotYetProcessed.add( ancestorsNotYetProcessed.add(
family.get_mother_handle()) family.get_mother_handle())
self._families.add(family_handle) self._families.add(family_handle)
def removeUninterestingParents(self): def removeUninterestingParents(self):
@ -597,16 +592,16 @@ class FamilyLinesReport(Report):
spouse = self._db.get_person_from_handle(handle) spouse = self._db.get_person_from_handle(handle)
spouse_handle = handle spouse_handle = handle
spouse_surname = spouse.get_primary_name().get_surname() spouse_surname = spouse.get_primary_name().get_surname()
spouse_surname = spouse_surname.encode('iso-8859-1', spouse_surname = spouse_surname.encode(
'xmlcharrefreplace') 'iso-8859-1', 'xmlcharrefreplace'
)
# see if the spouse has parents # see if the spouse has parents
if spouse_father_handle is None and \ if not spouse_father_handle and not spouse_mother_handle:
spouse_mother_handle is None:
for family_handle in \ for family_handle in \
spouse.get_parent_family_handle_list(): spouse.get_parent_family_handle_list():
family = self._db.get_family_from_handle( family = self._db.get_family_from_handle(
family_handle) family_handle)
handle = family.get_father_handle() handle = family.get_father_handle()
if handle in self._people: if handle in self._people:
spouse_father_handle = handle spouse_father_handle = handle
@ -794,8 +789,7 @@ class FamilyLinesReport(Report):
# output the birth or fallback event # output the birth or fallback event
birthStr = None birthStr = None
if bth_event and self._incdates: if bth_event and self._incdates:
if (bth_event.private and self._incprivate) or \ if not bth_event.private or self._incprivate:
not bth_event.private:
date = bth_event.get_date_object() date = bth_event.get_date_object()
if self._just_years and date.get_year_valid(): if self._just_years and date.get_year_valid():
birthStr = '%i' % date.get_year() birthStr = '%i' % date.get_year()
@ -805,8 +799,7 @@ class FamilyLinesReport(Report):
# get birth place (one of: city, state, or country) we can use # get birth place (one of: city, state, or country) we can use
birthplace = None birthplace = None
if bth_event and self._incplaces: if bth_event and self._incplaces:
if (bth_event.private and self._incprivate) or \ if not bth_event.private or self._incprivate:
not bth_event.private:
place = self._db.get_place_from_handle(bth_event.get_place_handle()) place = self._db.get_place_from_handle(bth_event.get_place_handle())
if place: if place:
location = place.get_main_location() location = place.get_main_location()
@ -820,8 +813,7 @@ class FamilyLinesReport(Report):
# see if we have a deceased date we can use # see if we have a deceased date we can use
deathStr = None deathStr = None
if dth_event and self._incdates: if dth_event and self._incdates:
if (dth_event.private and self._incprivate) or \ if not dth_event.private or self._incprivate:
not dth_event.private:
date = dth_event.get_date_object() date = dth_event.get_date_object()
if self._just_years and date.get_year_valid(): if self._just_years and date.get_year_valid():
deathStr = '%i' % date.get_year() deathStr = '%i' % date.get_year()
@ -831,8 +823,7 @@ class FamilyLinesReport(Report):
# get death place (one of: city, state, or country) we can use # get death place (one of: city, state, or country) we can use
deathplace = None deathplace = None
if dth_event and self._incplaces: if dth_event and self._incplaces:
if (dth_event.private and self._incprivate) or \ if not dth_event.private or self._incprivate:
not dth_event.private:
place = self._db.get_place_from_handle(dth_event.get_place_handle()) place = self._db.get_place_from_handle(dth_event.get_place_handle())
if place: if place:
location = place.get_main_location() location = place.get_main_location()

View File

@ -263,12 +263,12 @@ class HourGlassOptions(MenuReportOptions):
menu.add_option(category_name, "pid", pid) menu.add_option(category_name, "pid", pid)
max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15) max_gen = NumberOption(_('Max Descendant Generations'), 10, 1, 15)
max_gen.set_help(_("The number of generations of descendants to " \ max_gen.set_help(_("The number of generations of descendants to "
"include in the graph")) "include in the graph"))
menu.add_option(category_name, "maxdescend", max_gen) menu.add_option(category_name, "maxdescend", max_gen)
max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15) max_gen = NumberOption(_('Max Ancestor Generations'), 10, 1, 15)
max_gen.set_help(_("The number of generations of ancestors to " \ max_gen.set_help(_("The number of generations of ancestors to "
"include in the graph")) "include in the graph"))
menu.add_option(category_name, "maxascend", max_gen) menu.add_option(category_name, "maxascend", max_gen)

View File

@ -46,8 +46,8 @@ from gen.ggettext import sgettext as _
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gen.plug.menu import BooleanOption, EnumeratedListOption, FilterOption, \ from gen.plug.menu import (BooleanOption, EnumeratedListOption, FilterOption,
PersonOption, ColorOption PersonOption, ColorOption)
from gen.plug.report import Report from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils from gen.plug.report import utils as ReportUtils
from gui.plug.report import MenuReportOptions from gui.plug.report import MenuReportOptions
@ -164,8 +164,10 @@ class RelGraphReport(Report):
self.add_child_links_to_families() self.add_child_links_to_families()
def add_child_links_to_families(self): def add_child_links_to_families(self):
"returns string of GraphViz edges linking parents to families or \ """
children" returns string of GraphViz edges linking parents to families or
children
"""
# Hash people in a dictionary for faster inclusion checking # Hash people in a dictionary for faster inclusion checking
person_dict = dict([handle, 1] for handle in self.person_handles) person_dict = dict([handle, 1] for handle in self.person_handles)
@ -269,8 +271,8 @@ class RelGraphReport(Report):
for event_ref in fam.get_event_ref_list(): for event_ref in fam.get_event_ref_list():
event = self.database.get_event_from_handle(event_ref.ref) event = self.database.get_event_from_handle(event_ref.ref)
if event.type == gen.lib.EventType.MARRIAGE and \ if event.type == gen.lib.EventType.MARRIAGE and \
(event_ref.get_role() == gen.lib.EventRoleType.FAMILY or (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ): event_ref.get_role() == gen.lib.EventRoleType.PRIMARY):
label = self.get_event_string(event) label = self.get_event_string(event)
break break
if self.includeid: if self.includeid:
@ -548,8 +550,9 @@ class RelGraphOptions(MenuReportOptions):
menu.add_option(category_name, 'colorfemales', color_females) menu.add_option(category_name, 'colorfemales', color_females)
color_unknown = ColorOption(_('Unknown'), '#e0e0e0') color_unknown = ColorOption(_('Unknown'), '#e0e0e0')
color_unknown.set_help(_('The colour to use when the gender is ' \ color_unknown.set_help(
'unknown.')) _('The colour to use when the gender is unknown.')
)
menu.add_option(category_name, 'colorunknown', color_unknown) menu.add_option(category_name, 'colorunknown', color_unknown)
color_family = ColorOption(_('Families'), '#ffffe0') color_family = ColorOption(_('Families'), '#ffffe0')

View File

@ -872,8 +872,9 @@ class GedLine(object):
self.data = data[2] self.data = data[2]
if self.level == 0: if self.level == 0:
if self.token_text and self.token_text[0] == '@' \ if (self.token_text and self.token_text[0] == '@' and
and self.token_text[-1] == '@': self.token_text[-1] == '@'):
self.token = TOKEN_ID self.token = TOKEN_ID
self.token_text = self.token_text[1:-1] self.token_text = self.token_text[1:-1]
self.data = self.data.strip() self.data = self.data.strip()
@ -2630,8 +2631,8 @@ class GedcomParser(UpdateCallback):
self.__skip_subordinate_levels(1) self.__skip_subordinate_levels(1)
elif key in ("SOUR", "SOURCE"): elif key in ("SOUR", "SOURCE"):
self.__parse_source(line.token_text, 1) self.__parse_source(line.token_text, 1)
elif line.data.startswith("SOUR ") or \ elif (line.data.startswith("SOUR ") or
line.data.startswith("SOURCE "): line.data.startswith("SOURCE ")):
# A source formatted in a single line, for example: # A source formatted in a single line, for example:
# 0 @S62@ SOUR This is the title of the source # 0 @S62@ SOUR This is the title of the source
source = self.__find_or_create_source(self.sid_map[line.data]) source = self.__find_or_create_source(self.sid_map[line.data])
@ -3911,8 +3912,8 @@ class GedcomParser(UpdateCallback):
child = self.__find_or_create_person(self.pid_map[line.data]) child = self.__find_or_create_person(self.pid_map[line.data])
reflist = [ ref for ref in state.family.get_child_ref_list() \ reflist = [ref for ref in state.family.get_child_ref_list()
if ref.ref == child.handle ] if ref.ref == child.handle]
if reflist: # The child has been referenced already if reflist: # The child has been referenced already
ref = reflist[0] ref = reflist[0]
@ -4437,8 +4438,8 @@ class GedcomParser(UpdateCallback):
if not line.data: if not line.data:
# empty: discard, with warning and skip subs # empty: discard, with warning and skip subs
# Note: level+2 # Note: level+2
msg = _("Line %d: empty event note was ignored.")\ msg = _("Line %d: empty event note was ignored.") % (
% line.line line.line)
self.__warn(msg) self.__warn(msg)
self.__skip_subordinate_levels(state.level+2) self.__skip_subordinate_levels(state.level+2)
else: else:
@ -4620,8 +4621,8 @@ class GedcomParser(UpdateCallback):
state.person.set_main_parent_family_handle(None) state.person.set_main_parent_family_handle(None)
state.person.add_parent_family_handle(handle) state.person.add_parent_family_handle(handle)
reflist = [ ref for ref in family.get_child_ref_list() \ reflist = [ref for ref in family.get_child_ref_list()
if ref.ref == state.person.handle ] if ref.ref == state.person.handle]
if reflist: if reflist:
ref = reflist[0] ref = reflist[0]
ref.set_father_relation(sub_state.frel) ref.set_father_relation(sub_state.frel)
@ -4665,8 +4666,8 @@ class GedcomParser(UpdateCallback):
frel = mrel = gen.lib.ChildRefType.BIRTH frel = mrel = gen.lib.ChildRefType.BIRTH
family, new = self.dbase.find_family_from_handle(handle, self.trans) family, new = self.dbase.find_family_from_handle(handle, self.trans)
reflist = [ ref for ref in family.get_child_ref_list() \ reflist = [ref for ref in family.get_child_ref_list()
if ref.ref == state.person.handle ] if ref.ref == state.person.handle]
if reflist: if reflist:
ref = reflist[0] ref = reflist[0]
ref.set_father_relation(frel) ref.set_father_relation(frel)
@ -5338,8 +5339,8 @@ class GedcomParser(UpdateCallback):
self.__parse_level(sub_state, self.parse_addr_tbl, self.__ignore) self.__parse_level(sub_state, self.parse_addr_tbl, self.__ignore)
text = addr.get_street() text = addr.get_street()
if not addr.get_city() and not addr.get_state() and \ if not (addr.get_city() or addr.get_state() or
not addr.get_postal_code() and not addr.get_country(): addr.get_postal_code() or addr.get_country()):
match = ADDR_RE.match(text) match = ADDR_RE.match(text)
if match: if match:
@ -5585,8 +5586,12 @@ class GedcomParser(UpdateCallback):
if state.genby.upper() == "LEGACY": if state.genby.upper() == "LEGACY":
fname = os.path.basename(self.filename) fname = os.path.basename(self.filename)
WarningDialog(_("Import of GEDCOM file %s with DEST=%s, could cause errors in the resulting database!") % \ WarningDialog(
(fname, state.genby), _("Look for nameless events.")) _("Import of GEDCOM file %s with DEST=%s, "
"could cause errors in the resulting database!")
% (fname, state.genby),
_("Look for nameless events.")
)
def __header_plac(self, line, state): def __header_plac(self, line, state):
""" """

View File

@ -510,9 +510,13 @@ class GeoView(HtmlView):
Do we have a crosshair ? Do we have a crosshair ?
""" """
if self.javascript_ready: if self.javascript_ready:
_LOG.debug("crosshair : %d" % self._config.get("preferences.crosshair") ) _LOG.debug("crosshair : %d" %
self.renderer.execute_script("javascript:addcrosshair('%d','%s','geo-map')" self._config.get("preferences.crosshair")
% (self._config.get("preferences.crosshair"), self.crosspath) )
self.renderer.execute_script(
"javascript:addcrosshair('%d','%s','geo-map')" %
(self._config.get("preferences.crosshair"),
self.crosspath)
) )
self._size_request_for_map(self.box, None) self._size_request_for_map(self.box, None)
pass pass
@ -634,21 +638,25 @@ class GeoView(HtmlView):
self.clear.set_alignment(1.0, 0.5) self.clear.set_alignment(1.0, 0.5)
self.savezoom.set_alignment(1.0, 0.5) self.savezoom.set_alignment(1.0, 0.5)
cell = gtk.CellRendererText() cell = gtk.CellRendererText()
self.placebox = gtk.ComboBoxEntry(self.plist)# pylint: disable-msg=W0201 self.placebox = gtk.ComboBoxEntry(self.plist)# pylint: disable-msg=W0201
self.placebox.pack_start(cell) self.placebox.pack_start(cell)
self.placebox.add_attribute(self.placebox.get_cells()[0], 'text', 0) self.placebox.add_attribute(self.placebox.get_cells()[0], 'text', 0)
self.placebox.set_tooltip_text( self.placebox.set_tooltip_text(
_("Select the place for which you want to see the info bubble.")) _("Select the place for which you want to see the info bubble."))
completion = gtk.EntryCompletion() completion = gtk.EntryCompletion()
completion.set_model(self.plist) completion.set_model(self.plist)
completion.set_minimum_key_length(1) completion.set_minimum_key_length(1)
completion.set_text_column(0) completion.set_text_column(0)
completion.set_inline_completion(True) completion.set_inline_completion(True)
completion.set_match_func(self._match_string) completion.set_match_func(self._match_string)
self.placebox.child.connect('changed', self._entry_selected_place) self.placebox.child.connect('changed', self._entry_selected_place)
self.placebox.child.connect('key-press-event', self._entry_key_event) self.placebox.child.connect('key-press-event', self._entry_key_event)
self.clear.connect('clicked', self._erase_placebox_selection) self.clear.connect('clicked', self._erase_placebox_selection)
self.placebox.child.set_completion(completion) self.placebox.child.set_completion(completion)
box = gtk.HBox() box = gtk.HBox()
box.pack_start(self.clear, False, False, padding=2) box.pack_start(self.clear, False, False, padding=2)
box.pack_start(self.placebox, True, True, padding=2) box.pack_start(self.placebox, True, True, padding=2)
@ -658,12 +666,14 @@ class GeoView(HtmlView):
box.pack_start(self.savezoom, False, False, padding=2) box.pack_start(self.savezoom, False, False, padding=2)
box.pack_start(self.provider, False, False, padding=2) box.pack_start(self.provider, False, False, padding=2)
box.show_all() box.show_all()
self.heading = gtk.Label('') self.heading = gtk.Label('')
self.heading.set_single_line_mode(True) self.heading.set_single_line_mode(True)
font = pango.FontDescription("monospace") font = pango.FontDescription("monospace")
font.set_weight(pango.WEIGHT_HEAVY) font.set_weight(pango.WEIGHT_HEAVY)
font.set_style(pango.STYLE_NORMAL) font.set_style(pango.STYLE_NORMAL)
self.heading.modify_font(font) self.heading.modify_font(font)
self.box1.pack_start(box, True, True, padding=2) self.box1.pack_start(box, True, True, padding=2)
self.box1.pack_start(self.heading, True, True, padding=2) self.box1.pack_start(self.heading, True, True, padding=2)
self.box1.show_all() self.box1.show_all()
@ -759,10 +769,12 @@ class GeoView(HtmlView):
self.last_page = cpage self.last_page = cpage
ftype = {"places":'P', "event":'E', "family":'F', "person":'I'}.get( ftype = {"places":'P', "event":'E', "family":'F', "person":'I'}.get(
self.displaytype, 'X') self.displaytype, 'X')
url = os.path.join(GEOVIEW_SUBPATH, "GeoV-%c-%05d.html" % (ftype, url = os.path.join(GEOVIEW_SUBPATH,
cpage)) "GeoV-%c-%05d.html" % (ftype, cpage)
url = urlparse.urlunsplit( ('file', '', URL_SEP.join(url.split(os.sep)), )
'', '')) url = urlparse.urlunsplit(
('file', '', URL_SEP.join(url.split(os.sep)), '', '')
)
url += '?map=%s' % self.usedmap url += '?map=%s' % self.usedmap
url += '&zoom=%d' % int(self.realzoom) url += '&zoom=%d' % int(self.realzoom)
url += '&lat=%s' % str(self.reallatitude) url += '&lat=%s' % str(self.reallatitude)
@ -803,7 +815,7 @@ class GeoView(HtmlView):
""" """
place = combobox.get_text() place = combobox.get_text()
for entry in self.placebox.get_model(): for entry in self.placebox.get_model():
if ( entry[0] == place ): if entry[0] == place:
# Is this entry in the current page ? # Is this entry in the current page ?
if self.last_page == int(entry[2]): if self.last_page == int(entry[2]):
# Yes, we don't need to load another page. # Yes, we don't need to load another page.
@ -826,7 +838,9 @@ class GeoView(HtmlView):
url += '&zoom=%d' % int(self.realzoom) url += '&zoom=%d' % int(self.realzoom)
url += '&lat=%s' % str(self.reallatitude) url += '&lat=%s' % str(self.reallatitude)
url += '&lon=%s' % str(self.reallongitude) url += '&lon=%s' % str(self.reallongitude)
url += '&cross=%s' % int(self._config.get("preferences.crosshair")) url += '&cross=%s' % int(
self._config.get("preferences.crosshair")
)
self._openurl(url) self._openurl(url)
(current, maxp ) = self.pages[1].get_label().split('/', 1) (current, maxp ) = self.pages[1].get_label().split('/', 1)
self._create_pages_selection(entry[2], int(maxp)) self._create_pages_selection(entry[2], int(maxp))
@ -900,25 +914,29 @@ class GeoView(HtmlView):
# We need to get the HPaned size and the VPaned size. # We need to get the HPaned size and the VPaned size.
self.box1_size = self.box1.get_allocation() self.box1_size = self.box1.get_allocation()
self.header_size = self.box1_size.height self.header_size = self.box1_size.height
self.height = ( widget.parent.get_allocation().height - self.header_size - self.height = (widget.parent.get_allocation().height - self.header_size -
widget.parent.get_child2().get_allocation().height - 30 ) widget.parent.get_child2().get_allocation().height - 30)
self.width = ( widget.parent.parent.get_allocation().width - self.width = (widget.parent.parent.get_allocation().width -
widget.parent.parent.get_child2().get_allocation().width - 30 ) widget.parent.parent.get_child2().get_allocation().width - 30)
if not self.sidebar.is_visible(): if not self.sidebar.is_visible():
if self.side is not None: if self.side is not None:
self.width = widget.parent.parent.get_allocation().width - 24 self.width = widget.parent.parent.get_allocation().width - 24
else: else:
self.side = widget self.side = widget
self.width = widget.parent.parent.get_allocation().width - 300 self.width = widget.parent.parent.get_allocation().width - 300
_LOG.debug("No sidebar : map width=%d" % self.width ) _LOG.debug("No sidebar : map width=%d" % self.width)
else: else:
_LOG.debug("Sidebar : map width=%d" % self.width ) _LOG.debug("Sidebar : map width=%d" % self.width)
if not self.bottombar.is_visible(): if not self.bottombar.is_visible():
if self.bottom is not None: if self.bottom is not None:
self.height = ( widget.parent.get_allocation().height - self.header_size - 24 ) self.height = (widget.parent.get_allocation().height
- self.header_size - 24)
else: else:
self.bottom = widget self.bottom = widget
self.height = ( widget.parent.get_allocation().height - self.header_size - 400 ) self.height = (widget.parent.get_allocation().height
- self.header_size - 400)
_LOG.debug("No bottombar : map height=%d" % self.height ) _LOG.debug("No bottombar : map height=%d" % self.height )
else: else:
_LOG.debug("bottombar : map height=%d" % self.height ) _LOG.debug("bottombar : map height=%d" % self.height )
@ -930,13 +948,15 @@ class GeoView(HtmlView):
self.box1.set_allocation(self.box1_size) self.box1.set_allocation(self.box1_size)
if self.javascript_ready: if self.javascript_ready:
_LOG.debug("New size : width=%d and height=%d" % _LOG.debug("New size : width=%d and height=%d" %
(self.width, self.height)) (self.width, self.height)
self.renderer.execute_script("javascript:mapstraction.resizeTo" )
"('%dpx','%dpx');"
% (self.width, self.height) )
self.renderer.execute_script( self.renderer.execute_script(
"javascript:setcenterandzoom(mapstraction,uzoom," "javascript:mapstraction.resizeTo('%dpx','%dpx');" %
"ulat,ulon)") (self.width, self.height)
)
self.renderer.execute_script(
"javascript:setcenterandzoom(mapstraction,uzoom,ulat,ulon)"
)
self.frames.set_size_request(self.width+4, self.height+4) self.frames.set_size_request(self.width+4, self.height+4)
if not self.uistate.get_active('Person'): if not self.uistate.get_active('Person'):
return return
@ -1715,9 +1735,9 @@ class GeoView(HtmlView):
'preferences.timeperiod-after-range') 'preferences.timeperiod-after-range')
self.minyear -= ( self.minyear - adjust_before_min_year ) % 10 self.minyear -= ( self.minyear - adjust_before_min_year ) % 10
self.maxyear -= ( self.maxyear + adjust_after_max_year ) % 10 self.maxyear -= ( self.maxyear + adjust_after_max_year ) % 10
self.yearint = adjust_after_max_year + \ self.yearint = (adjust_after_max_year +
( self.maxyear - self.minyear ) / \ (self.maxyear - self.minyear) / (self.maxbut - 1)
( self.maxbut - 1 ) )
self.yearint -= self.yearint % 10 self.yearint -= self.yearint % 10
if self.yearint == 0: if self.yearint == 0:
self.yearint = 10 self.yearint = 10

View File

@ -419,8 +419,8 @@ class PersonBoxWidget(_PersonWidgetBase):
self.get_colormap().alloc_color("#b9cfe7")) self.get_colormap().alloc_color("#b9cfe7"))
self.border_gc.set_foreground( self.border_gc.set_foreground(
self.get_colormap().alloc_color("#000000")) self.get_colormap().alloc_color("#000000"))
elif self.alive and \ elif self.alive and (
self.person.get_gender() == gen.lib.Person.FEMALE: self.person.get_gender() == gen.lib.Person.FEMALE):
self.bg_gc.set_foreground( self.bg_gc.set_foreground(
self.get_colormap().alloc_color("#ffcdf1")) self.get_colormap().alloc_color("#ffcdf1"))
self.border_gc.set_foreground( self.border_gc.set_foreground(
@ -923,8 +923,8 @@ class PedigreeView(NavigationView):
self.dirty = False self.dirty = False
if self.tree_style == 1 and \ if self.tree_style == 1 and (
(self.force_size > 5 or self.force_size == 0): self.force_size > 5 or self.force_size == 0):
self.force_size = 5 self.force_size = 5
# A position definition is a tuple of nodes. # A position definition is a tuple of nodes.
@ -1070,8 +1070,8 @@ class PedigreeView(NavigationView):
last_pbw = pbw last_pbw = pbw
pbw = None pbw = None
if not lst[i] and \ if not lst[i] and (
((self.tree_style in [0, 2] and self.show_unknown_people and (self.tree_style in [0, 2] and self.show_unknown_people and
lst[((i+1)/2)-1]) or self.tree_style == 1): lst[((i+1)/2)-1]) or self.tree_style == 1):
# #
# No person -> show empty box # No person -> show empty box
@ -1099,8 +1099,8 @@ class PedigreeView(NavigationView):
# Person exists -> populate box # Person exists -> populate box
# #
image = False image = False
if self.show_images and height > 1 and \ if self.show_images and height > 1 and (
(i < ((2**size-1)/2) or self.tree_style == 2): i < ((2**size-1)/2) or self.tree_style == 2):
image = True image = True
if CAIRO_AVAILABLE: if CAIRO_AVAILABLE:
@ -1128,8 +1128,8 @@ class PedigreeView(NavigationView):
#################################################################### ####################################################################
# Connection lines # Connection lines
#################################################################### ####################################################################
if self.tree_style == 1 and \ if self.tree_style == 1 and (
positions[i][1] and len(positions[i][1]) == 2: positions[i][1] and len(positions[i][1]) == 2):
# separate boxes for father and mother # separate boxes for father and mother
x_pos = positions[i][1][0][0]+1 x_pos = positions[i][1][0][0]+1
y_pos = positions[i][1][0][1]+1 y_pos = positions[i][1][0][1]+1
@ -1212,9 +1212,9 @@ class PedigreeView(NavigationView):
#################################################################### ####################################################################
# Show marriage data # Show marriage data
#################################################################### ####################################################################
if self.show_marriage_data and \ if self.show_marriage_data and (
((self.tree_style == 1 and positions[i][2]) or self.tree_style == 1 and positions[i][2] or
(self.tree_style in [0, 2] and (level+1) < size)): (self.tree_style in [0, 2] and level+1 < size)):
if lst[i] and lst[i][2]: if lst[i] and lst[i][2]:
text = self.format_helper.format_relation(lst[i][2], 1, True) text = self.format_helper.format_relation(lst[i][2], 1, True)
else: else:
@ -1506,7 +1506,7 @@ class PedigreeView(NavigationView):
def cb_bg_motion_notify_event(self, widget, event): def cb_bg_motion_notify_event(self, widget, event):
"""Function for motion notify events for drag and scroll mode.""" """Function for motion notify events for drag and scroll mode."""
if self._in_move and (event.type == gtk.gdk.MOTION_NOTIFY or \ if self._in_move and (event.type == gtk.gdk.MOTION_NOTIFY or
event.type == gtk.gdk.BUTTON_RELEASE): event.type == gtk.gdk.BUTTON_RELEASE):
window = widget.get_parent() window = widget.get_parent()
hadjustment = window.get_hadjustment() hadjustment = window.get_hadjustment()
@ -1676,13 +1676,13 @@ class PedigreeView(NavigationView):
lst[index] = [person, val, family, alive, None] lst[index] = [person, val, family, alive, None]
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
if father_handle: if father_handle:
father = self.dbstate.\ father = self.dbstate.db.get_person_from_handle(
db.get_person_from_handle(father_handle) father_handle)
self.find_tree(father, (2*index)+1, depth+1, lst, frel) self.find_tree(father, (2*index)+1, depth+1, lst, frel)
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if mother_handle: if mother_handle:
mother = self.dbstate.\ mother = self.dbstate.db.get_person_from_handle(
db.get_person_from_handle(mother_handle) mother_handle)
self.find_tree(mother, (2*index)+2, depth+1, lst, mrel) self.find_tree(mother, (2*index)+2, depth+1, lst, mrel)
def add_nav_portion_to_menu(self, menu): def add_nav_portion_to_menu(self, menu):
@ -1862,8 +1862,8 @@ class PedigreeView(NavigationView):
sib_menu = item.get_submenu() sib_menu = item.get_submenu()
if find_children(self.dbstate.db, sib): if find_children(self.dbstate.db, sib):
label = gtk.Label('<b><i>%s</i></b>' % \ label = gtk.Label('<b><i>%s</i></b>'
escape(name_displayer.display(sib))) % escape(name_displayer.display(sib)))
else: else:
label = gtk.Label(escape(name_displayer.display(sib))) label = gtk.Label(escape(name_displayer.display(sib)))
@ -1901,8 +1901,8 @@ class PedigreeView(NavigationView):
child_menu = item.get_submenu() child_menu = item.get_submenu()
if find_children(self.dbstate.db, child): if find_children(self.dbstate.db, child):
label = gtk.Label('<b><i>%s</i></b>' % \ label = gtk.Label('<b><i>%s</i></b>'
escape(name_displayer.display(child))) % escape(name_displayer.display(child)))
else: else:
label = gtk.Label(escape(name_displayer.display(child))) label = gtk.Label(escape(name_displayer.display(child)))
@ -1941,8 +1941,8 @@ class PedigreeView(NavigationView):
par_menu = item.get_submenu() par_menu = item.get_submenu()
if find_parents(self.dbstate.db, par): if find_parents(self.dbstate.db, par):
label = gtk.Label('<b><i>%s</i></b>' % \ label = gtk.Label('<b><i>%s</i></b>'
escape(name_displayer.display(par))) % escape(name_displayer.display(par)))
else: else:
label = gtk.Label(escape(name_displayer.display(par))) label = gtk.Label(escape(name_displayer.display(par)))

View File

@ -859,7 +859,7 @@ class RelationshipView(NavigationView):
if count > 1 : if count > 1 :
childmsg = ngettext(" (%d sibling)", " (%d siblings)", count) % count childmsg = ngettext(" (%d sibling)", " (%d siblings)", count) % count
elif count == 1 : elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(\ gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender child_list[0]).gender
if gender == gen.lib.Person.MALE : if gender == gen.lib.Person.MALE :
childmsg = _(" (1 brother)") childmsg = _(" (1 brother)")
@ -915,7 +915,7 @@ class RelationshipView(NavigationView):
if count > 1 : if count > 1 :
childmsg = ngettext(" (%d sibling)"," (%d siblings)", count) % count childmsg = ngettext(" (%d sibling)"," (%d siblings)", count) % count
elif count == 1 : elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(\ gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender child_list[0]).gender
if gender == gen.lib.Person.MALE : if gender == gen.lib.Person.MALE :
childmsg = _(" (1 brother)") childmsg = _(" (1 brother)")
@ -1514,9 +1514,9 @@ class RelationshipView(NavigationView):
SelectPerson = SelectorFactory('Person') SelectPerson = SelectorFactory('Person')
family = self.dbstate.db.get_family_from_handle(handle) family = self.dbstate.db.get_family_from_handle(handle)
# it only makes sense to skip those who are already in the family # it only makes sense to skip those who are already in the family
skip_list = [family.get_father_handle(), \ skip_list = [family.get_father_handle(),
family.get_mother_handle()] + \ family.get_mother_handle()]
[x.ref for x in family.get_child_ref_list() ] skip_list.extend(x.ref for x in family.get_child_ref_list())
sel = SelectPerson(self.dbstate, self.uistate, [], sel = SelectPerson(self.dbstate, self.uistate, [],
_("Select Child"), skip=skip_list) _("Select Child"), skip=skip_list)
@ -1709,9 +1709,9 @@ def has_children(db,p):
return False return False
def button_activated(event, mouse_button): def button_activated(event, mouse_button):
if (event.type == gtk.gdk.BUTTON_PRESS and \ if (event.type == gtk.gdk.BUTTON_PRESS and
event.button == mouse_button) or \ event.button == mouse_button) or \
(event.type == gtk.gdk.KEY_PRESS and \ (event.type == gtk.gdk.KEY_PRESS and
event.keyval in (_RETURN, _KP_ENTER, _SPACE)): event.keyval in (_RETURN, _KP_ENTER, _SPACE)):
return True return True
else: else: