Replace "== None" and "!= None" with "is None" and "is not None", respectively
svn: r12098
This commit is contained in:
parent
36fcdac888
commit
2671a8cd50
@ -225,7 +225,7 @@ class EditMediaRef(EditReference):
|
|||||||
@param value: the first corner x coordinate of the subsection in int
|
@param value: the first corner x coordinate of the subsection in int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle == None:
|
if self.rectangle is None:
|
||||||
self.rectangle = (0,0,100,100)
|
self.rectangle = (0,0,100,100)
|
||||||
self.rectangle = (value,
|
self.rectangle = (value,
|
||||||
self.rectangle[1],
|
self.rectangle[1],
|
||||||
@ -242,7 +242,7 @@ class EditMediaRef(EditReference):
|
|||||||
@param value: the first corner y coordinate of the subsection in int
|
@param value: the first corner y coordinate of the subsection in int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle == None:
|
if self.rectangle is None:
|
||||||
self.rectangle = (0,0,100,100)
|
self.rectangle = (0,0,100,100)
|
||||||
self.rectangle = (self.rectangle[0],
|
self.rectangle = (self.rectangle[0],
|
||||||
value,
|
value,
|
||||||
@ -259,7 +259,7 @@ class EditMediaRef(EditReference):
|
|||||||
@param value: the second corner x coordinate of the subsection in int
|
@param value: the second corner x coordinate of the subsection in int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle == None:
|
if self.rectangle is None:
|
||||||
self.rectangle = (0,0,100,100)
|
self.rectangle = (0,0,100,100)
|
||||||
self.rectangle = (self.rectangle[0],
|
self.rectangle = (self.rectangle[0],
|
||||||
self.rectangle[1],
|
self.rectangle[1],
|
||||||
@ -276,7 +276,7 @@ class EditMediaRef(EditReference):
|
|||||||
@param value: the second corner y coordinate of the subsection in int
|
@param value: the second corner y coordinate of the subsection in int
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle == None:
|
if self.rectangle is None:
|
||||||
self.rectangle = (0,0,100,100)
|
self.rectangle = (0,0,100,100)
|
||||||
self.rectangle = (self.rectangle[0],
|
self.rectangle = (self.rectangle[0],
|
||||||
self.rectangle[1],
|
self.rectangle[1],
|
||||||
@ -293,7 +293,7 @@ class EditMediaRef(EditReference):
|
|||||||
there is no selection
|
there is no selection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle != None:
|
if self.rectangle is not None:
|
||||||
return self.rectangle[0]
|
return self.rectangle[0]
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
@ -307,7 +307,7 @@ class EditMediaRef(EditReference):
|
|||||||
there is no selection
|
there is no selection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle != None:
|
if self.rectangle is not None:
|
||||||
return self.rectangle[1]
|
return self.rectangle[1]
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
@ -321,7 +321,7 @@ class EditMediaRef(EditReference):
|
|||||||
there is no selection
|
there is no selection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle != None:
|
if self.rectangle is not None:
|
||||||
return self.rectangle[2]
|
return self.rectangle[2]
|
||||||
else:
|
else:
|
||||||
return 100
|
return 100
|
||||||
@ -335,7 +335,7 @@ class EditMediaRef(EditReference):
|
|||||||
there is no selection
|
there is no selection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.rectangle != None:
|
if self.rectangle is not None:
|
||||||
return self.rectangle[3]
|
return self.rectangle[3]
|
||||||
else:
|
else:
|
||||||
return 100
|
return 100
|
||||||
@ -346,7 +346,7 @@ class EditMediaRef(EditReference):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
path = self.source.get_path()
|
path = self.source.get_path()
|
||||||
if path == None:
|
if path is None:
|
||||||
self.subpixmap.hide()
|
self.subpixmap.hide()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -1417,7 +1417,7 @@ def make_gui_option(option, tooltips, dbstate, uistate, track):
|
|||||||
label = True
|
label = True
|
||||||
pmgr = gen.plug.PluginManager.get_instance()
|
pmgr = gen.plug.PluginManager.get_instance()
|
||||||
external_options = pmgr.get_external_opt_dict()
|
external_options = pmgr.get_external_opt_dict()
|
||||||
if tooltips == None:
|
if tooltips is None:
|
||||||
tooltips = gtk.Tooltips()
|
tooltips = gtk.Tooltips()
|
||||||
elif type(tooltips) == type(""):
|
elif type(tooltips) == type(""):
|
||||||
msg = tooltips
|
msg = tooltips
|
||||||
|
@ -118,7 +118,7 @@ def get_quick_report_list(qv_category=None):
|
|||||||
names = []
|
names = []
|
||||||
pmgr = PluginManager.get_instance()
|
pmgr = PluginManager.get_instance()
|
||||||
for item in pmgr.get_quick_report_list():
|
for item in pmgr.get_quick_report_list():
|
||||||
if qv_category == item[2] or qv_category == None:
|
if qv_category == item[2] or qv_category is None:
|
||||||
names.append(item[1:]) # (see below for item struct)
|
names.append(item[1:]) # (see below for item struct)
|
||||||
return names
|
return names
|
||||||
|
|
||||||
|
@ -192,9 +192,9 @@ class AgeStatsGramplet(Gramplet):
|
|||||||
text = (text + (fill * width))[:width]
|
text = (text + (fill * width))[:width]
|
||||||
elif align == "right":
|
elif align == "right":
|
||||||
text = ((fill * width) + text)[-width:]
|
text = ((fill * width) + text)[-width:]
|
||||||
if borders[0] != None:
|
if borders[0] is not None:
|
||||||
text = borders[0] + text
|
text = borders[0] + text
|
||||||
if borders[1] != None:
|
if borders[1] is not None:
|
||||||
text = text + borders[1]
|
text = text + borders[1]
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
label.set_text("%s: " % text)
|
label.set_text("%s: " % text)
|
||||||
label.set_width_chars(self.de_column_width)
|
label.set_width_chars(self.de_column_width)
|
||||||
label.set_alignment(1.0, 0.5)
|
label.set_alignment(1.0, 0.5)
|
||||||
if choices == None:
|
if choices is None:
|
||||||
self.de_widgets[pos] = gtk.Entry()
|
self.de_widgets[pos] = gtk.Entry()
|
||||||
if mark_dirty:
|
if mark_dirty:
|
||||||
self.de_widgets[pos].connect("changed", self.mark_dirty)
|
self.de_widgets[pos].connect("changed", self.mark_dirty)
|
||||||
@ -294,7 +294,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
|
|
||||||
def get_or_create_event(self, object, type, date, place):
|
def get_or_create_event(self, object, type, date, place):
|
||||||
""" Add or find a type event on object """
|
""" Add or find a type event on object """
|
||||||
if date == place == None: return (-1, None)
|
if date is place is None: return (-1, None)
|
||||||
# first, see if it exists
|
# first, see if it exists
|
||||||
ref_list = object.get_event_ref_list()
|
ref_list = object.get_event_ref_list()
|
||||||
# look for a match, and possible correction
|
# look for a match, and possible correction
|
||||||
@ -321,7 +321,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
return (1, event)
|
return (1, event)
|
||||||
|
|
||||||
def make_event(self, type, date, place):
|
def make_event(self, type, date, place):
|
||||||
if date == place == None: return None
|
if date is place is None: return None
|
||||||
event = gen.lib.Event()
|
event = gen.lib.Event()
|
||||||
event.set_type(gen.lib.EventType(type))
|
event.set_type(gen.lib.EventType(type))
|
||||||
if date:
|
if date:
|
||||||
@ -408,7 +408,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
pass
|
pass
|
||||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_PARENT:
|
elif self.de_widgets["NPRelation"].get_active() == self.AS_PARENT:
|
||||||
# "Add as a Parent"
|
# "Add as a Parent"
|
||||||
if current_person == None:
|
if current_person is None:
|
||||||
ErrorDialog(_("Please set an active person."), _("Can't add new person as a parent."))
|
ErrorDialog(_("Please set an active person."), _("Can't add new person as a parent."))
|
||||||
return
|
return
|
||||||
elif gender == gen.lib.Person.UNKNOWN: # unknown
|
elif gender == gen.lib.Person.UNKNOWN: # unknown
|
||||||
@ -416,7 +416,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
return
|
return
|
||||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_SPOUSE:
|
elif self.de_widgets["NPRelation"].get_active() == self.AS_SPOUSE:
|
||||||
# "Add as a Spouse"
|
# "Add as a Spouse"
|
||||||
if current_person == None:
|
if current_person is None:
|
||||||
ErrorDialog(_("Please set an active person."), _("Can't add new person as a spouse."))
|
ErrorDialog(_("Please set an active person."), _("Can't add new person as a spouse."))
|
||||||
return
|
return
|
||||||
elif (gender == gen.lib.Person.UNKNOWN and
|
elif (gender == gen.lib.Person.UNKNOWN and
|
||||||
@ -425,12 +425,12 @@ class DataEntryGramplet(Gramplet):
|
|||||||
return
|
return
|
||||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_SIBLING:
|
elif self.de_widgets["NPRelation"].get_active() == self.AS_SIBLING:
|
||||||
# "Add as a Sibling"
|
# "Add as a Sibling"
|
||||||
if current_person == None:
|
if current_person is None:
|
||||||
ErrorDialog(_("Please set an active person."), _("Can't add new person as a sibling."))
|
ErrorDialog(_("Please set an active person."), _("Can't add new person as a sibling."))
|
||||||
return
|
return
|
||||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_CHILD:
|
elif self.de_widgets["NPRelation"].get_active() == self.AS_CHILD:
|
||||||
# "Add as a Child"
|
# "Add as a Child"
|
||||||
if current_person == None:
|
if current_person is None:
|
||||||
ErrorDialog(_("Please set an active person."), _("Can't add new person as a child."))
|
ErrorDialog(_("Please set an active person."), _("Can't add new person as a child."))
|
||||||
return
|
return
|
||||||
# Start the transaction: ------------------------------------------------------------
|
# Start the transaction: ------------------------------------------------------------
|
||||||
@ -470,14 +470,14 @@ class DataEntryGramplet(Gramplet):
|
|||||||
fam_husband_handle = family.get_father_handle()
|
fam_husband_handle = family.get_father_handle()
|
||||||
fam_wife_handle = family.get_mother_handle()
|
fam_wife_handle = family.get_mother_handle()
|
||||||
# can we add person as wife?
|
# can we add person as wife?
|
||||||
if fam_wife_handle == None and person.get_gender() == gen.lib.Person.FEMALE:
|
if fam_wife_handle is None and person.get_gender() == gen.lib.Person.FEMALE:
|
||||||
# add the person
|
# add the person
|
||||||
family.set_mother_handle(person.get_handle())
|
family.set_mother_handle(person.get_handle())
|
||||||
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
||||||
person.add_family_handle(family.get_handle())
|
person.add_family_handle(family.get_handle())
|
||||||
added = True
|
added = True
|
||||||
break
|
break
|
||||||
elif fam_husband_handle == None and person.get_gender() == gen.lib.Person.MALE:
|
elif fam_husband_handle is None and person.get_gender() == gen.lib.Person.MALE:
|
||||||
# add the person
|
# add the person
|
||||||
family.set_father_handle(person.get_handle())
|
family.set_father_handle(person.get_handle())
|
||||||
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
||||||
@ -513,7 +513,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
fam_wife_handle = family.get_mother_handle()
|
fam_wife_handle = family.get_mother_handle()
|
||||||
if current_person.get_handle() == fam_husband_handle:
|
if current_person.get_handle() == fam_husband_handle:
|
||||||
# can we add person as wife?
|
# can we add person as wife?
|
||||||
if fam_wife_handle == None:
|
if fam_wife_handle is None:
|
||||||
if person.get_gender() == gen.lib.Person.FEMALE:
|
if person.get_gender() == gen.lib.Person.FEMALE:
|
||||||
# add the person
|
# add the person
|
||||||
family.set_mother_handle(person.get_handle())
|
family.set_mother_handle(person.get_handle())
|
||||||
@ -531,7 +531,7 @@ class DataEntryGramplet(Gramplet):
|
|||||||
break
|
break
|
||||||
elif current_person.get_handle() == fam_wife_handle:
|
elif current_person.get_handle() == fam_wife_handle:
|
||||||
# can we add person as husband?
|
# can we add person as husband?
|
||||||
if fam_husband_handle == None:
|
if fam_husband_handle is None:
|
||||||
if person.get_gender() == gen.lib.Person.MALE:
|
if person.get_gender() == gen.lib.Person.MALE:
|
||||||
# add the person
|
# add the person
|
||||||
family.set_father_handle(person.get_handle())
|
family.set_father_handle(person.get_handle())
|
||||||
|
@ -56,7 +56,7 @@ class DescendantGramplet(Gramplet):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
if self.dbstate.get_active_person() == None:
|
if self.dbstate.get_active_person() is None:
|
||||||
self.set_text(_("No Active Person selected."))
|
self.set_text(_("No Active Person selected."))
|
||||||
return
|
return
|
||||||
self.set_text("")
|
self.set_text("")
|
||||||
|
@ -297,7 +297,7 @@ class FanChartWidget(gtk.Widget):
|
|||||||
cr.set_line_width(3)
|
cr.set_line_width(3)
|
||||||
cr.stroke()
|
cr.stroke()
|
||||||
cr.set_line_width(1)
|
cr.set_line_width(1)
|
||||||
if self.last_x == None or self.last_y == None:
|
if self.last_x is None or self.last_y is None:
|
||||||
self.draw_text(cr, name, radius - self.pixels_per_generation/2,
|
self.draw_text(cr, name, radius - self.pixels_per_generation/2,
|
||||||
start, stop)
|
start, stop)
|
||||||
|
|
||||||
@ -452,13 +452,13 @@ class FanChartWidget(gtk.Widget):
|
|||||||
|
|
||||||
def on_mouse_up(self, widget, event):
|
def on_mouse_up(self, widget, event):
|
||||||
# Done with mouse movement
|
# Done with mouse movement
|
||||||
if self.last_x == None or self.last_y == None: return True
|
if self.last_x is None or self.last_y is None: return True
|
||||||
self.queue_draw()
|
self.queue_draw()
|
||||||
self.last_x, self.last_y = None, None
|
self.last_x, self.last_y = None, None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_mouse_move(self, widget, event):
|
def on_mouse_move(self, widget, event):
|
||||||
if self.last_x == None or self.last_y == None: return False
|
if self.last_x is None or self.last_y is None: return False
|
||||||
x, y, w, h = self.allocation
|
x, y, w, h = self.allocation
|
||||||
cx = w/2
|
cx = w/2
|
||||||
cy = h/2
|
cy = h/2
|
||||||
@ -502,7 +502,7 @@ class FanChartWidget(gtk.Widget):
|
|||||||
selected = p
|
selected = p
|
||||||
break
|
break
|
||||||
# Handle the click:
|
# Handle the click:
|
||||||
if selected == None: # clicked in open area, or center
|
if selected is None: # clicked in open area, or center
|
||||||
if radius < self.center:
|
if radius < self.center:
|
||||||
# right mouse
|
# right mouse
|
||||||
if event.button == 3 and self.context_popup_callback:
|
if event.button == 3 and self.context_popup_callback:
|
||||||
@ -556,7 +556,7 @@ class FanChartGramplet(Gramplet):
|
|||||||
if person:
|
if person:
|
||||||
m = self.get_parent(person, "female")
|
m = self.get_parent(person, "female")
|
||||||
f = self.get_parent(person, "male")
|
f = self.get_parent(person, "male")
|
||||||
return m != None or f != None
|
return not m is f is None
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def have_children(self, person):
|
def have_children(self, person):
|
||||||
|
@ -75,7 +75,7 @@ class WhatNextGramplet(Gramplet):
|
|||||||
def main(self):
|
def main(self):
|
||||||
|
|
||||||
default_person = self.dbstate.db.get_default_person()
|
default_person = self.dbstate.db.get_default_person()
|
||||||
if default_person == None:
|
if default_person is None:
|
||||||
self.set_text(_("No Home Person set."))
|
self.set_text(_("No Home Person set."))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ class EniroSVMapService(MapService):
|
|||||||
# 54 33' 0" < lat < 66 9' 0", 54.55 and 69.05
|
# 54 33' 0" < lat < 66 9' 0", 54.55 and 69.05
|
||||||
# 8 3' 0" < long < 24 9' 0", 8.05 and 24.15
|
# 8 3' 0" < long < 24 9' 0", 8.05 and 24.15
|
||||||
latitude, longitude = self._lat_lon(place)
|
latitude, longitude = self._lat_lon(place)
|
||||||
if latitude == None or longitude == None:
|
if latitude is None or longitude is None:
|
||||||
coord_ok = False
|
coord_ok = False
|
||||||
else:
|
else:
|
||||||
latitude = float(latitude)
|
latitude = float(latitude)
|
||||||
|
@ -115,7 +115,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
|||||||
self._db.remove_person(person.get_handle(),tran)
|
self._db.remove_person(person.get_handle(),tran)
|
||||||
self._db.transaction_commit(tran, "Del Person")
|
self._db.transaction_commit(tran, "Del Person")
|
||||||
|
|
||||||
assert self._db.get_person_from_handle(person.get_handle()) == None
|
assert self._db.get_person_from_handle(person.get_handle()) is None
|
||||||
|
|
||||||
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ]
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class GrampsDbBaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
tran = self._db.transaction_begin()
|
tran = self._db.transaction_begin()
|
||||||
source = RelLib.Source()
|
source = RelLib.Source()
|
||||||
if repos != None:
|
if repos is not None:
|
||||||
repo_ref = RelLib.RepoRef()
|
repo_ref = RelLib.RepoRef()
|
||||||
repo_ref.set_reference_handle(repos.get_handle())
|
repo_ref.set_reference_handle(repos.get_handle())
|
||||||
source.add_repo_reference(repo_ref)
|
source.add_repo_reference(repo_ref)
|
||||||
|
Loading…
Reference in New Issue
Block a user