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
|
||||
"""
|
||||
|
||||
if self.rectangle == None:
|
||||
if self.rectangle is None:
|
||||
self.rectangle = (0,0,100,100)
|
||||
self.rectangle = (value,
|
||||
self.rectangle[1],
|
||||
@ -242,7 +242,7 @@ class EditMediaRef(EditReference):
|
||||
@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 = (self.rectangle[0],
|
||||
value,
|
||||
@ -259,7 +259,7 @@ class EditMediaRef(EditReference):
|
||||
@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 = (self.rectangle[0],
|
||||
self.rectangle[1],
|
||||
@ -276,7 +276,7 @@ class EditMediaRef(EditReference):
|
||||
@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 = (self.rectangle[0],
|
||||
self.rectangle[1],
|
||||
@ -293,7 +293,7 @@ class EditMediaRef(EditReference):
|
||||
there is no selection
|
||||
"""
|
||||
|
||||
if self.rectangle != None:
|
||||
if self.rectangle is not None:
|
||||
return self.rectangle[0]
|
||||
else:
|
||||
return 0
|
||||
@ -307,7 +307,7 @@ class EditMediaRef(EditReference):
|
||||
there is no selection
|
||||
"""
|
||||
|
||||
if self.rectangle != None:
|
||||
if self.rectangle is not None:
|
||||
return self.rectangle[1]
|
||||
else:
|
||||
return 0
|
||||
@ -321,7 +321,7 @@ class EditMediaRef(EditReference):
|
||||
there is no selection
|
||||
"""
|
||||
|
||||
if self.rectangle != None:
|
||||
if self.rectangle is not None:
|
||||
return self.rectangle[2]
|
||||
else:
|
||||
return 100
|
||||
@ -335,7 +335,7 @@ class EditMediaRef(EditReference):
|
||||
there is no selection
|
||||
"""
|
||||
|
||||
if self.rectangle != None:
|
||||
if self.rectangle is not None:
|
||||
return self.rectangle[3]
|
||||
else:
|
||||
return 100
|
||||
@ -346,7 +346,7 @@ class EditMediaRef(EditReference):
|
||||
"""
|
||||
|
||||
path = self.source.get_path()
|
||||
if path == None:
|
||||
if path is None:
|
||||
self.subpixmap.hide()
|
||||
else:
|
||||
try:
|
||||
|
@ -1417,7 +1417,7 @@ def make_gui_option(option, tooltips, dbstate, uistate, track):
|
||||
label = True
|
||||
pmgr = gen.plug.PluginManager.get_instance()
|
||||
external_options = pmgr.get_external_opt_dict()
|
||||
if tooltips == None:
|
||||
if tooltips is None:
|
||||
tooltips = gtk.Tooltips()
|
||||
elif type(tooltips) == type(""):
|
||||
msg = tooltips
|
||||
|
@ -118,7 +118,7 @@ def get_quick_report_list(qv_category=None):
|
||||
names = []
|
||||
pmgr = PluginManager.get_instance()
|
||||
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)
|
||||
return names
|
||||
|
||||
|
@ -192,9 +192,9 @@ class AgeStatsGramplet(Gramplet):
|
||||
text = (text + (fill * width))[:width]
|
||||
elif align == "right":
|
||||
text = ((fill * width) + text)[-width:]
|
||||
if borders[0] != None:
|
||||
if borders[0] is not None:
|
||||
text = borders[0] + text
|
||||
if borders[1] != None:
|
||||
if borders[1] is not None:
|
||||
text = text + borders[1]
|
||||
return text
|
||||
|
||||
|
@ -193,7 +193,7 @@ class DataEntryGramplet(Gramplet):
|
||||
label.set_text("%s: " % text)
|
||||
label.set_width_chars(self.de_column_width)
|
||||
label.set_alignment(1.0, 0.5)
|
||||
if choices == None:
|
||||
if choices is None:
|
||||
self.de_widgets[pos] = gtk.Entry()
|
||||
if 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):
|
||||
""" 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
|
||||
ref_list = object.get_event_ref_list()
|
||||
# look for a match, and possible correction
|
||||
@ -321,7 +321,7 @@ class DataEntryGramplet(Gramplet):
|
||||
return (1, event)
|
||||
|
||||
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.set_type(gen.lib.EventType(type))
|
||||
if date:
|
||||
@ -408,7 +408,7 @@ class DataEntryGramplet(Gramplet):
|
||||
pass
|
||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_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."))
|
||||
return
|
||||
elif gender == gen.lib.Person.UNKNOWN: # unknown
|
||||
@ -416,7 +416,7 @@ class DataEntryGramplet(Gramplet):
|
||||
return
|
||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_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."))
|
||||
return
|
||||
elif (gender == gen.lib.Person.UNKNOWN and
|
||||
@ -425,12 +425,12 @@ class DataEntryGramplet(Gramplet):
|
||||
return
|
||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_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."))
|
||||
return
|
||||
elif self.de_widgets["NPRelation"].get_active() == self.AS_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."))
|
||||
return
|
||||
# Start the transaction: ------------------------------------------------------------
|
||||
@ -470,14 +470,14 @@ class DataEntryGramplet(Gramplet):
|
||||
fam_husband_handle = family.get_father_handle()
|
||||
fam_wife_handle = family.get_mother_handle()
|
||||
# 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
|
||||
family.set_mother_handle(person.get_handle())
|
||||
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
||||
person.add_family_handle(family.get_handle())
|
||||
added = True
|
||||
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
|
||||
family.set_father_handle(person.get_handle())
|
||||
family.set_relationship(gen.lib.FamilyRelType.MARRIED)
|
||||
@ -513,7 +513,7 @@ class DataEntryGramplet(Gramplet):
|
||||
fam_wife_handle = family.get_mother_handle()
|
||||
if current_person.get_handle() == fam_husband_handle:
|
||||
# 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:
|
||||
# add the person
|
||||
family.set_mother_handle(person.get_handle())
|
||||
@ -531,7 +531,7 @@ class DataEntryGramplet(Gramplet):
|
||||
break
|
||||
elif current_person.get_handle() == fam_wife_handle:
|
||||
# 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:
|
||||
# add the person
|
||||
family.set_father_handle(person.get_handle())
|
||||
|
@ -56,7 +56,7 @@ class DescendantGramplet(Gramplet):
|
||||
self.update()
|
||||
|
||||
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."))
|
||||
return
|
||||
self.set_text("")
|
||||
|
@ -297,7 +297,7 @@ class FanChartWidget(gtk.Widget):
|
||||
cr.set_line_width(3)
|
||||
cr.stroke()
|
||||
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,
|
||||
start, stop)
|
||||
|
||||
@ -452,13 +452,13 @@ class FanChartWidget(gtk.Widget):
|
||||
|
||||
def on_mouse_up(self, widget, event):
|
||||
# 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.last_x, self.last_y = None, None
|
||||
return True
|
||||
|
||||
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
|
||||
cx = w/2
|
||||
cy = h/2
|
||||
@ -502,7 +502,7 @@ class FanChartWidget(gtk.Widget):
|
||||
selected = p
|
||||
break
|
||||
# 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:
|
||||
# right mouse
|
||||
if event.button == 3 and self.context_popup_callback:
|
||||
@ -556,7 +556,7 @@ class FanChartGramplet(Gramplet):
|
||||
if person:
|
||||
m = self.get_parent(person, "female")
|
||||
f = self.get_parent(person, "male")
|
||||
return m != None or f != None
|
||||
return not m is f is None
|
||||
return False
|
||||
|
||||
def have_children(self, person):
|
||||
|
@ -75,7 +75,7 @@ class WhatNextGramplet(Gramplet):
|
||||
def main(self):
|
||||
|
||||
default_person = self.dbstate.db.get_default_person()
|
||||
if default_person == None:
|
||||
if default_person is None:
|
||||
self.set_text(_("No Home Person set."))
|
||||
return
|
||||
|
||||
|
@ -125,7 +125,7 @@ class EniroSVMapService(MapService):
|
||||
# 54 33' 0" < lat < 66 9' 0", 54.55 and 69.05
|
||||
# 8 3' 0" < long < 24 9' 0", 8.05 and 24.15
|
||||
latitude, longitude = self._lat_lon(place)
|
||||
if latitude == None or longitude == None:
|
||||
if latitude is None or longitude is None:
|
||||
coord_ok = False
|
||||
else:
|
||||
latitude = float(latitude)
|
||||
|
@ -115,7 +115,7 @@ class ReferenceMapTest (GrampsDbBaseTest):
|
||||
self._db.remove_person(person.get_handle(),tran)
|
||||
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()) ]
|
||||
|
||||
|
@ -85,7 +85,7 @@ class GrampsDbBaseTest(unittest.TestCase):
|
||||
|
||||
tran = self._db.transaction_begin()
|
||||
source = RelLib.Source()
|
||||
if repos != None:
|
||||
if repos is not None:
|
||||
repo_ref = RelLib.RepoRef()
|
||||
repo_ref.set_reference_handle(repos.get_handle())
|
||||
source.add_repo_reference(repo_ref)
|
||||
|
Loading…
Reference in New Issue
Block a user