diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 96fb45968..72a53bef9 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -445,8 +445,9 @@ class BookList(object): escape(option_name), len(options[option_name]) ) ) for list_index in range(len(option_value)): - option_type = \ - Utils.type_name(option_value[list_index]) + option_type = Utils.type_name( + option_value[list_index] + ) value = escape(unicode(option_value[list_index])) value = value.replace('"', '"') f.write(' 0: self.g.write(" \n") @@ -732,13 +734,18 @@ class GrampsXmlWriter(UpdateCallback): priv = conf_priv(source_ref) if p == "" and n == [] and d.is_empty() and q == 2: - self.g.write('\n' % ("_"+source.get_handle(), priv)) + self.g.write('\n' + % ("_"+source.get_handle(), priv) + ) else: if q == 2: - self.g.write('\n' % ("_"+source.get_handle(), priv)) + self.g.write('\n' + % ("_"+source.get_handle(), priv) + ) else: - self.g.write('\n' % ( - "_"+source.get_handle(),q, priv)) + self.g.write('\n' + % ("_"+source.get_handle(), q, priv) + ) self.write_line("spage",p,index+1) self.write_note_list(n,index+1) self.write_date(d,index+1) @@ -775,7 +782,7 @@ class GrampsXmlWriter(UpdateCallback): if not obj: return 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() obj_text = '%s<%s' % (sp, tagname) @@ -1022,9 +1029,10 @@ class GrampsXmlWriter(UpdateCallback): def write_attribute_list(self, list, indent=3): sp = ' ' * indent for attr in list: - self.g.write('%s\n") else: self.g.write(">\n") if rect is not None : self.g.write(' %s\n' % - (sp,corner1_x,corner1_y,corner2_x,corner2_y)) + 'corner2_x="%d" corner2_y="%d"/>\n' % ( + sp, + corner1_x, + corner1_y, + corner2_x, + corner2_y + ) + ) self.write_attribute_list(proplist,indent+1) for ref in refslist: self.dump_source_ref(ref, indent+1) @@ -1132,8 +1146,14 @@ class GrampsXmlWriter(UpdateCallback): else: desc_text = '' path_text = ' href="%s"' % self.fix(url.get_path()) - self.g.write('%s\n' % \ - (sp, priv_text, path_text, type_text, desc_text)) + self.g.write('%s\n' % ( + sp, + priv_text, + path_text, + type_text, + desc_text + ) + ) def write_place_obj(self, place, index=1): self.write_primary_tag("placeobj", place, index) @@ -1142,10 +1162,11 @@ class GrampsXmlWriter(UpdateCallback): longitude = self.fix(place.get_longitude()) lat = self.fix(place.get_latitude()) main_loc = place.get_main_location() - llen = len(place.get_alternate_locations()) \ - + len(place.get_url_list()) + \ - len(place.get_media_list()) + \ - len(place.get_source_references()) + llen = (len(place.get_alternate_locations()) + + len(place.get_url_list()) + + len(place.get_media_list()) + + len(place.get_source_references()) + ) ml_empty = main_loc.is_empty() diff --git a/src/plugins/gramplet/PersonAttributes.py b/src/plugins/gramplet/PersonAttributes.py index 1c8691c04..1a8ee5b39 100644 --- a/src/plugins/gramplet/PersonAttributes.py +++ b/src/plugins/gramplet/PersonAttributes.py @@ -39,7 +39,7 @@ class PersonAttributes(Gramplet): """ 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.') self.gui.tooltip = tip top = gtk.TreeView() diff --git a/src/plugins/gramplet/PersonGallery.py b/src/plugins/gramplet/PersonGallery.py index 7366e8762..84676b42a 100644 --- a/src/plugins/gramplet/PersonGallery.py +++ b/src/plugins/gramplet/PersonGallery.py @@ -38,7 +38,7 @@ class PersonGallery(Gramplet): """ 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.') self.gui.tooltip = tip self.image_list = [] diff --git a/src/plugins/graph/GVFamilyLines.py b/src/plugins/graph/GVFamilyLines.py index ac9929e1d..9df83ef84 100644 --- a/src/plugins/graph/GVFamilyLines.py +++ b/src/plugins/graph/GVFamilyLines.py @@ -56,9 +56,9 @@ from DateHandler import displayer as _dd from gen.plug.report import Report from gen.plug.report import utils as ReportUtils from gui.plug.report import MenuReportOptions -from gen.plug.menu import NumberOption, ColorOption, BooleanOption, \ - EnumeratedListOption, PersonListOption, \ - SurnameColorOption +from gen.plug.menu import (NumberOption, ColorOption, BooleanOption, + EnumeratedListOption, PersonListOption, + SurnameColorOption) from gen.utils import get_birth_or_fallback, get_death_or_fallback from gen.display.name import displayer as name_displayer @@ -111,27 +111,27 @@ class FamilyLinesOptions(MenuReportOptions): # -------------------------------- 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".')) menu.add_option(category, 'gidlist', person_list) followpar = BooleanOption( _('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".')) menu.add_option(category, 'followpar', followpar) - followchild = BooleanOption(_('Follow children to determine ' \ + followchild = BooleanOption(_('Follow children to determine ' '"family lines"'), True) - followchild.set_help(_('Children will be considered when ' \ + followchild.set_help(_('Children will be considered when ' 'determining "family lines".')) menu.add_option(category, 'followchild', followchild) remove_extra_people = BooleanOption( _('Try to remove extra people and families'), True) - remove_extra_people.set_help(_('People and families not directly ' \ - 'related to people of interest will ' \ - 'be removed when determining ' \ + remove_extra_people.set_help(_('People and families not directly ' + 'related to people of interest will ' + 'be removed when determining ' '"family lines".')) menu.add_option(category, 'removeextra', remove_extra_people) @@ -156,8 +156,8 @@ class FamilyLinesOptions(MenuReportOptions): menu.add_option(category, 'colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') - color_unknown.set_help(_('The colour to use when the gender is ' \ - 'unknown.')) + color_unknown.set_help( + _('The colour to use when the gender is unknown.')) menu.add_option(category, 'colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') @@ -225,7 +225,7 @@ class FamilyLinesOptions(MenuReportOptions): menu.add_option(category, "useroundedcorners", use_roundedcorners) 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.')) menu.add_option(category, 'incdates', self.include_dates) self.include_dates.connect('value-changed', self.include_dates_changed) @@ -237,19 +237,19 @@ class FamilyLinesOptions(MenuReportOptions): menu.add_option(category, "justyears", self.justyears) 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.')) menu.add_option(category, 'incplaces', include_places) include_num_children = BooleanOption( _('Include the number of children'), True) - include_num_children.set_help(_('Whether to include the number of ' \ - 'children for families with more ' \ + include_num_children.set_help(_('Whether to include the number of ' + 'children for families with more ' 'than 1 child.')) menu.add_option(category, 'incchildcnt', include_num_children) 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.')) menu.add_option(category, 'incprivate', include_private) @@ -507,16 +507,15 @@ class FamilyLinesReport(Report): family = self._db.get_family_from_handle(family_handle) spouse_handle = ReportUtils.find_spouse(person, family) if spouse_handle: - if spouse_handle in self._people or \ - spouse_handle in ancestorsNotYetProcessed: + if (spouse_handle in self._people or + spouse_handle in ancestorsNotYetProcessed): self._families.add(family_handle) # if we have a limit on the number of people, and we've # reached that limit, then don't attempt to find any # more ancestors - if self._limitparents and \ - ( self._maxparents < \ - ( len(ancestorsNotYetProcessed) + len(self._people) ) ): + if self._limitparents and (self._maxparents < + len(ancestorsNotYetProcessed) + len(self._people)): # get back to the top of the while loop so we can finish # processing the people queued up in the "not yet # processed" list @@ -526,24 +525,20 @@ class FamilyLinesReport(Report): for family_handle in person.get_parent_family_handle_list(): family = self._db.get_family_from_handle(family_handle) - if (family.private and self._incprivate) or \ - not family.private: - + if not family.private or self._incprivate: father = self._db.get_person_from_handle( - family.get_father_handle()) + family.get_father_handle()) mother = self._db.get_person_from_handle( - family.get_mother_handle()) + family.get_mother_handle()) if father: - if (father.private and self._incprivate) or \ - not father.private: + if not father.private or self._incprivate: ancestorsNotYetProcessed.add( - family.get_father_handle()) + family.get_father_handle()) self._families.add(family_handle) if mother: - if (mother.private and self._incprivate) or \ - not mother.private: + if not mother.private or self._incprivate: ancestorsNotYetProcessed.add( - family.get_mother_handle()) + family.get_mother_handle()) self._families.add(family_handle) def removeUninterestingParents(self): @@ -597,16 +592,16 @@ class FamilyLinesReport(Report): spouse = self._db.get_person_from_handle(handle) spouse_handle = handle spouse_surname = spouse.get_primary_name().get_surname() - spouse_surname = spouse_surname.encode('iso-8859-1', - 'xmlcharrefreplace') + spouse_surname = spouse_surname.encode( + 'iso-8859-1', 'xmlcharrefreplace' + ) # see if the spouse has parents - if spouse_father_handle is None and \ - spouse_mother_handle is None: + if not spouse_father_handle and not spouse_mother_handle: for family_handle in \ spouse.get_parent_family_handle_list(): family = self._db.get_family_from_handle( - family_handle) + family_handle) handle = family.get_father_handle() if handle in self._people: spouse_father_handle = handle @@ -794,8 +789,7 @@ class FamilyLinesReport(Report): # output the birth or fallback event birthStr = None if bth_event and self._incdates: - if (bth_event.private and self._incprivate) or \ - not bth_event.private: + if not bth_event.private or self._incprivate: date = bth_event.get_date_object() if self._just_years and date.get_year_valid(): birthStr = '%i' % date.get_year() @@ -805,8 +799,7 @@ class FamilyLinesReport(Report): # get birth place (one of: city, state, or country) we can use birthplace = None if bth_event and self._incplaces: - if (bth_event.private and self._incprivate) or \ - not bth_event.private: + if not bth_event.private or self._incprivate: place = self._db.get_place_from_handle(bth_event.get_place_handle()) if place: location = place.get_main_location() @@ -820,8 +813,7 @@ class FamilyLinesReport(Report): # see if we have a deceased date we can use deathStr = None if dth_event and self._incdates: - if (dth_event.private and self._incprivate) or \ - not dth_event.private: + if not dth_event.private or self._incprivate: date = dth_event.get_date_object() if self._just_years and date.get_year_valid(): deathStr = '%i' % date.get_year() @@ -831,8 +823,7 @@ class FamilyLinesReport(Report): # get death place (one of: city, state, or country) we can use deathplace = None if dth_event and self._incplaces: - if (dth_event.private and self._incprivate) or \ - not dth_event.private: + if not dth_event.private or self._incprivate: place = self._db.get_place_from_handle(dth_event.get_place_handle()) if place: location = place.get_main_location() diff --git a/src/plugins/graph/GVHourGlass.py b/src/plugins/graph/GVHourGlass.py index a40df34c3..96a50610b 100644 --- a/src/plugins/graph/GVHourGlass.py +++ b/src/plugins/graph/GVHourGlass.py @@ -263,12 +263,12 @@ class HourGlassOptions(MenuReportOptions): menu.add_option(category_name, "pid", pid) 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")) menu.add_option(category_name, "maxdescend", max_gen) 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")) menu.add_option(category_name, "maxascend", max_gen) diff --git a/src/plugins/graph/GVRelGraph.py b/src/plugins/graph/GVRelGraph.py index 79a7b6ad9..1a0a9be54 100644 --- a/src/plugins/graph/GVRelGraph.py +++ b/src/plugins/graph/GVRelGraph.py @@ -46,8 +46,8 @@ from gen.ggettext import sgettext as _ # GRAMPS modules # #------------------------------------------------------------------------ -from gen.plug.menu import BooleanOption, EnumeratedListOption, FilterOption, \ - PersonOption, ColorOption +from gen.plug.menu import (BooleanOption, EnumeratedListOption, FilterOption, + PersonOption, ColorOption) from gen.plug.report import Report from gen.plug.report import utils as ReportUtils from gui.plug.report import MenuReportOptions @@ -164,8 +164,10 @@ class RelGraphReport(Report): self.add_child_links_to_families() 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 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(): event = self.database.get_event_from_handle(event_ref.ref) if event.type == gen.lib.EventType.MARRIAGE and \ - (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or - event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ): + (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or + event_ref.get_role() == gen.lib.EventRoleType.PRIMARY): label = self.get_event_string(event) break if self.includeid: @@ -548,8 +550,9 @@ class RelGraphOptions(MenuReportOptions): menu.add_option(category_name, 'colorfemales', color_females) color_unknown = ColorOption(_('Unknown'), '#e0e0e0') - color_unknown.set_help(_('The colour to use when the gender is ' \ - 'unknown.')) + color_unknown.set_help( + _('The colour to use when the gender is unknown.') + ) menu.add_option(category_name, 'colorunknown', color_unknown) color_family = ColorOption(_('Families'), '#ffffe0') diff --git a/src/plugins/lib/libgedcom.py b/src/plugins/lib/libgedcom.py index 955d28df4..95490e3fa 100644 --- a/src/plugins/lib/libgedcom.py +++ b/src/plugins/lib/libgedcom.py @@ -872,8 +872,9 @@ class GedLine(object): self.data = data[2] if self.level == 0: - if self.token_text and self.token_text[0] == '@' \ - and self.token_text[-1] == '@': + if (self.token_text and self.token_text[0] == '@' and + self.token_text[-1] == '@'): + self.token = TOKEN_ID self.token_text = self.token_text[1:-1] self.data = self.data.strip() @@ -2630,8 +2631,8 @@ class GedcomParser(UpdateCallback): self.__skip_subordinate_levels(1) elif key in ("SOUR", "SOURCE"): self.__parse_source(line.token_text, 1) - elif line.data.startswith("SOUR ") or \ - line.data.startswith("SOURCE "): + elif (line.data.startswith("SOUR ") or + line.data.startswith("SOURCE ")): # A source formatted in a single line, for example: # 0 @S62@ SOUR This is the title of the source 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]) - reflist = [ ref for ref in state.family.get_child_ref_list() \ - if ref.ref == child.handle ] + reflist = [ref for ref in state.family.get_child_ref_list() + if ref.ref == child.handle] if reflist: # The child has been referenced already ref = reflist[0] @@ -4437,8 +4438,8 @@ class GedcomParser(UpdateCallback): if not line.data: # empty: discard, with warning and skip subs # Note: level+2 - msg = _("Line %d: empty event note was ignored.")\ - % line.line + msg = _("Line %d: empty event note was ignored.") % ( + line.line) self.__warn(msg) self.__skip_subordinate_levels(state.level+2) else: @@ -4620,8 +4621,8 @@ class GedcomParser(UpdateCallback): state.person.set_main_parent_family_handle(None) state.person.add_parent_family_handle(handle) - reflist = [ ref for ref in family.get_child_ref_list() \ - if ref.ref == state.person.handle ] + reflist = [ref for ref in family.get_child_ref_list() + if ref.ref == state.person.handle] if reflist: ref = reflist[0] ref.set_father_relation(sub_state.frel) @@ -4665,8 +4666,8 @@ class GedcomParser(UpdateCallback): frel = mrel = gen.lib.ChildRefType.BIRTH family, new = self.dbase.find_family_from_handle(handle, self.trans) - reflist = [ ref for ref in family.get_child_ref_list() \ - if ref.ref == state.person.handle ] + reflist = [ref for ref in family.get_child_ref_list() + if ref.ref == state.person.handle] if reflist: ref = reflist[0] ref.set_father_relation(frel) @@ -5338,8 +5339,8 @@ class GedcomParser(UpdateCallback): self.__parse_level(sub_state, self.parse_addr_tbl, self.__ignore) text = addr.get_street() - if not addr.get_city() and not addr.get_state() and \ - not addr.get_postal_code() and not addr.get_country(): + if not (addr.get_city() or addr.get_state() or + addr.get_postal_code() or addr.get_country()): match = ADDR_RE.match(text) if match: @@ -5585,8 +5586,12 @@ class GedcomParser(UpdateCallback): if state.genby.upper() == "LEGACY": fname = os.path.basename(self.filename) - WarningDialog(_("Import of GEDCOM file %s with DEST=%s, could cause errors in the resulting database!") % \ - (fname, state.genby), _("Look for nameless events.")) + WarningDialog( + _("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): """ diff --git a/src/plugins/view/geoview.py b/src/plugins/view/geoview.py index aee4a0958..66e9637d8 100644 --- a/src/plugins/view/geoview.py +++ b/src/plugins/view/geoview.py @@ -510,9 +510,13 @@ class GeoView(HtmlView): Do we have a crosshair ? """ if self.javascript_ready: - _LOG.debug("crosshair : %d" % self._config.get("preferences.crosshair") ) - self.renderer.execute_script("javascript:addcrosshair('%d','%s','geo-map')" - % (self._config.get("preferences.crosshair"), self.crosspath) + _LOG.debug("crosshair : %d" % + self._config.get("preferences.crosshair") + ) + 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) pass @@ -634,21 +638,25 @@ class GeoView(HtmlView): self.clear.set_alignment(1.0, 0.5) self.savezoom.set_alignment(1.0, 0.5) cell = gtk.CellRendererText() + self.placebox = gtk.ComboBoxEntry(self.plist)# pylint: disable-msg=W0201 self.placebox.pack_start(cell) self.placebox.add_attribute(self.placebox.get_cells()[0], 'text', 0) self.placebox.set_tooltip_text( _("Select the place for which you want to see the info bubble.")) + completion = gtk.EntryCompletion() completion.set_model(self.plist) completion.set_minimum_key_length(1) completion.set_text_column(0) completion.set_inline_completion(True) completion.set_match_func(self._match_string) + self.placebox.child.connect('changed', self._entry_selected_place) self.placebox.child.connect('key-press-event', self._entry_key_event) self.clear.connect('clicked', self._erase_placebox_selection) self.placebox.child.set_completion(completion) + box = gtk.HBox() box.pack_start(self.clear, False, False, 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.provider, False, False, padding=2) box.show_all() + self.heading = gtk.Label('') self.heading.set_single_line_mode(True) font = pango.FontDescription("monospace") font.set_weight(pango.WEIGHT_HEAVY) font.set_style(pango.STYLE_NORMAL) self.heading.modify_font(font) + self.box1.pack_start(box, True, True, padding=2) self.box1.pack_start(self.heading, True, True, padding=2) self.box1.show_all() @@ -759,10 +769,12 @@ class GeoView(HtmlView): self.last_page = cpage ftype = {"places":'P', "event":'E', "family":'F', "person":'I'}.get( self.displaytype, 'X') - url = os.path.join(GEOVIEW_SUBPATH, "GeoV-%c-%05d.html" % (ftype, - cpage)) - url = urlparse.urlunsplit( ('file', '', URL_SEP.join(url.split(os.sep)), - '', '')) + url = os.path.join(GEOVIEW_SUBPATH, + "GeoV-%c-%05d.html" % (ftype, cpage) + ) + url = urlparse.urlunsplit( + ('file', '', URL_SEP.join(url.split(os.sep)), '', '') + ) url += '?map=%s' % self.usedmap url += '&zoom=%d' % int(self.realzoom) url += '&lat=%s' % str(self.reallatitude) @@ -803,7 +815,7 @@ class GeoView(HtmlView): """ place = combobox.get_text() for entry in self.placebox.get_model(): - if ( entry[0] == place ): + if entry[0] == place: # Is this entry in the current page ? if self.last_page == int(entry[2]): # Yes, we don't need to load another page. @@ -826,7 +838,9 @@ class GeoView(HtmlView): url += '&zoom=%d' % int(self.realzoom) url += '&lat=%s' % str(self.reallatitude) 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) (current, maxp ) = self.pages[1].get_label().split('/', 1) 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. self.box1_size = self.box1.get_allocation() self.header_size = self.box1_size.height - self.height = ( widget.parent.get_allocation().height - self.header_size - - widget.parent.get_child2().get_allocation().height - 30 ) - self.width = ( widget.parent.parent.get_allocation().width - - widget.parent.parent.get_child2().get_allocation().width - 30 ) + self.height = (widget.parent.get_allocation().height - self.header_size - + widget.parent.get_child2().get_allocation().height - 30) + self.width = (widget.parent.parent.get_allocation().width - + widget.parent.parent.get_child2().get_allocation().width - 30) + if not self.sidebar.is_visible(): if self.side is not None: self.width = widget.parent.parent.get_allocation().width - 24 else: self.side = widget 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: - _LOG.debug("Sidebar : map width=%d" % self.width ) + _LOG.debug("Sidebar : map width=%d" % self.width) + if not self.bottombar.is_visible(): 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: 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 ) else: _LOG.debug("bottombar : map height=%d" % self.height ) @@ -930,13 +948,15 @@ class GeoView(HtmlView): self.box1.set_allocation(self.box1_size) if self.javascript_ready: _LOG.debug("New size : width=%d and height=%d" % - (self.width, self.height)) - self.renderer.execute_script("javascript:mapstraction.resizeTo" - "('%dpx','%dpx');" - % (self.width, self.height) ) + (self.width, self.height) + ) self.renderer.execute_script( - "javascript:setcenterandzoom(mapstraction,uzoom," - "ulat,ulon)") + "javascript:mapstraction.resizeTo('%dpx','%dpx');" % + (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) if not self.uistate.get_active('Person'): return @@ -1715,9 +1735,9 @@ class GeoView(HtmlView): 'preferences.timeperiod-after-range') self.minyear -= ( self.minyear - adjust_before_min_year ) % 10 self.maxyear -= ( self.maxyear + adjust_after_max_year ) % 10 - self.yearint = adjust_after_max_year + \ - ( self.maxyear - self.minyear ) / \ - ( self.maxbut - 1 ) + self.yearint = (adjust_after_max_year + + (self.maxyear - self.minyear) / (self.maxbut - 1) + ) self.yearint -= self.yearint % 10 if self.yearint == 0: self.yearint = 10 diff --git a/src/plugins/view/pedigreeview.py b/src/plugins/view/pedigreeview.py index 6eeb5c2ac..a8e758515 100644 --- a/src/plugins/view/pedigreeview.py +++ b/src/plugins/view/pedigreeview.py @@ -419,8 +419,8 @@ class PersonBoxWidget(_PersonWidgetBase): self.get_colormap().alloc_color("#b9cfe7")) self.border_gc.set_foreground( self.get_colormap().alloc_color("#000000")) - elif self.alive and \ - self.person.get_gender() == gen.lib.Person.FEMALE: + elif self.alive and ( + self.person.get_gender() == gen.lib.Person.FEMALE): self.bg_gc.set_foreground( self.get_colormap().alloc_color("#ffcdf1")) self.border_gc.set_foreground( @@ -923,8 +923,8 @@ class PedigreeView(NavigationView): self.dirty = False - if self.tree_style == 1 and \ - (self.force_size > 5 or self.force_size == 0): + if self.tree_style == 1 and ( + self.force_size > 5 or self.force_size == 0): self.force_size = 5 # A position definition is a tuple of nodes. @@ -1070,8 +1070,8 @@ class PedigreeView(NavigationView): last_pbw = pbw pbw = None - if not lst[i] and \ - ((self.tree_style in [0, 2] and self.show_unknown_people and + if not lst[i] and ( + (self.tree_style in [0, 2] and self.show_unknown_people and lst[((i+1)/2)-1]) or self.tree_style == 1): # # No person -> show empty box @@ -1099,8 +1099,8 @@ class PedigreeView(NavigationView): # Person exists -> populate box # image = False - if self.show_images and height > 1 and \ - (i < ((2**size-1)/2) or self.tree_style == 2): + if self.show_images and height > 1 and ( + i < ((2**size-1)/2) or self.tree_style == 2): image = True if CAIRO_AVAILABLE: @@ -1128,8 +1128,8 @@ class PedigreeView(NavigationView): #################################################################### # Connection lines #################################################################### - if self.tree_style == 1 and \ - positions[i][1] and len(positions[i][1]) == 2: + if self.tree_style == 1 and ( + positions[i][1] and len(positions[i][1]) == 2): # separate boxes for father and mother x_pos = positions[i][1][0][0]+1 y_pos = positions[i][1][0][1]+1 @@ -1212,9 +1212,9 @@ class PedigreeView(NavigationView): #################################################################### # Show marriage data #################################################################### - if self.show_marriage_data and \ - ((self.tree_style == 1 and positions[i][2]) or - (self.tree_style in [0, 2] and (level+1) < size)): + if self.show_marriage_data and ( + self.tree_style == 1 and positions[i][2] or + (self.tree_style in [0, 2] and level+1 < size)): if lst[i] and lst[i][2]: text = self.format_helper.format_relation(lst[i][2], 1, True) else: @@ -1506,7 +1506,7 @@ class PedigreeView(NavigationView): def cb_bg_motion_notify_event(self, widget, event): """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): window = widget.get_parent() hadjustment = window.get_hadjustment() @@ -1676,13 +1676,13 @@ class PedigreeView(NavigationView): lst[index] = [person, val, family, alive, None] father_handle = family.get_father_handle() if father_handle: - father = self.dbstate.\ - db.get_person_from_handle(father_handle) + father = self.dbstate.db.get_person_from_handle( + father_handle) self.find_tree(father, (2*index)+1, depth+1, lst, frel) mother_handle = family.get_mother_handle() if mother_handle: - mother = self.dbstate.\ - db.get_person_from_handle(mother_handle) + mother = self.dbstate.db.get_person_from_handle( + mother_handle) self.find_tree(mother, (2*index)+2, depth+1, lst, mrel) def add_nav_portion_to_menu(self, menu): @@ -1862,8 +1862,8 @@ class PedigreeView(NavigationView): sib_menu = item.get_submenu() if find_children(self.dbstate.db, sib): - label = gtk.Label('%s' % \ - escape(name_displayer.display(sib))) + label = gtk.Label('%s' + % escape(name_displayer.display(sib))) else: label = gtk.Label(escape(name_displayer.display(sib))) @@ -1901,8 +1901,8 @@ class PedigreeView(NavigationView): child_menu = item.get_submenu() if find_children(self.dbstate.db, child): - label = gtk.Label('%s' % \ - escape(name_displayer.display(child))) + label = gtk.Label('%s' + % escape(name_displayer.display(child))) else: label = gtk.Label(escape(name_displayer.display(child))) @@ -1941,8 +1941,8 @@ class PedigreeView(NavigationView): par_menu = item.get_submenu() if find_parents(self.dbstate.db, par): - label = gtk.Label('%s' % \ - escape(name_displayer.display(par))) + label = gtk.Label('%s' + % escape(name_displayer.display(par))) else: label = gtk.Label(escape(name_displayer.display(par))) diff --git a/src/plugins/view/relview.py b/src/plugins/view/relview.py index ccec9c3af..dbdcd7f90 100644 --- a/src/plugins/view/relview.py +++ b/src/plugins/view/relview.py @@ -859,7 +859,7 @@ class RelationshipView(NavigationView): if count > 1 : childmsg = ngettext(" (%d sibling)", " (%d siblings)", count) % count elif count == 1 : - gender = self.dbstate.db.get_person_from_handle(\ + gender = self.dbstate.db.get_person_from_handle( child_list[0]).gender if gender == gen.lib.Person.MALE : childmsg = _(" (1 brother)") @@ -915,7 +915,7 @@ class RelationshipView(NavigationView): if count > 1 : childmsg = ngettext(" (%d sibling)"," (%d siblings)", count) % count elif count == 1 : - gender = self.dbstate.db.get_person_from_handle(\ + gender = self.dbstate.db.get_person_from_handle( child_list[0]).gender if gender == gen.lib.Person.MALE : childmsg = _(" (1 brother)") @@ -1514,9 +1514,9 @@ class RelationshipView(NavigationView): SelectPerson = SelectorFactory('Person') family = self.dbstate.db.get_family_from_handle(handle) # it only makes sense to skip those who are already in the family - skip_list = [family.get_father_handle(), \ - family.get_mother_handle()] + \ - [x.ref for x in family.get_child_ref_list() ] + skip_list = [family.get_father_handle(), + family.get_mother_handle()] + skip_list.extend(x.ref for x in family.get_child_ref_list()) sel = SelectPerson(self.dbstate, self.uistate, [], _("Select Child"), skip=skip_list) @@ -1709,9 +1709,9 @@ def has_children(db,p): return False 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.type == gtk.gdk.KEY_PRESS and \ + (event.type == gtk.gdk.KEY_PRESS and event.keyval in (_RETURN, _KP_ENTER, _SPACE)): return True else: