diff --git a/gramps/gen/lib/citation.py b/gramps/gen/lib/citation.py index 6e98216c1..08a7e8c1c 100644 --- a/gramps/gen/lib/citation.py +++ b/gramps/gen/lib/citation.py @@ -30,7 +30,6 @@ Citation object for Gramps. # #------------------------------------------------------------------------- import logging -LOG = logging.getLogger(".citation") #------------------------------------------------------------------------- # @@ -46,6 +45,8 @@ from .attrbase import SrcAttributeBase from .citationbase import IndirectCitationBase from .handle import Handle +LOG = logging.getLogger(".citation") + #------------------------------------------------------------------------- # # Citation class @@ -62,10 +63,10 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, """ CONF_VERY_HIGH = 4 - CONF_HIGH = 3 - CONF_NORMAL = 2 - CONF_LOW = 1 - CONF_VERY_LOW = 0 + CONF_HIGH = 3 + CONF_NORMAL = 2 + CONF_LOW = 1 + CONF_VERY_LOW = 0 def __init__(self): """Create a new Citation instance.""" @@ -78,7 +79,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, self.confidence = Citation.CONF_NORMAL # 4 SrcAttributeBase.__init__(self) # 8 - def serialize(self, no_text_date = False): + def serialize(self, no_text_date=False): """ Convert the object to a serialized tuple of data. """ @@ -167,7 +168,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, self.change, # 9 tag_list, # 10 self.private # 11 - ) = data + ) = data DateBase.unserialize(self, date) NoteBase.unserialize(self, note_list) diff --git a/gramps/gen/lib/event.py b/gramps/gen/lib/event.py index 903794a10..0cc0a8385 100644 --- a/gramps/gen/lib/event.py +++ b/gramps/gen/lib/event.py @@ -30,7 +30,6 @@ Event object for Gramps. # #------------------------------------------------------------------------- import logging -LOG = logging.getLogger(".citation") #------------------------------------------------------------------------- # @@ -48,6 +47,8 @@ from .tagbase import TagBase from .eventtype import EventType from .handle import Handle +LOG = logging.getLogger(".citation") + #------------------------------------------------------------------------- # # Event class @@ -84,13 +85,13 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, PlaceBase.__init__(self, source) if source: - self.__description = source.__description - self.__type = EventType(source.__type) + self.__description = source.description + self.__type = EventType(source.type) else: self.__description = "" self.__type = EventType() - def serialize(self, no_text_date = False): + def serialize(self, no_text_date=False): """ Convert the data held in the event to a Python tuple that represents all the data elements. @@ -347,11 +348,11 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, :rtype: bool """ if other is None: - other = Event (None) + other = Event(None) - if self.__type != other.__type or \ + if self.__type != other.type or \ ((self.place or other.place) and (self.place != other.place)) or \ - self.__description != other.__description \ + self.__description != other.description \ or self.private != other.private or \ (not self.get_date_object().is_equal(other.get_date_object())) or \ len(self.get_citation_list()) != \ @@ -360,9 +361,9 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, index = 0 olist = other.get_citation_list() - for a in self.get_citation_list(): + for handle in self.get_citation_list(): # see comment in srefs_are_equal in gen/plug/report/_bibliography.py - if a != olist[index]: + if handle != olist[index]: return False index += 1 @@ -401,7 +402,8 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, :rtype: tuple """ return self.__type - type = property(get_type, set_type, None, 'Returns or sets type of the event') + type = property(get_type, set_type, None, + 'Returns or sets type of the event') def set_description(self, description): """ @@ -414,7 +416,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, """ self.__description = description - def get_description(self) : + def get_description(self): """ Return the description of the Event. @@ -422,5 +424,6 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase, :rtype: str """ return self.__description - description = property(get_description, set_description, None, 'Returns or sets description of the event') + description = property(get_description, set_description, None, + 'Returns or sets description of the event') diff --git a/gramps/gen/lib/family.py b/gramps/gen/lib/family.py index b017a7663..64648829d 100644 --- a/gramps/gen/lib/family.py +++ b/gramps/gen/lib/family.py @@ -32,7 +32,6 @@ Family object for Gramps. #------------------------------------------------------------------------- from warnings import warn import logging -LOG = logging.getLogger(".citation") #------------------------------------------------------------------------- # @@ -52,6 +51,8 @@ from .familyreltype import FamilyRelType from .const import IDENTICAL, EQUAL, DIFFERENT from .handle import Handle +LOG = logging.getLogger(".citation") + #------------------------------------------------------------------------- # # Family class @@ -173,16 +174,27 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, default = Family() return (Handle.from_struct(struct.get("handle", default.handle)), struct.get("gramps_id", default.gramps_id), - Handle.from_struct(struct.get("father_handle", default.father_handle)), - Handle.from_struct(struct.get("mother_handle", default.mother_handle)), - [ChildRef.from_struct(cr) for cr in struct.get("child_ref_list", default.child_ref_list)], + Handle.from_struct(struct.get("father_handle", + default.father_handle)), + Handle.from_struct(struct.get("mother_handle", + default.mother_handle)), + [ChildRef.from_struct(cr) + for cr in struct.get("child_ref_list", + default.child_ref_list)], FamilyRelType.from_struct(struct.get("type", {})), - [EventRef.from_struct(er) for er in struct.get("event_ref_list", default.event_ref_list)], - MediaBase.from_struct(struct.get("media_list", default.media_list)), - AttributeBase.from_struct(struct.get("attribute_list", default.attribute_list)), - LdsOrdBase.from_struct(struct.get("lds_ord_list", default.lds_ord_list)), - CitationBase.from_struct(struct.get("citation_list", default.citation_list)), - NoteBase.from_struct(struct.get("note_list", default.note_list)), + [EventRef.from_struct(er) + for er in struct.get("event_ref_list", + default.event_ref_list)], + MediaBase.from_struct(struct.get("media_list", + default.media_list)), + AttributeBase.from_struct(struct.get("attribute_list", + default.attribute_list)), + LdsOrdBase.from_struct(struct.get("lds_ord_list", + default.lds_ord_list)), + CitationBase.from_struct(struct.get("citation_list", + default.citation_list)), + NoteBase.from_struct(struct.get("note_list", + default.note_list)), struct.get("change", default.change), TagBase.from_struct(struct.get("tag_list", default.tag_list)), struct.get("private", default.private)) @@ -230,7 +242,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, return handle in ([ref.ref for ref in self.child_ref_list] + [self.father_handle, self.mother_handle]) elif classname == 'Place': - return handle in [ x.place for x in self.lds_ord_list ] + return handle in [x.place for x in self.lds_ord_list] return False def _remove_handle_references(self, classname, handle_list): @@ -244,20 +256,20 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, """ if classname == 'Event': new_list = [ref for ref in self.event_ref_list - if ref.ref not in handle_list] + if ref.ref not in handle_list] self.event_ref_list = new_list elif classname == 'Person': new_list = [ref for ref in self.child_ref_list - if ref.ref not in handle_list] + if ref.ref not in handle_list] self.child_ref_list = new_list if self.father_handle in handle_list: self.father_handle = None if self.mother_handle in handle_list: self.mother_handle = None elif classname == 'Place': - for x in self.lds_ord_list: - if x.place in handle_list: - x.place = None + for lds_ord in self.lds_ord_list: + if lds_ord.place in handle_list: + lds_ord.place = None def _replace_handle_reference(self, classname, old_handle, new_handle): """ @@ -271,7 +283,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, :type new_handle: str """ if classname == 'Event': - refs_list = [ ref.ref for ref in self.event_ref_list ] + refs_list = [ref.ref for ref in self.event_ref_list] new_ref = None if new_handle in refs_list: new_ref = self.event_ref_list[refs_list.index(new_handle)] @@ -289,7 +301,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, self.event_ref_list.pop(idx) refs_list.pop(idx) elif classname == 'Person': - refs_list = [ ref.ref for ref in self.child_ref_list ] + refs_list = [ref.ref for ref in self.child_ref_list] new_ref = None if new_handle in refs_list: new_ref = self.child_ref_list[refs_list.index(new_handle)] @@ -311,9 +323,9 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, if self.mother_handle == old_handle: self.mother_handle = new_handle elif classname == 'Place': - for x in self.lds_ord_list: - if x.place == old_handle: - x.place = new_handle + for lds_ord in self.lds_ord_list: + if lds_ord.place == old_handle: + lds_ord.place = new_handle def get_text_data_list(self): """ @@ -521,7 +533,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, if not isinstance(child_ref, ChildRef): raise ValueError("expecting ChildRef instance") new_list = [ref for ref in self.child_ref_list - if ref.ref != child_ref.ref ] + if ref.ref != child_ref.ref] self.child_ref_list = new_list def remove_child_handle(self, child_handle): @@ -536,7 +548,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, :rtype: bool """ new_list = [ref for ref in self.child_ref_list - if ref.ref != child_handle ] + if ref.ref != child_handle] self.child_ref_list = new_list def get_child_ref_list(self): @@ -596,17 +608,17 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, raise ValueError("Expecting EventRef instance") self.event_ref_list.append(event_ref) - def get_event_list(self) : - warn( "Use get_event_ref_list instead of get_event_list", - DeprecationWarning, 2) + def get_event_list(self): + warn("Use get_event_ref_list instead of get_event_list", + DeprecationWarning, 2) # Wrapper for old API # remove when transitition done. event_handle_list = [] for event_ref in self.get_event_ref_list(): - event_handle_list.append( event_ref.get_reference_handle()) + event_handle_list.append(event_ref.get_reference_handle()) return event_handle_list - def get_event_ref_list(self) : + def get_event_ref_list(self): """ Return the list of :class:`~.eventref.EventRef` objects associated with :class:`~.event.Event` instances. @@ -617,7 +629,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase, """ return self.event_ref_list - def set_event_ref_list(self, event_ref_list) : + def set_event_ref_list(self, event_ref_list): """ Set the Family instance's :class:`~.eventref.EventRef` list to the passed list. diff --git a/gramps/gen/lib/mediaobj.py b/gramps/gen/lib/mediaobj.py index 3808f0f15..643f20d41 100644 --- a/gramps/gen/lib/mediaobj.py +++ b/gramps/gen/lib/mediaobj.py @@ -33,7 +33,6 @@ Media object for Gramps. import os from urllib.parse import urlparse import logging -LOG = logging.getLogger(".citation") #------------------------------------------------------------------------- # @@ -48,6 +47,8 @@ from .attrbase import AttributeBase from .tagbase import TagBase from .handle import Handle +LOG = logging.getLogger(".citation") + #------------------------------------------------------------------------- # # MediaObject class @@ -89,7 +90,7 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase, self.checksum = "" self.thumb = None - def serialize(self, no_text_date = False): + def serialize(self, no_text_date=False): """ Convert the data held in the event to a Python tuple that represents all the data elements. diff --git a/gramps/gen/lib/person.py b/gramps/gen/lib/person.py index 0f66f09e3..247f75f9f 100644 --- a/gramps/gen/lib/person.py +++ b/gramps/gen/lib/person.py @@ -46,9 +46,9 @@ from .attrtype import AttributeType from .eventroletype import EventRoleType from .attribute import Attribute from .const import IDENTICAL, EQUAL, DIFFERENT +from .handle import Handle from ..const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from .handle import Handle #------------------------------------------------------------------------- # @@ -75,8 +75,8 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, """ UNKNOWN = 2 - MALE = 1 - FEMALE = 0 + MALE = 1 + FEMALE = 0 def __init__(self, data=None): """ @@ -113,7 +113,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, return isinstance(other, Person) and self.handle == other.handle def __ne__(self, other): - return not self == other + return self != other def serialize(self): """ @@ -248,23 +248,34 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, struct.get("gramps_id", default.gramps_id), struct.get("gender", default.gender), Name.from_struct(struct.get("primary_name", {})), - [Name.from_struct(name) for name in struct.get("alternate_names", default.alternate_names)], + [Name.from_struct(name) + for name in struct.get("alternate_names", + default.alternate_names)], struct.get("death_ref_index", default.death_ref_index), struct.get("birth_ref_index", default.birth_ref_index), - [EventRef.from_struct(er) for er in struct.get("event_ref_list", default.event_ref_list)], - [Handle.from_struct(handle) for handle in struct.get("family_list", default.family_list)], - [Handle.from_struct(handle) for handle in struct.get("parent_family_list", default.parent_family_list)], + [EventRef.from_struct(er) + for er in struct.get("event_ref_list", default.event_ref_list)], + [Handle.from_struct(handle) + for handle in struct.get("family_list", default.family_list)], + [Handle.from_struct(handle) + for handle in struct.get("parent_family_list", + default.parent_family_list)], MediaBase.from_struct(struct.get("media_list", default.media_list)), - AddressBase.from_struct(struct.get("address_list", default.address_list)), - AttributeBase.from_struct(struct.get("attribute_list", default.attribute_list)), + AddressBase.from_struct(struct.get("address_list", + default.address_list)), + AttributeBase.from_struct(struct.get("attribute_list", + default.attribute_list)), UrlBase.from_struct(struct.get("urls", default.urls)), - LdsOrdBase.from_struct(struct.get("lds_ord_list", default.lds_ord_list)), - CitationBase.from_struct(struct.get("citation_list", default.citation_list)), + LdsOrdBase.from_struct(struct.get("lds_ord_list", + default.lds_ord_list)), + CitationBase.from_struct(struct.get("citation_list", + default.citation_list)), NoteBase.from_struct(struct.get("note_list", default.note_list)), struct.get("change", default.change), TagBase.from_struct(struct.get("tag_list", default.tag_list)), struct.get("private", default.private), - [PersonRef.from_struct(p) for p in struct.get("person_ref_list", default.person_ref_list)] + [PersonRef.from_struct(p) + for p in struct.get("person_ref_list", default.person_ref_list)] ) @classmethod @@ -327,7 +338,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, tag_list, # 18 self.private, # 19 person_ref_list, # 20 - ) = data + ) = data self.primary_name = Name() self.primary_name.unserialize(primary_name) @@ -366,11 +377,11 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, return any(ref.ref == handle for ref in self.person_ref_list) elif classname == 'Family': return any(ref == handle - for ref in self.family_list + self.parent_family_list + - [ordinance.famc for ordinance in self.lds_ord_list]) + for ref in self.family_list + self.parent_family_list + + [ordinance.famc for ordinance in self.lds_ord_list]) elif classname == 'Place': return any(ordinance.place == handle - for ordinance in self.lds_ord_list) + for ordinance in self.lds_ord_list) return False def _remove_handle_references(self, classname, handle_list): @@ -384,30 +395,30 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, # If deleting removing the reference to the event # to which birth or death ref_index points, unset the index if (self.birth_ref_index != -1 - and self.event_ref_list[self.birth_ref_index].ref - in handle_list): + and self.event_ref_list[self.birth_ref_index].ref + in handle_list): self.set_birth_ref(None) if (self.death_ref_index != -1 - and self.event_ref_list[self.death_ref_index].ref - in handle_list): + and self.event_ref_list[self.death_ref_index].ref + in handle_list): self.set_death_ref(None) self.event_ref_list = new_list # Reset the indexes after deleting the event from even_ref_list - if (self.birth_ref_index != -1): + if self.birth_ref_index != -1: self.set_birth_ref(birth_ref) - if (self.death_ref_index != -1): + if self.death_ref_index != -1: self.set_death_ref(death_ref) elif classname == 'Person': new_list = [ref for ref in self.person_ref_list - if ref.ref not in handle_list] + if ref.ref not in handle_list] self.person_ref_list = new_list elif classname == 'Family': new_list = [handle for handle in self.family_list - if handle not in handle_list] + if handle not in handle_list] self.family_list = new_list new_list = [handle for handle in self.parent_family_list - if handle not in handle_list] + if handle not in handle_list] self.parent_family_list = new_list for ordinance in self.lds_ord_list: if ordinance.famc in handle_list: @@ -449,7 +460,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, # death_ref_index should be recalculated which # needs database access! elif classname == 'Person': - refs_list = [ ref.ref for ref in self.person_ref_list ] + refs_list = [ref.ref for ref in self.person_ref_list] new_ref = None if new_handle in refs_list: new_ref = self.person_ref_list[refs_list.index(new_handle)] @@ -504,15 +515,15 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, check_list = self.lds_ord_list add_list = [_f for _f in check_list if _f] return ([self.primary_name] + - self.media_list + - self.alternate_names + - self.address_list + - self.attribute_list + - self.urls + - self.event_ref_list + - add_list + - self.person_ref_list - ) + self.media_list + + self.alternate_names + + self.address_list + + self.attribute_list + + self.urls + + self.event_ref_list + + add_list + + self.person_ref_list + ) def get_citation_child_list(self): """ @@ -523,14 +534,14 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, :rtype: list """ return ([self.primary_name] + - self.media_list + - self.alternate_names + - self.address_list + - self.attribute_list + - self.lds_ord_list + - self.person_ref_list + - self.event_ref_list - ) + self.media_list + + self.alternate_names + + self.address_list + + self.attribute_list + + self.lds_ord_list + + self.person_ref_list + + self.event_ref_list + ) def get_note_child_list(self): """ @@ -541,14 +552,14 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, :rtype: list """ return ([self.primary_name] + - self.media_list + - self.alternate_names + - self.address_list + - self.attribute_list + - self.lds_ord_list + - self.person_ref_list + - self.event_ref_list - ) + self.media_list + + self.alternate_names + + self.address_list + + self.attribute_list + + self.lds_ord_list + + self.person_ref_list + + self.event_ref_list + ) def get_referenced_handles(self): """ @@ -560,9 +571,9 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, """ return [('Family', handle) for handle in (self.family_list + self.parent_family_list)] + ( - self.get_referenced_note_handles() + - self.get_referenced_citation_handles() + - self.get_referenced_tag_handles() + self.get_referenced_note_handles() + + self.get_referenced_citation_handles() + + self.get_referenced_tag_handles() ) def get_handle_referents(self): @@ -574,14 +585,14 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, :rtype: list """ return ([self.primary_name] + - self.media_list + - self.alternate_names + - self.address_list + - self.attribute_list + - self.lds_ord_list + - self.person_ref_list + - self.event_ref_list - ) + self.media_list + + self.alternate_names + + self.address_list + + self.attribute_list + + self.lds_ord_list + + self.person_ref_list + + self.event_ref_list + ) def merge(self, acquisition): """ @@ -612,7 +623,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, self._merge_tag_list(acquisition) list(map(self.add_parent_family_handle, - acquisition.get_parent_family_handle_list())) + acquisition.get_parent_family_handle_list())) list(map(self.add_family_handle, acquisition.get_family_handle_list())) def set_primary_name(self, name): @@ -694,7 +705,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, return attr.get_value() return '' - def set_gender(self, gender) : + def set_gender(self, gender): """ Set the gender of the Person. @@ -708,7 +719,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, """ self.gender = gender - def get_gender(self) : + def get_gender(self): """ Return the gender of the Person. @@ -880,10 +891,10 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, else: self.event_ref_list.append(addendum) if (self.birth_ref_index == -1 and - idx == acquisition.birth_ref_index): + idx == acquisition.birth_ref_index): self.birth_ref_index = len(self.event_ref_list) - 1 if (self.death_ref_index == -1 and - idx == acquisition.death_ref_index): + idx == acquisition.death_ref_index): self.death_ref_index = len(self.event_ref_list) - 1 def add_family_handle(self, family_handle): @@ -934,7 +945,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, else: return False - def get_family_handle_list(self) : + def get_family_handle_list(self): """ Return the list of :class:`~.family.Family` handles in which the person is a parent or spouse. @@ -946,7 +957,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase, """ return self.family_list - def set_family_handle_list(self, family_list) : + def set_family_handle_list(self, family_list): """ Assign the passed list to the Person's list of families in which it is a parent or spouse. diff --git a/gramps/gen/lib/place.py b/gramps/gen/lib/place.py index cda6c2041..4d8c37ce4 100644 --- a/gramps/gen/lib/place.py +++ b/gramps/gen/lib/place.py @@ -170,15 +170,20 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject): struct.get("title", default.title), struct.get("long", default.long), struct.get("lat", default.lat), - [PlaceRef.from_struct(pr) for pr in struct.get("placeref_list", default.placeref_list)], + [PlaceRef.from_struct(pr) + for pr in struct.get("placeref_list", default.placeref_list)], PlaceName.from_struct(struct.get("name", {})), - [PlaceName.from_struct(an) for an in struct.get("alt_names", default.alt_names)], + [PlaceName.from_struct(an) + for an in struct.get("alt_names", default.alt_names)], PlaceType.from_struct(struct.get("place_type", {})), struct.get("code", default.code), - [Location.from_struct(al) for al in struct.get("alt_loc", default.alt_loc)], + [Location.from_struct(al) + for al in struct.get("alt_loc", default.alt_loc)], UrlBase.from_struct(struct.get("urls", default.urls)), - MediaBase.from_struct(struct.get("media_list", default.media_list)), - CitationBase.from_struct(struct.get("citation_list", default.citation_list)), + MediaBase.from_struct(struct.get("media_list", + default.media_list)), + CitationBase.from_struct(struct.get("citation_list", + default.citation_list)), NoteBase.from_struct(struct.get("note_list", default.note_list)), struct.get("change", default.change), TagBase.from_struct(struct.get("tag_list", default.tag_list)), diff --git a/gramps/gen/lib/repo.py b/gramps/gen/lib/repo.py index b129731c6..ece338a31 100644 --- a/gramps/gen/lib/repo.py +++ b/gramps/gen/lib/repo.py @@ -43,8 +43,8 @@ from .citationbase import IndirectCitationBase # Repository class # #------------------------------------------------------------------------- -class Repository(NoteBase, AddressBase, UrlBase, - IndirectCitationBase, PrimaryObject): +class Repository(NoteBase, AddressBase, UrlBase, IndirectCitationBase, + PrimaryObject): """A location where collections of Sources are found.""" def __init__(self): diff --git a/gramps/gen/lib/src.py b/gramps/gen/lib/src.py index 5ac2d363d..7002970ee 100644 --- a/gramps/gen/lib/src.py +++ b/gramps/gen/lib/src.py @@ -46,7 +46,7 @@ from .citationbase import IndirectCitationBase # #------------------------------------------------------------------------- class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, - PrimaryObject): + PrimaryObject): """A record of a source of information.""" def __init__(self): @@ -128,12 +128,15 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, struct.get("title", default.title), struct.get("author", default.author), struct.get("pubinfo", default.pubinfo), - NoteBase.from_struct(struct.get("note_list", default.note_list)), - MediaBase.from_struct(struct.get("media_list", default.media_list)), + NoteBase.from_struct(struct.get("note_list", + default.note_list)), + MediaBase.from_struct(struct.get("media_list", + default.media_list)), struct.get("abbrev", default.abbrev), struct.get("change", default.change), SrcAttributeBase.from_struct(struct.get("srcattr_list", {})), - [RepoRef.from_struct(rr) for rr in struct.get("reporef_list", default.reporef_list)], + [RepoRef.from_struct(rr) + for rr in struct.get("reporef_list", default.reporef_list)], TagBase.from_struct(struct.get("tag_list", default.tag_list)), struct.get("private", default.private)) @@ -192,7 +195,7 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, """ if classname == 'Repository': new_list = [ref for ref in self.reporef_list - if ref.ref not in handle_list] + if ref.ref not in handle_list] self.reporef_list = new_list def _replace_handle_reference(self, classname, old_handle, new_handle): @@ -402,7 +405,7 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, :type repo_handle_list: list """ new_reporef_list = [repo_ref for repo_ref in self.reporef_list - if repo_ref.ref not in repo_handle_list] + if repo_ref.ref not in repo_handle_list] self.reporef_list = new_reporef_list def replace_repo_references(self, old_handle, new_handle): @@ -415,7 +418,7 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase, :param new_handle: The Repository handle to replace the old one with. :type new_handle: str """ - refs_list = [ repo_ref.ref for repo_ref in self.reporef_list ] + refs_list = [repo_ref.ref for repo_ref in self.reporef_list] new_ref = None if new_handle in refs_list: new_ref = self.reporef_list[refs_list.index(new_handle)] diff --git a/gramps/gen/lib/tableobj.py b/gramps/gen/lib/tableobj.py index a3a4f01ac..24738e150 100644 --- a/gramps/gen/lib/tableobj.py +++ b/gramps/gen/lib/tableobj.py @@ -112,7 +112,7 @@ class TableObject(BaseObject): """ if self.change: return str(time.strftime('%x %X', time.localtime(self.change)), - CODESET) + CODESET) else: return '' diff --git a/gramps/gen/lib/tag.py b/gramps/gen/lib/tag.py index d9d4a18da..a87bcffb5 100644 --- a/gramps/gen/lib/tag.py +++ b/gramps/gen/lib/tag.py @@ -53,9 +53,9 @@ class Tag(TableObject): TableObject.__init__(self, source) if source: - self.__name = source.__name - self.__color = source.__color - self.__priority = source.__priority + self.__name = source.name + self.__color = source.color + self.__priority = source.priority else: self.__name = "" self.__color = "#000000000000" # Black @@ -131,9 +131,9 @@ class Tag(TableObject): if other is None: other = Tag() - if self.__name != other.__name or \ - self.__color != other.__color or \ - self.__priority != other.__priority: + if (self.__name != other.name or + self.__color != other.color or + self.__priority != other.priority): return False return True @@ -168,7 +168,7 @@ class Tag(TableObject): """ self.__color = color - def get_color(self) : + def get_color(self): """ Return the color of the Tag. @@ -190,7 +190,7 @@ class Tag(TableObject): """ self.__priority = priority - def get_priority(self) : + def get_priority(self): """ Return the priority of the Tag. @@ -241,4 +241,4 @@ class Tag(TableObject): struct.get("change", default.change)) priority = property(get_priority, set_priority, None, - 'Returns or sets priority of the tag') + 'Returns or sets priority of the tag')