Remove unneeded line continuations and tidy up
svn: r16481
This commit is contained in:
parent
bfa5309cd7
commit
cc5b37c8bc
@ -287,7 +287,8 @@ class ScratchAddress(ScratchObjWrapper):
|
||||
self._value = "%s %s %s %s" % (self._obj.get_street(),
|
||||
self._obj.get_city(),
|
||||
self._obj.get_state(),
|
||||
self._obj.get_country())
|
||||
self._obj.get_country(),
|
||||
)
|
||||
|
||||
class ScratchLocation(ScratchObjWrapper):
|
||||
|
||||
@ -300,7 +301,8 @@ class ScratchLocation(ScratchObjWrapper):
|
||||
self._type = _("Location")
|
||||
self._value = "%s %s %s" % (self._obj.get_city(),
|
||||
self._obj.get_state(),
|
||||
self._obj.get_country())
|
||||
self._obj.get_country(),
|
||||
)
|
||||
|
||||
class ScratchEvent(ScratchHandleWrapper):
|
||||
|
||||
@ -446,7 +448,7 @@ class ScratchSourceRef(ScratchObjWrapper):
|
||||
self._title = base.get_title()
|
||||
notelist = map(self._db.get_note_from_handle,
|
||||
self._obj.get_note_list())
|
||||
srctxtlist = [ note for note in notelist
|
||||
srctxtlist = [note for note in notelist
|
||||
if note.get_type() == gen.lib.NoteType.SOURCE_TEXT]
|
||||
page = self._obj.get_page()
|
||||
if not page:
|
||||
@ -1076,7 +1078,7 @@ class ScratchPadListView(object):
|
||||
if dragtype in self._target_type_to_wrapper_class_map:
|
||||
possible_wrappers = [dragtype]
|
||||
else:
|
||||
possible_wrappers = [target for target in context.targets \
|
||||
possible_wrappers = [target for target in context.targets
|
||||
if target in self._target_type_to_wrapper_class_map]
|
||||
|
||||
if len(possible_wrappers) == 0:
|
||||
|
@ -296,8 +296,10 @@ class ArgParser(object):
|
||||
new_value = safe_eval(new_value)
|
||||
config.set(setting_name, new_value)
|
||||
print >> sys.stderr, " New Gramps config " \
|
||||
"setting: %s:%s" % (setting_name, \
|
||||
repr(config.get(setting_name)))
|
||||
"setting: %s:%s" % (
|
||||
setting_name,
|
||||
repr(config.get(setting_name))
|
||||
)
|
||||
else:
|
||||
need_to_quit = True
|
||||
else:
|
||||
|
@ -144,7 +144,8 @@ class EditChildRef(EditSecondary):
|
||||
"""
|
||||
notebook = gtk.Notebook()
|
||||
|
||||
self.srcref_list = SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj)
|
||||
self.srcref_list = SourceEmbedList(
|
||||
self.dbstate, self.uistate, self.track, self.obj)
|
||||
self._add_tab(notebook, self.srcref_list)
|
||||
self.track_ref_for_deletion("srcref_list")
|
||||
|
||||
@ -201,9 +202,9 @@ class EditChildRef(EditSecondary):
|
||||
self.close()
|
||||
|
||||
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)):
|
||||
return True
|
||||
else:
|
||||
|
@ -99,8 +99,9 @@ class EditEvent(EditPrimary):
|
||||
return dialog_title
|
||||
|
||||
def get_custom_events(self):
|
||||
return self.dbstate.db.get_person_event_types() + \
|
||||
return (self.dbstate.db.get_person_event_types() +
|
||||
self.dbstate.db.get_family_event_types()
|
||||
)
|
||||
|
||||
def _local_init(self):
|
||||
self.width_key = 'interface.event-width'
|
||||
|
@ -263,5 +263,5 @@ class EditFamilyEventRef(EditEventRef):
|
||||
self.add_event = self.db.add_family_event
|
||||
|
||||
def get_custom_events(self):
|
||||
return [ gen.lib.EventType((gen.lib.EventType.CUSTOM,val)) \
|
||||
return [gen.lib.EventType((gen.lib.EventType.CUSTOM,val))
|
||||
for val in self.dbstate.db.get_family_event_types()]
|
||||
|
@ -240,9 +240,9 @@ class ChildEmbedList(EmbeddedList):
|
||||
|
||||
def share_button_clicked(self, obj=None):
|
||||
# it only makes sense to skip those who are already in the family
|
||||
skip_list = [self.family.get_father_handle(), \
|
||||
self.family.get_mother_handle()] + \
|
||||
[x.ref for x in self.family.get_child_ref_list() ]
|
||||
skip_list = [self.family.get_father_handle(),
|
||||
self.family.get_mother_handle()]
|
||||
skip_list.extend(x.ref for x in self.family.get_child_ref_list())
|
||||
|
||||
sel = SelectPerson(self.dbstate, self.uistate, self.track,
|
||||
_("Select Child"), skip=skip_list)
|
||||
@ -432,9 +432,11 @@ class EditFamily(EditPrimary):
|
||||
# look for the scenerio of a child and no parents on a new
|
||||
# family
|
||||
|
||||
if self.added and self.obj.get_father_handle() is None and \
|
||||
self.obj.get_mother_handle() is None and \
|
||||
len(self.obj.get_child_ref_list()) == 1:
|
||||
if (self.added and
|
||||
not self.obj.get_father_handle() and
|
||||
not self.obj.get_mother_handle() and
|
||||
len(self.obj.get_child_ref_list()) == 1):
|
||||
|
||||
self.add_parent = True
|
||||
if not config.get('preferences.family-warn'):
|
||||
for i in self.hidden:
|
||||
@ -689,8 +691,8 @@ class EditFamily(EditPrimary):
|
||||
mhandle = self.obj.get_mother_handle()
|
||||
self.update_mother(mhandle)
|
||||
|
||||
self.phandles = [mhandle, fhandle] + \
|
||||
[ x.ref for x in self.obj.get_child_ref_list()]
|
||||
self.phandles = [mhandle, fhandle]
|
||||
self.phandles.extend(x.ref for x in self.obj.get_child_ref_list())
|
||||
|
||||
self.phandles = filter(None, self.phandles)
|
||||
|
||||
@ -988,9 +990,10 @@ class EditFamily(EditPrimary):
|
||||
self.db.commit_person(person, trans)
|
||||
|
||||
def object_is_empty(self):
|
||||
return self.obj.get_father_handle() is None and \
|
||||
self.obj.get_mother_handle() is None and \
|
||||
return (not self.obj.get_father_handle() and
|
||||
not self.obj.get_mother_handle() and
|
||||
len(self.obj.get_child_ref_list()) == 0
|
||||
)
|
||||
|
||||
def save(self, *obj):
|
||||
try:
|
||||
@ -1173,9 +1176,9 @@ class EditFamily(EditPrimary):
|
||||
return name
|
||||
|
||||
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)):
|
||||
return True
|
||||
else:
|
||||
|
@ -344,36 +344,36 @@ class DeleteMediaQuery(object):
|
||||
|
||||
for handle in person_list:
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
new_list = [ photo for photo in person.get_media_list() \
|
||||
if photo.get_reference_handle() != self.media_handle ]
|
||||
new_list = [photo for photo in person.get_media_list()
|
||||
if photo.get_reference_handle() != self.media_handle]
|
||||
person.set_media_list(new_list)
|
||||
self.db.commit_person(person, trans)
|
||||
|
||||
for handle in family_list:
|
||||
family = self.db.get_family_from_handle(handle)
|
||||
new_list = [ photo for photo in family.get_media_list() \
|
||||
if photo.get_reference_handle() != self.media_handle ]
|
||||
new_list = [photo for photo in family.get_media_list()
|
||||
if photo.get_reference_handle() != self.media_handle]
|
||||
family.set_media_list(new_list)
|
||||
self.db.commit_family(family, trans)
|
||||
|
||||
for handle in event_list:
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
new_list = [ photo for photo in event.get_media_list() \
|
||||
if photo.get_reference_handle() != self.media_handle ]
|
||||
new_list = [photo for photo in event.get_media_list()
|
||||
if photo.get_reference_handle() != self.media_handle]
|
||||
event.set_media_list(new_list)
|
||||
self.db.commit_event(event, trans)
|
||||
|
||||
for handle in place_list:
|
||||
place = self.db.get_place_from_handle(handle)
|
||||
new_list = [ photo for photo in place.get_media_list() \
|
||||
if photo.get_reference_handle() != self.media_handle ]
|
||||
new_list = [photo for photo in place.get_media_list()
|
||||
if photo.get_reference_handle() != self.media_handle]
|
||||
place.set_media_list(new_list)
|
||||
self.db.commit_place(place, trans)
|
||||
|
||||
for handle in source_list:
|
||||
source = self.db.get_source_from_handle(handle)
|
||||
new_list = [ photo for photo in source.get_media_list() \
|
||||
if photo.get_reference_handle() != self.media_handle ]
|
||||
new_list = [photo for photo in source.get_media_list()
|
||||
if photo.get_reference_handle() != self.media_handle]
|
||||
source.set_media_list(new_list)
|
||||
self.db.commit_source(source, trans)
|
||||
|
||||
|
@ -685,11 +685,11 @@ class EditPerson(EditPrimary):
|
||||
"""
|
||||
Override base class, make inactive home action if not needed.
|
||||
"""
|
||||
if self.dbstate.db.get_default_person() and \
|
||||
self.obj.get_handle() == \
|
||||
self.dbstate.db.get_default_person().get_handle():
|
||||
if (self.dbstate.db.get_default_person() and
|
||||
self.obj.get_handle() ==
|
||||
self.dbstate.db.get_default_person().get_handle()):
|
||||
self.home_action.set_sensitive(False)
|
||||
else :
|
||||
else:
|
||||
self.home_action.set_sensitive(True)
|
||||
|
||||
def _make_active(self, obj):
|
||||
|
@ -41,7 +41,7 @@ def process_file( imagefile, image_width, image_height, map_x, map_y, map_width,
|
||||
tile_x = map_x + tile_width * x
|
||||
tile_y = map_y - tile_width * y
|
||||
print "location: %dx%d" % (tile_x,tile_y)
|
||||
tile_defines.append("self.zoom_map.add_map_source('%s', %d,%d, %d,%d, %d,%d)" %\
|
||||
tile_defines.append("self.zoom_map.add_map_source('%s', %d,%d, %d,%d, %d,%d)" %
|
||||
(outfile,tile_x,tile_y,tile_width,tile_width,tile_size,tile_size))
|
||||
x = x + 1
|
||||
y = y + 1
|
||||
|
@ -134,7 +134,7 @@ class WebCalReport(Report):
|
||||
self.anniv = mgobn('anniversaries')
|
||||
self.home_link = mgobn('home_link')
|
||||
|
||||
self.month_notes = [mgobn('note_' + month) \
|
||||
self.month_notes = [mgobn('note_' + month)
|
||||
for month in ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul',
|
||||
'aug', 'sep', 'oct', 'nov', 'dec']]
|
||||
|
||||
|
@ -77,7 +77,7 @@ def getTestSuites(loc=gramps_root):
|
||||
test_suites = []
|
||||
perf_suites = []
|
||||
# note that test_mod and match_mod modify passed-in lists
|
||||
paths = [(path,files) for path,dirs,files in os.walk(loc) \
|
||||
paths = [(path,files) for path,dirs,files in os.walk(loc)
|
||||
if test_mod(path,dirs) and match_mod(files)]
|
||||
|
||||
## NO -- see explanation below
|
||||
|
@ -203,25 +203,25 @@ class DjangoInterface(object):
|
||||
|
||||
def get_child_ref_list(self, family):
|
||||
obj_type = ContentType.objects.get_for_model(family)
|
||||
childrefs = models.ChildRef.objects.filter(object_id=family.id, \
|
||||
childrefs = models.ChildRef.objects.filter(object_id=family.id,
|
||||
object_type=obj_type).order_by("order")
|
||||
return map(self.pack_child_ref, childrefs)
|
||||
|
||||
def get_source_ref_list(self, obj):
|
||||
obj_type = ContentType.objects.get_for_model(obj)
|
||||
sourcerefs = models.SourceRef.objects.filter(object_id=obj.id, \
|
||||
sourcerefs = models.SourceRef.objects.filter(object_id=obj.id,
|
||||
object_type=obj_type).order_by("order")
|
||||
return map(self.pack_source_ref, sourcerefs)
|
||||
|
||||
def get_event_refs(self, obj, order="order"):
|
||||
obj_type = ContentType.objects.get_for_model(obj)
|
||||
eventrefs = models.EventRef.objects.filter(object_id=obj.id, \
|
||||
eventrefs = models.EventRef.objects.filter(object_id=obj.id,
|
||||
object_type=obj_type).order_by(order)
|
||||
return eventrefs
|
||||
|
||||
def get_event_ref_list(self, obj):
|
||||
obj_type = ContentType.objects.get_for_model(obj)
|
||||
eventrefs = models.EventRef.objects.filter(object_id=obj.id, \
|
||||
eventrefs = models.EventRef.objects.filter(object_id=obj.id,
|
||||
object_type=obj_type).order_by("order")
|
||||
return map(self.pack_event_ref, eventrefs)
|
||||
|
||||
|
@ -115,7 +115,7 @@ class SortHeaders:
|
||||
always be present.
|
||||
"""
|
||||
params.update(self.additional_params)
|
||||
return '?%s' % '&'.join(['%s=%s' % (param, value) \
|
||||
return '?%s' % '&'.join(['%s=%s' % (param, value)
|
||||
for param, value in params.items()])
|
||||
|
||||
def get_order_by(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user