Primary object pylint improvements

This commit is contained in:
Nick Hall 2015-12-31 23:06:16 +00:00
parent e82148677d
commit 307f236771
10 changed files with 180 additions and 144 deletions

View File

@ -30,7 +30,6 @@ Citation object for Gramps.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -46,6 +45,8 @@ from .attrbase import SrcAttributeBase
from .citationbase import IndirectCitationBase from .citationbase import IndirectCitationBase
from .handle import Handle from .handle import Handle
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Citation class # Citation class
@ -78,7 +79,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
self.confidence = Citation.CONF_NORMAL # 4 self.confidence = Citation.CONF_NORMAL # 4
SrcAttributeBase.__init__(self) # 8 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. Convert the object to a serialized tuple of data.
""" """

View File

@ -30,7 +30,6 @@ Event object for Gramps.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import logging import logging
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -48,6 +47,8 @@ from .tagbase import TagBase
from .eventtype import EventType from .eventtype import EventType
from .handle import Handle from .handle import Handle
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Event class # Event class
@ -84,13 +85,13 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
PlaceBase.__init__(self, source) PlaceBase.__init__(self, source)
if source: if source:
self.__description = source.__description self.__description = source.description
self.__type = EventType(source.__type) self.__type = EventType(source.type)
else: else:
self.__description = "" self.__description = ""
self.__type = EventType() 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 Convert the data held in the event to a Python tuple that
represents all the data elements. represents all the data elements.
@ -347,11 +348,11 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
:rtype: bool :rtype: bool
""" """
if other is None: 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.place or other.place) and (self.place != other.place)) or \
self.__description != other.__description \ self.__description != other.description \
or self.private != other.private or \ or self.private != other.private or \
(not self.get_date_object().is_equal(other.get_date_object())) or \ (not self.get_date_object().is_equal(other.get_date_object())) or \
len(self.get_citation_list()) != \ len(self.get_citation_list()) != \
@ -360,9 +361,9 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
index = 0 index = 0
olist = other.get_citation_list() 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 # see comment in srefs_are_equal in gen/plug/report/_bibliography.py
if a != olist[index]: if handle != olist[index]:
return False return False
index += 1 index += 1
@ -401,7 +402,8 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
:rtype: tuple :rtype: tuple
""" """
return self.__type 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): def set_description(self, description):
""" """
@ -414,7 +416,7 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
""" """
self.__description = description self.__description = description
def get_description(self) : def get_description(self):
""" """
Return the description of the Event. Return the description of the Event.
@ -422,5 +424,6 @@ class Event(CitationBase, NoteBase, MediaBase, AttributeBase,
:rtype: str :rtype: str
""" """
return self.__description 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')

View File

@ -32,7 +32,6 @@ Family object for Gramps.
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from warnings import warn from warnings import warn
import logging import logging
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -52,6 +51,8 @@ from .familyreltype import FamilyRelType
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from .handle import Handle from .handle import Handle
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Family class # Family class
@ -173,16 +174,27 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
default = Family() default = Family()
return (Handle.from_struct(struct.get("handle", default.handle)), return (Handle.from_struct(struct.get("handle", default.handle)),
struct.get("gramps_id", default.gramps_id), struct.get("gramps_id", default.gramps_id),
Handle.from_struct(struct.get("father_handle", default.father_handle)), Handle.from_struct(struct.get("father_handle",
Handle.from_struct(struct.get("mother_handle", default.mother_handle)), default.father_handle)),
[ChildRef.from_struct(cr) for cr in struct.get("child_ref_list", default.child_ref_list)], 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", {})), FamilyRelType.from_struct(struct.get("type", {})),
[EventRef.from_struct(er) for er in struct.get("event_ref_list", default.event_ref_list)], [EventRef.from_struct(er)
MediaBase.from_struct(struct.get("media_list", default.media_list)), for er in struct.get("event_ref_list",
AttributeBase.from_struct(struct.get("attribute_list", default.attribute_list)), default.event_ref_list)],
LdsOrdBase.from_struct(struct.get("lds_ord_list", default.lds_ord_list)), MediaBase.from_struct(struct.get("media_list",
CitationBase.from_struct(struct.get("citation_list", default.citation_list)), default.media_list)),
NoteBase.from_struct(struct.get("note_list", default.note_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), struct.get("change", default.change),
TagBase.from_struct(struct.get("tag_list", default.tag_list)), TagBase.from_struct(struct.get("tag_list", default.tag_list)),
struct.get("private", default.private)) 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] return handle in ([ref.ref for ref in self.child_ref_list]
+ [self.father_handle, self.mother_handle]) + [self.father_handle, self.mother_handle])
elif classname == 'Place': 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 return False
def _remove_handle_references(self, classname, handle_list): def _remove_handle_references(self, classname, handle_list):
@ -255,9 +267,9 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
if self.mother_handle in handle_list: if self.mother_handle in handle_list:
self.mother_handle = None self.mother_handle = None
elif classname == 'Place': elif classname == 'Place':
for x in self.lds_ord_list: for lds_ord in self.lds_ord_list:
if x.place in handle_list: if lds_ord.place in handle_list:
x.place = None lds_ord.place = None
def _replace_handle_reference(self, classname, old_handle, new_handle): 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 :type new_handle: str
""" """
if classname == 'Event': 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 new_ref = None
if new_handle in refs_list: if new_handle in refs_list:
new_ref = self.event_ref_list[refs_list.index(new_handle)] 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) self.event_ref_list.pop(idx)
refs_list.pop(idx) refs_list.pop(idx)
elif classname == 'Person': 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 new_ref = None
if new_handle in refs_list: if new_handle in refs_list:
new_ref = self.child_ref_list[refs_list.index(new_handle)] 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: if self.mother_handle == old_handle:
self.mother_handle = new_handle self.mother_handle = new_handle
elif classname == 'Place': elif classname == 'Place':
for x in self.lds_ord_list: for lds_ord in self.lds_ord_list:
if x.place == old_handle: if lds_ord.place == old_handle:
x.place = new_handle lds_ord.place = new_handle
def get_text_data_list(self): def get_text_data_list(self):
""" """
@ -521,7 +533,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
if not isinstance(child_ref, ChildRef): if not isinstance(child_ref, ChildRef):
raise ValueError("expecting ChildRef instance") raise ValueError("expecting ChildRef instance")
new_list = [ref for ref in self.child_ref_list 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 self.child_ref_list = new_list
def remove_child_handle(self, child_handle): def remove_child_handle(self, child_handle):
@ -536,7 +548,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
:rtype: bool :rtype: bool
""" """
new_list = [ref for ref in self.child_ref_list 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 self.child_ref_list = new_list
def get_child_ref_list(self): def get_child_ref_list(self):
@ -596,17 +608,17 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
raise ValueError("Expecting EventRef instance") raise ValueError("Expecting EventRef instance")
self.event_ref_list.append(event_ref) self.event_ref_list.append(event_ref)
def get_event_list(self) : def get_event_list(self):
warn( "Use get_event_ref_list instead of get_event_list", warn("Use get_event_ref_list instead of get_event_list",
DeprecationWarning, 2) DeprecationWarning, 2)
# Wrapper for old API # Wrapper for old API
# remove when transitition done. # remove when transitition done.
event_handle_list = [] event_handle_list = []
for event_ref in self.get_event_ref_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 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 Return the list of :class:`~.eventref.EventRef` objects associated with
:class:`~.event.Event` instances. :class:`~.event.Event` instances.
@ -617,7 +629,7 @@ class Family(CitationBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
""" """
return self.event_ref_list 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 Set the Family instance's :class:`~.eventref.EventRef` list to the
passed list. passed list.

View File

@ -33,7 +33,6 @@ Media object for Gramps.
import os import os
from urllib.parse import urlparse from urllib.parse import urlparse
import logging import logging
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -48,6 +47,8 @@ from .attrbase import AttributeBase
from .tagbase import TagBase from .tagbase import TagBase
from .handle import Handle from .handle import Handle
LOG = logging.getLogger(".citation")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# MediaObject class # MediaObject class
@ -89,7 +90,7 @@ class MediaObject(CitationBase, NoteBase, DateBase, AttributeBase,
self.checksum = "" self.checksum = ""
self.thumb = None 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 Convert the data held in the event to a Python tuple that
represents all the data elements. represents all the data elements.

View File

@ -46,9 +46,9 @@ from .attrtype import AttributeType
from .eventroletype import EventRoleType from .eventroletype import EventRoleType
from .attribute import Attribute from .attribute import Attribute
from .const import IDENTICAL, EQUAL, DIFFERENT from .const import IDENTICAL, EQUAL, DIFFERENT
from .handle import Handle
from ..const import GRAMPS_LOCALE as glocale from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from .handle import Handle
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -113,7 +113,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
return isinstance(other, Person) and self.handle == other.handle return isinstance(other, Person) and self.handle == other.handle
def __ne__(self, other): def __ne__(self, other):
return not self == other return self != other
def serialize(self): def serialize(self):
""" """
@ -248,23 +248,34 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
struct.get("gramps_id", default.gramps_id), struct.get("gramps_id", default.gramps_id),
struct.get("gender", default.gender), struct.get("gender", default.gender),
Name.from_struct(struct.get("primary_name", {})), 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("death_ref_index", default.death_ref_index),
struct.get("birth_ref_index", default.birth_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)], [EventRef.from_struct(er)
[Handle.from_struct(handle) for handle in struct.get("family_list", default.family_list)], for er in struct.get("event_ref_list", default.event_ref_list)],
[Handle.from_struct(handle) for handle in struct.get("parent_family_list", default.parent_family_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)), MediaBase.from_struct(struct.get("media_list", default.media_list)),
AddressBase.from_struct(struct.get("address_list", default.address_list)), AddressBase.from_struct(struct.get("address_list",
AttributeBase.from_struct(struct.get("attribute_list", default.attribute_list)), default.address_list)),
AttributeBase.from_struct(struct.get("attribute_list",
default.attribute_list)),
UrlBase.from_struct(struct.get("urls", default.urls)), UrlBase.from_struct(struct.get("urls", default.urls)),
LdsOrdBase.from_struct(struct.get("lds_ord_list", default.lds_ord_list)), LdsOrdBase.from_struct(struct.get("lds_ord_list",
CitationBase.from_struct(struct.get("citation_list", default.citation_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)), NoteBase.from_struct(struct.get("note_list", default.note_list)),
struct.get("change", default.change), struct.get("change", default.change),
TagBase.from_struct(struct.get("tag_list", default.tag_list)), TagBase.from_struct(struct.get("tag_list", default.tag_list)),
struct.get("private", default.private), 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 @classmethod
@ -394,9 +405,9 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
self.event_ref_list = new_list self.event_ref_list = new_list
# Reset the indexes after deleting the event from even_ref_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) self.set_birth_ref(birth_ref)
if (self.death_ref_index != -1): if self.death_ref_index != -1:
self.set_death_ref(death_ref) self.set_death_ref(death_ref)
elif classname == 'Person': elif classname == 'Person':
new_list = [ref for ref in self.person_ref_list new_list = [ref for ref in self.person_ref_list
@ -449,7 +460,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
# death_ref_index should be recalculated which # death_ref_index should be recalculated which
# needs database access! # needs database access!
elif classname == 'Person': 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 new_ref = None
if new_handle in refs_list: if new_handle in refs_list:
new_ref = self.person_ref_list[refs_list.index(new_handle)] new_ref = self.person_ref_list[refs_list.index(new_handle)]
@ -694,7 +705,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
return attr.get_value() return attr.get_value()
return '' return ''
def set_gender(self, gender) : def set_gender(self, gender):
""" """
Set the gender of the Person. Set the gender of the Person.
@ -708,7 +719,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
""" """
self.gender = gender self.gender = gender
def get_gender(self) : def get_gender(self):
""" """
Return the gender of the Person. Return the gender of the Person.
@ -934,7 +945,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
else: else:
return False 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 Return the list of :class:`~.family.Family` handles in which the person
is a parent or spouse. is a parent or spouse.
@ -946,7 +957,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
""" """
return self.family_list 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 Assign the passed list to the Person's list of families in which it is
a parent or spouse. a parent or spouse.

View File

@ -170,15 +170,20 @@ class Place(CitationBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
struct.get("title", default.title), struct.get("title", default.title),
struct.get("long", default.long), struct.get("long", default.long),
struct.get("lat", default.lat), 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(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", {})), PlaceType.from_struct(struct.get("place_type", {})),
struct.get("code", default.code), 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)), UrlBase.from_struct(struct.get("urls", default.urls)),
MediaBase.from_struct(struct.get("media_list", default.media_list)), MediaBase.from_struct(struct.get("media_list",
CitationBase.from_struct(struct.get("citation_list", default.citation_list)), default.media_list)),
CitationBase.from_struct(struct.get("citation_list",
default.citation_list)),
NoteBase.from_struct(struct.get("note_list", default.note_list)), NoteBase.from_struct(struct.get("note_list", default.note_list)),
struct.get("change", default.change), struct.get("change", default.change),
TagBase.from_struct(struct.get("tag_list", default.tag_list)), TagBase.from_struct(struct.get("tag_list", default.tag_list)),

View File

@ -43,8 +43,8 @@ from .citationbase import IndirectCitationBase
# Repository class # Repository class
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
class Repository(NoteBase, AddressBase, UrlBase, class Repository(NoteBase, AddressBase, UrlBase, IndirectCitationBase,
IndirectCitationBase, PrimaryObject): PrimaryObject):
"""A location where collections of Sources are found.""" """A location where collections of Sources are found."""
def __init__(self): def __init__(self):

View File

@ -128,12 +128,15 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
struct.get("title", default.title), struct.get("title", default.title),
struct.get("author", default.author), struct.get("author", default.author),
struct.get("pubinfo", default.pubinfo), struct.get("pubinfo", default.pubinfo),
NoteBase.from_struct(struct.get("note_list", default.note_list)), NoteBase.from_struct(struct.get("note_list",
MediaBase.from_struct(struct.get("media_list", default.media_list)), default.note_list)),
MediaBase.from_struct(struct.get("media_list",
default.media_list)),
struct.get("abbrev", default.abbrev), struct.get("abbrev", default.abbrev),
struct.get("change", default.change), struct.get("change", default.change),
SrcAttributeBase.from_struct(struct.get("srcattr_list", {})), 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)), TagBase.from_struct(struct.get("tag_list", default.tag_list)),
struct.get("private", default.private)) struct.get("private", default.private))
@ -415,7 +418,7 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
:param new_handle: The Repository handle to replace the old one with. :param new_handle: The Repository handle to replace the old one with.
:type new_handle: str :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 new_ref = None
if new_handle in refs_list: if new_handle in refs_list:
new_ref = self.reporef_list[refs_list.index(new_handle)] new_ref = self.reporef_list[refs_list.index(new_handle)]

View File

@ -53,9 +53,9 @@ class Tag(TableObject):
TableObject.__init__(self, source) TableObject.__init__(self, source)
if source: if source:
self.__name = source.__name self.__name = source.name
self.__color = source.__color self.__color = source.color
self.__priority = source.__priority self.__priority = source.priority
else: else:
self.__name = "" self.__name = ""
self.__color = "#000000000000" # Black self.__color = "#000000000000" # Black
@ -131,9 +131,9 @@ class Tag(TableObject):
if other is None: if other is None:
other = Tag() other = Tag()
if self.__name != other.__name or \ if (self.__name != other.name or
self.__color != other.__color or \ self.__color != other.color or
self.__priority != other.__priority: self.__priority != other.priority):
return False return False
return True return True
@ -168,7 +168,7 @@ class Tag(TableObject):
""" """
self.__color = color self.__color = color
def get_color(self) : def get_color(self):
""" """
Return the color of the Tag. Return the color of the Tag.
@ -190,7 +190,7 @@ class Tag(TableObject):
""" """
self.__priority = priority self.__priority = priority
def get_priority(self) : def get_priority(self):
""" """
Return the priority of the Tag. Return the priority of the Tag.