* src/Marriage.py: pychecker fixes
* src/RelLib.py: pychecker fixes * src/SelectChild.py: pychecker fixes * src/SelectObject: pychecker fixes * src/SourceView.py: pychecker fixes * src/Sources.py: pychecker fixes * src/StyleEditor.py: pychecker fixes * src/TarFile.py: pychecker fixes * src/TipOfDay.py: pychecker fixes * src/Utils.py: pychecker fixes * src/WriteXML.py: pychecker fixes svn: r3480
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
2004-08-22 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/Marriage.py: pychecker fixes
|
||||||
|
* src/RelLib.py: pychecker fixes
|
||||||
|
* src/SelectChild.py: pychecker fixes
|
||||||
|
* src/SelectObject: pychecker fixes
|
||||||
|
* src/SourceView.py: pychecker fixes
|
||||||
|
* src/Sources.py: pychecker fixes
|
||||||
|
* src/StyleEditor.py: pychecker fixes
|
||||||
|
* src/TarFile.py: pychecker fixes
|
||||||
|
* src/TipOfDay.py: pychecker fixes
|
||||||
|
* src/Utils.py: pychecker fixes
|
||||||
|
* src/WriteXML.py: pychecker fixes
|
||||||
|
|
||||||
2004-08-23 Tim Waugh <twaugh@redhat.com>
|
2004-08-23 Tim Waugh <twaugh@redhat.com>
|
||||||
|
|
||||||
* src/WriteGedcom.py (GedcomWriter.write_families): Write families
|
* src/WriteGedcom.py (GedcomWriter.write_families): Write families
|
||||||
|
@@ -215,17 +215,17 @@ class Marriage:
|
|||||||
place_list.sort()
|
place_list.sort()
|
||||||
AutoComp.fill_combo(self.lds_place, place_list)
|
AutoComp.fill_combo(self.lds_place, place_list)
|
||||||
|
|
||||||
ord = self.family.get_lds_sealing()
|
lds_ord = self.family.get_lds_sealing()
|
||||||
if ord:
|
if lds_ord:
|
||||||
if ord.get_place_handle():
|
if lds_ord.get_place_handle():
|
||||||
self.lds_place.child.set_text(ord.get_place_handle().get_title())
|
self.lds_place.child.set_text(lds_ord.get_place_handle().get_title())
|
||||||
self.lds_date.set_text(ord.get_date())
|
self.lds_date.set_text(lds_ord.get_date())
|
||||||
if ord.get_temple() != "":
|
if lds_ord.get_temple() != "":
|
||||||
name = const.lds_temple_to_abrev[ord.get_temple()]
|
name = const.lds_temple_to_abrev[lds_ord.get_temple()]
|
||||||
else:
|
else:
|
||||||
name = ""
|
name = ""
|
||||||
self.lds_temple.child.set_text(name)
|
self.lds_temple.child.set_text(name)
|
||||||
self.seal_stat = ord.get_status()
|
self.seal_stat = lds_ord.get_status()
|
||||||
else:
|
else:
|
||||||
self.lds_temple.child.set_text("")
|
self.lds_temple.child.set_text("")
|
||||||
self.lds_place.child.set_text("")
|
self.lds_place.child.set_text("")
|
||||||
@@ -236,7 +236,7 @@ class Marriage:
|
|||||||
|
|
||||||
self.build_seal_menu()
|
self.build_seal_menu()
|
||||||
|
|
||||||
if ord:
|
if lds_ord:
|
||||||
Utils.bold_label(self.lds_label)
|
Utils.bold_label(self.lds_label)
|
||||||
else:
|
else:
|
||||||
Utils.unbold_label(self.lds_label)
|
Utils.unbold_label(self.lds_label)
|
||||||
@@ -344,52 +344,52 @@ class Marriage:
|
|||||||
self.seal_stat = obj.get_data("val")
|
self.seal_stat = obj.get_data("val")
|
||||||
|
|
||||||
def lds_src_clicked(self,obj):
|
def lds_src_clicked(self,obj):
|
||||||
ord = self.family.get_lds_sealing()
|
lds_ord = self.family.get_lds_sealing()
|
||||||
if ord == None:
|
if lds_ord == None:
|
||||||
ord = RelLib.LdsOrd()
|
lds_ord = RelLib.LdsOrd()
|
||||||
self.family.set_lds_sealing(ord)
|
self.family.set_lds_sealing(lds_ord)
|
||||||
Sources.SourceSelector(ord.get_source_references(),self,self.window)
|
Sources.SourceSelector(lds_ord.get_source_references(),self,self.window)
|
||||||
|
|
||||||
def lds_note_clicked(self,obj):
|
def lds_note_clicked(self,obj):
|
||||||
import NoteEdit
|
import NoteEdit
|
||||||
ord = self.family.get_lds_sealing()
|
lds_ord = self.family.get_lds_sealing()
|
||||||
if ord == None:
|
if lds_ord == None:
|
||||||
ord = RelLib.LdsOrd()
|
lds_ord = RelLib.LdsOrd()
|
||||||
self.family.set_lds_sealing(ord)
|
self.family.set_lds_sealing(lds_ord)
|
||||||
NoteEdit.NoteEditor(ord,self,self.window)
|
NoteEdit.NoteEditor(lds_ord,self,self.window)
|
||||||
|
|
||||||
def on_up_clicked(self,obj):
|
def on_up_clicked(self,obj):
|
||||||
model,iter = self.etree.get_selected()
|
model,node = self.etree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
row = self.etree.get_row(iter)
|
row = self.etree.get_row(node)
|
||||||
if row != 0:
|
if row != 0:
|
||||||
self.etree.select_row(row-1)
|
self.etree.select_row(row-1)
|
||||||
|
|
||||||
def on_down_clicked(self,obj):
|
def on_down_clicked(self,obj):
|
||||||
model,iter = self.etree.get_selected()
|
model,node = self.etree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
row = self.etree.get_row(iter)
|
row = self.etree.get_row(node)
|
||||||
self.etree.select_row(row+1)
|
self.etree.select_row(row+1)
|
||||||
|
|
||||||
def on_attr_up_clicked(self,obj):
|
def on_attr_up_clicked(self,obj):
|
||||||
model,iter = self.atree.get_selected()
|
model,node = self.atree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
row = self.atree.get_row(iter)
|
row = self.atree.get_row(node)
|
||||||
if row != 0:
|
if row != 0:
|
||||||
self.atree.select_row(row-1)
|
self.atree.select_row(row-1)
|
||||||
|
|
||||||
def on_attr_down_clicked(self,obj):
|
def on_attr_down_clicked(self,obj):
|
||||||
model,iter = self.atree.get_selected()
|
model,node = self.atree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
row = self.atree.get_row(iter)
|
row = self.atree.get_row(node)
|
||||||
self.atree.select_row(row+1)
|
self.atree.select_row(row+1)
|
||||||
|
|
||||||
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
||||||
@@ -467,8 +467,8 @@ class Marriage:
|
|||||||
self.amap = {}
|
self.amap = {}
|
||||||
for attr in self.alist:
|
for attr in self.alist:
|
||||||
d = [const.display_fattr(attr.get_type()),attr.get_value()]
|
d = [const.display_fattr(attr.get_type()),attr.get_value()]
|
||||||
iter = self.atree.add(d,attr)
|
node = self.atree.add(d,attr)
|
||||||
self.amap[str(attr)] = iter
|
self.amap[str(attr)] = node
|
||||||
if self.alist:
|
if self.alist:
|
||||||
self.atree.select_row(0)
|
self.atree.select_row(0)
|
||||||
Utils.bold_label(self.attr_label)
|
Utils.bold_label(self.attr_label)
|
||||||
@@ -488,9 +488,9 @@ class Marriage:
|
|||||||
place_name = self.db.get_place_from_handle(place_handle).get_title()
|
place_name = self.db.get_place_from_handle(place_handle).get_title()
|
||||||
else:
|
else:
|
||||||
place_name = ""
|
place_name = ""
|
||||||
iter = self.etree.add([const.display_fevent(event.get_name()),
|
node = self.etree.add([const.display_fevent(event.get_name()),
|
||||||
event.get_quote_date(),place_name],event)
|
event.get_quote_date(),place_name],event)
|
||||||
self.emap[str(event)] = iter
|
self.emap[str(event)] = node
|
||||||
if self.elist:
|
if self.elist:
|
||||||
self.etree.select_row(0)
|
self.etree.select_row(0)
|
||||||
Utils.bold_label(self.events_label)
|
Utils.bold_label(self.events_label)
|
||||||
@@ -533,17 +533,17 @@ class Marriage:
|
|||||||
|
|
||||||
place = self.get_place(0)
|
place = self.get_place(0)
|
||||||
|
|
||||||
ord = self.family.get_lds_sealing()
|
lds_ord = self.family.get_lds_sealing()
|
||||||
if not ord:
|
if not lds_ord:
|
||||||
if date or temple or place or self.seal_stat:
|
if date or temple or place or self.seal_stat:
|
||||||
changed = 1
|
changed = 1
|
||||||
else:
|
else:
|
||||||
d = Date.Date()
|
d = Date.Date()
|
||||||
d.set(date)
|
d.set(date)
|
||||||
if Date.compare_dates(d,ord.get_date_object()) != 0 or \
|
if Date.compare_dates(d,lds_ord.get_date_object()) != 0 or \
|
||||||
ord.get_temple() != temple or \
|
lds_ord.get_temple() != temple or \
|
||||||
(place and ord.get_place_handle() != place.get_handle()) or \
|
(place and lds_ord.get_place_handle() != place.get_handle()) or \
|
||||||
ord.get_status() != self.seal_stat:
|
lds_ord.get_status() != self.seal_stat:
|
||||||
changed = 1
|
changed = 1
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
@@ -610,26 +610,26 @@ class Marriage:
|
|||||||
temple = ""
|
temple = ""
|
||||||
place = self.get_place(1,trans)
|
place = self.get_place(1,trans)
|
||||||
|
|
||||||
ord = self.family.get_lds_sealing()
|
lds_ord = self.family.get_lds_sealing()
|
||||||
if not ord:
|
if not lds_ord:
|
||||||
if date or temple or place or self.seal_stat:
|
if date or temple or place or self.seal_stat:
|
||||||
ord = RelLib.LdsOrd()
|
lds_ord = RelLib.LdsOrd()
|
||||||
ord.set_date(date)
|
lds_ord.set_date(date)
|
||||||
ord.set_temple(temple)
|
lds_ord.set_temple(temple)
|
||||||
ord.set_status(self.seal_stat)
|
lds_ord.set_status(self.seal_stat)
|
||||||
ord.set_place_handle(place)
|
lds_ord.set_place_handle(place)
|
||||||
self.family.set_lds_sealing(ord)
|
self.family.set_lds_sealing(lds_ord)
|
||||||
else:
|
else:
|
||||||
d = Date.Date()
|
d = Date.Date()
|
||||||
d.set(date)
|
d.set(date)
|
||||||
if Date.compare_dates(d,ord.get_date_object()) != 0:
|
if Date.compare_dates(d,lds_ord.get_date_object()) != 0:
|
||||||
ord.set_date_object(d)
|
lds_ord.set_date_object(d)
|
||||||
if ord.get_temple() != temple:
|
if lds_ord.get_temple() != temple:
|
||||||
ord.set_temple(temple)
|
lds_ord.set_temple(temple)
|
||||||
if ord.get_status() != self.seal_stat:
|
if lds_ord.get_status() != self.seal_stat:
|
||||||
ord.set_status(self.seal_stat)
|
lds_ord.set_status(self.seal_stat)
|
||||||
if ord.get_place_handle() != place.get_handle():
|
if lds_ord.get_place_handle() != place.get_handle():
|
||||||
ord.set_place_handle(place.get_handle())
|
lds_ord.set_place_handle(place.get_handle())
|
||||||
|
|
||||||
if self.lists_changed:
|
if self.lists_changed:
|
||||||
self.family.set_source_reference_list(self.srcreflist)
|
self.family.set_source_reference_list(self.srcreflist)
|
||||||
@@ -659,10 +659,10 @@ class Marriage:
|
|||||||
|
|
||||||
def on_event_update_clicked(self,obj):
|
def on_event_update_clicked(self,obj):
|
||||||
import EventEdit
|
import EventEdit
|
||||||
model,iter = self.etree.get_selected()
|
model,node = self.etree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
event = self.etree.get_object(iter)
|
event = self.etree.get_object(node)
|
||||||
name = Utils.family_name(self.family,self.db)
|
name = Utils.family_name(self.family,self.db)
|
||||||
EventEdit.EventEditor(self,name,const.marriageEvents,
|
EventEdit.EventEditor(self,name,const.marriageEvents,
|
||||||
const.family_events,event,
|
const.family_events,event,
|
||||||
@@ -675,10 +675,10 @@ class Marriage:
|
|||||||
|
|
||||||
def on_select_row(self,obj):
|
def on_select_row(self,obj):
|
||||||
|
|
||||||
model,iter = self.etree.get_selected()
|
model,node = self.etree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
event = self.etree.get_object(iter)
|
event = self.etree.get_object(node)
|
||||||
|
|
||||||
self.date_field.set_text(event.get_date())
|
self.date_field.set_text(event.get_date())
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
@@ -701,10 +701,10 @@ class Marriage:
|
|||||||
self.descr_field.set_text(event.get_description())
|
self.descr_field.set_text(event.get_description())
|
||||||
|
|
||||||
def on_attr_list_select_row(self,obj):
|
def on_attr_list_select_row(self,obj):
|
||||||
model,iter = self.atree.get_selected()
|
model,node = self.atree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
attr = self.atree.get_object(iter)
|
attr = self.atree.get_object(node)
|
||||||
|
|
||||||
self.attr_type.set_label(const.display_fattr(attr.get_type()))
|
self.attr_type.set_label(const.display_fattr(attr.get_type()))
|
||||||
self.attr_value.set_text(attr.get_value())
|
self.attr_value.set_text(attr.get_value())
|
||||||
@@ -720,11 +720,11 @@ class Marriage:
|
|||||||
|
|
||||||
def on_update_attr_clicked(self,obj):
|
def on_update_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
model,iter = self.atree.get_selected()
|
model,node = self.atree.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
attr = self.atree.get_object(iter)
|
attr = self.atree.get_object(node)
|
||||||
|
|
||||||
father_handle = self.family.get_father_handle()
|
father_handle = self.family.get_father_handle()
|
||||||
mother_handle = self.family.get_mother_handle()
|
mother_handle = self.family.get_mother_handle()
|
||||||
|
@@ -529,7 +529,7 @@ class Person(PrimaryObject,SourceNote):
|
|||||||
def probably_alive(self,db):
|
def probably_alive(self,db):
|
||||||
"""Returns true if the person may be alive."""
|
"""Returns true if the person may be alive."""
|
||||||
if self.death_handle:
|
if self.death_handle:
|
||||||
return 0
|
return False
|
||||||
if self.birth_handle:
|
if self.birth_handle:
|
||||||
birth = db.get_event_from_handle(self.birth_handle)
|
birth = db.get_event_from_handle(self.birth_handle)
|
||||||
if birth.get_date() != "":
|
if birth.get_date() != "":
|
||||||
@@ -549,25 +549,23 @@ class Person(PrimaryObject,SourceNote):
|
|||||||
if child.birth_handle:
|
if child.birth_handle:
|
||||||
child_birth = db.get_event_from_handle(child.birth_handle)
|
child_birth = db.get_event_from_handle(child.birth_handle)
|
||||||
if child_birth.get_date() != "":
|
if child_birth.get_date() != "":
|
||||||
d = SingleDate (child_birth.get_date_object().
|
d = SingleDate (child_birth.get_date_object().get_start_date())
|
||||||
get_start_date())
|
|
||||||
d.set_year (d.get_year() - years)
|
d.set_year (d.get_year() - years)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
if child.death_handle:
|
if child.death_handle:
|
||||||
child_death = db.get_event_from_handle(child.death_handle)
|
child_death = db.get_event_from_handle(child.death_handle)
|
||||||
if child_death.get_date() != "":
|
if child_death.get_date() != "":
|
||||||
d = SingleDate (child_death.get_date_object().
|
d = SingleDate (child_death.get_date_object().get_start_date())
|
||||||
get_start_date())
|
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
if descendants_too_old (child, years + min_generation):
|
if descendants_too_old (child, years + min_generation):
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
if descendants_too_old (self, min_generation):
|
if descendants_too_old (self, min_generation):
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
# What about their parents?
|
# What about their parents?
|
||||||
def parents_too_old (person, age_difference):
|
def parents_too_old (person, age_difference):
|
||||||
@@ -582,12 +580,10 @@ class Person(PrimaryObject,SourceNote):
|
|||||||
if parent.birth_handle:
|
if parent.birth_handle:
|
||||||
parent_birth = db.get_event_from_handle(parent.birth_handle)
|
parent_birth = db.get_event_from_handle(parent.birth_handle)
|
||||||
if parent_birth.get_date():
|
if parent_birth.get_date():
|
||||||
d = SingleDate (parent_birth.get_date_object().
|
d = SingleDate (parent_birth.get_date_object().get_start_date())
|
||||||
get_start_date())
|
d.set_year (d.get_year() + max_generation + age_difference)
|
||||||
d.set_year (d.get_year() + max_generation +
|
|
||||||
age_difference)
|
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
if parent.death_handle:
|
if parent.death_handle:
|
||||||
parent_death = db.get_event_from_handle(parent.death_handle)
|
parent_death = db.get_event_from_handle(parent.death_handle)
|
||||||
@@ -596,43 +592,40 @@ class Person(PrimaryObject,SourceNote):
|
|||||||
get_start_date())
|
get_start_date())
|
||||||
d.set_year (d.get_year() + age_difference)
|
d.set_year (d.get_year() + age_difference)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 1
|
return True
|
||||||
|
|
||||||
if parents_too_old (self, 0):
|
if parents_too_old (self, 0):
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
# As a last resort, trying seeing if their spouse's age gives
|
# As a last resort, trying seeing if their spouse's age gives
|
||||||
# any clue.
|
# any clue.
|
||||||
for family_handle in self.get_family_handle_list():
|
for family_handle in self.get_family_handle_list():
|
||||||
family = db.get_family_from_handle(family_handle)
|
family = db.get_family_from_handle(family_handle)
|
||||||
for spouse_id in [family.get_father_handle(), family.get_mother_handle()]:
|
for spouse_id in [family.get_father_handle(), family.get_mother_handle()]:
|
||||||
if not spouse_id:
|
if not spouse_id or spouse_id == self.handle:
|
||||||
continue
|
|
||||||
if spouse_id == self.handle:
|
|
||||||
continue
|
continue
|
||||||
spouse = db.get_person_from_handle(spouse_id)
|
spouse = db.get_person_from_handle(spouse_id)
|
||||||
if spouse.birth_handle:
|
sp_birth_handle = spouse.get_birth_handle()
|
||||||
spouse_birth = db.get_event_from_handle(spouse.birth_handle)
|
sp_death_handle = spouse.get_death_handle()
|
||||||
|
if sp_birth_handle:
|
||||||
|
spouse_birth = db.find_event_from_handle(sp_birth_handle)
|
||||||
if spouse_birth.get_date() != "":
|
if spouse_birth.get_date() != "":
|
||||||
d = SingleDate (spouse_birth.get_date_object().
|
d = SingleDate (spouse_birth.get_date_object().get_start_date())
|
||||||
get_start_date())
|
|
||||||
d.set_year (d.get_year() + max_age_difference)
|
d.set_year (d.get_year() + max_age_difference)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
if spouse.death_handle:
|
if sp_death_handle:
|
||||||
spouse_death = db.get_event_from_handle(spouse.death_handle)
|
spouse_death = db.find_event_from_handle(sp_death_handle)
|
||||||
if spouse_death.get_date() != "":
|
if spouse_death.get_date() != "":
|
||||||
d = SingleDate (spouse_death.get_date_object().
|
d = SingleDate (spouse_birth.get_date_object().get_start_date())
|
||||||
get_start_date())
|
|
||||||
d.set_year (d.get_year() - min_generation)
|
d.set_year (d.get_year() - min_generation)
|
||||||
if not not_too_old (d):
|
if not not_too_old (d):
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
if parents_too_old (spouse, max_age_difference):
|
if parents_too_old (spouse, max_age_difference):
|
||||||
return 0
|
return False
|
||||||
|
return True
|
||||||
return 1
|
|
||||||
|
|
||||||
class Family(PrimaryObject,SourceNote):
|
class Family(PrimaryObject,SourceNote):
|
||||||
"""
|
"""
|
||||||
|
@@ -241,27 +241,27 @@ class SelectChild:
|
|||||||
|
|
||||||
person_list.append(person.get_handle())
|
person_list.append(person.get_handle())
|
||||||
|
|
||||||
iter = None
|
node = None
|
||||||
for idval in person_list:
|
for idval in person_list:
|
||||||
dinfo = self.db.get_person_from_handle(idval).get_display_info()
|
dinfo = self.db.get_person_from_handle(idval).get_display_info()
|
||||||
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]]
|
||||||
new_iter = self.refmodel.add(rdata)
|
new_node = self.refmodel.add(rdata)
|
||||||
names = dinfo[0].split(',')
|
names = dinfo[0].split(',')
|
||||||
if len(names):
|
if len(names):
|
||||||
ln = names[0].upper()
|
ln = names[0].upper()
|
||||||
if self.default_name and ln == self.default_name and not iter:
|
if self.default_name and ln == self.default_name and not node:
|
||||||
iter = new_iter
|
node = new_node
|
||||||
|
|
||||||
self.refmodel.connect_model()
|
self.refmodel.connect_model()
|
||||||
|
|
||||||
if iter:
|
if node:
|
||||||
self.refmodel.selection.select_iter(iter)
|
self.refmodel.selection.select_iter(node)
|
||||||
path = self.refmodel.model.get_path(iter)
|
path = self.refmodel.model.get_path(node)
|
||||||
col = self.add_child.get_column(0)
|
col = self.add_child.get_column(0)
|
||||||
self.add_child.scroll_to_cell(path,col,1,0.5,0.0)
|
self.add_child.scroll_to_cell(path,col,1,0.5,0.0)
|
||||||
|
|
||||||
def select_function(self,store,path,iter,id_list):
|
def select_function(self,store,path,node,id_list):
|
||||||
id_list.append(self.refmodel.get_value(iter,PeopleModel.COLUMN_INT_ID))
|
id_list.append(self.refmodel.get_value(node,PeopleModel.COLUMN_INT_ID))
|
||||||
|
|
||||||
def get_selected_ids(self):
|
def get_selected_ids(self):
|
||||||
mlist = []
|
mlist = []
|
||||||
|
@@ -99,28 +99,28 @@ class SelectObject:
|
|||||||
self.object_model.new_model()
|
self.object_model.new_model()
|
||||||
|
|
||||||
for key in self.db.get_media_object_handles():
|
for key in self.db.get_media_object_handles():
|
||||||
object = self.db.get_object_from_handle(key)
|
obj = self.db.get_object_from_handle(key)
|
||||||
title = object.get_description()
|
title = obj.get_description()
|
||||||
the_id = object.get_handle()
|
handle = obj.get_handle()
|
||||||
the_type = Utils.get_mime_description(object.get_mime_type())
|
the_type = Utils.get_mime_description(obj.get_mime_type())
|
||||||
path = object.get_path()
|
path = obj.get_path()
|
||||||
self.object_model.add([title,the_id,the_type,path],key)
|
self.object_model.add([title,handle,the_type,path],key)
|
||||||
|
|
||||||
self.object_model.connect_model()
|
self.object_model.connect_model()
|
||||||
|
|
||||||
def on_select_row(self,obj):
|
def on_select_row(self,obj):
|
||||||
fexists = 1
|
fexists = 1
|
||||||
|
|
||||||
store,iter = self.object_model.get_selected()
|
store,node = self.object_model.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
data = self.object_model.get_data(iter,range(self.ncols))
|
data = self.object_model.get_data(node,range(self.ncols))
|
||||||
the_id = data[4]
|
handle = data[4]
|
||||||
object = self.db.get_object_from_handle(the_id)
|
obj = self.db.get_object_from_handle(handle)
|
||||||
the_type = Utils.get_mime_description(object.get_mime_type())
|
the_type = Utils.get_mime_description(obj.get_mime_type())
|
||||||
path = object.get_path()
|
path = obj.get_path()
|
||||||
|
|
||||||
thumb_path = Utils.thumb_path(self.db.get_save_path(),object)
|
thumb_path = Utils.thumb_path(self.db.get_save_path(),obj)
|
||||||
pexists = os.path.exists(path)
|
pexists = os.path.exists(path)
|
||||||
if pexists and os.path.exists(thumb_path):
|
if pexists and os.path.exists(thumb_path):
|
||||||
self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path))
|
self.preview.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file(thumb_path))
|
||||||
@@ -130,26 +130,26 @@ class SelectObject:
|
|||||||
if not pexists:
|
if not pexists:
|
||||||
fexists = 0
|
fexists = 0
|
||||||
|
|
||||||
self.object_handle.set_text(object.get_handle())
|
self.object_handle.set_text(obj.get_handle())
|
||||||
self.object_type.set_text(the_type)
|
self.object_type.set_text(the_type)
|
||||||
self.object_desc.set_text(object.get_description())
|
self.object_desc.set_text(obj.get_description())
|
||||||
if len(path) == 0 or fexists == 0:
|
if len(path) == 0 or fexists == 0:
|
||||||
self.object_path.set_text(_("The file no longer exists"))
|
self.object_path.set_text(_("The file no longer exists"))
|
||||||
elif path[0] == "/":
|
elif path[0] == "/":
|
||||||
self.object_path.set_text(path)
|
self.object_path.set_text(path)
|
||||||
else:
|
else:
|
||||||
self.object_path.set_text("<local>")
|
self.object_path.set_text("<local>")
|
||||||
self.object_details.set_text(Utils.get_detail_text(object,0))
|
self.object_details.set_text(Utils.get_detail_text(obj,0))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
val = self.top.run()
|
val = self.top.run()
|
||||||
|
|
||||||
if val == gtk.RESPONSE_OK:
|
if val == gtk.RESPONSE_OK:
|
||||||
store,iter = self.object_model.get_selected()
|
store,node = self.object_model.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
data = self.object_model.get_data(iter,range(self.ncols))
|
data = self.object_model.get_data(node,range(self.ncols))
|
||||||
the_id = data[4]
|
handle = data[4]
|
||||||
return_value = self.db.get_object_from_handle(the_id)
|
return_value = self.db.get_object_from_handle(handle)
|
||||||
else:
|
else:
|
||||||
return_value = None
|
return_value = None
|
||||||
self.top.destroy()
|
self.top.destroy()
|
||||||
|
@@ -120,9 +120,9 @@ class SourceView:
|
|||||||
|
|
||||||
def button_press(self,obj,event):
|
def button_press(self,obj,event):
|
||||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||||
store,iter = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
id = store.get_value(iter,_HANDLE_COL)
|
handle = store.get_value(node,_HANDLE_COL)
|
||||||
source = self.parent.db.get_source_from_handle(id)
|
source = self.parent.db.get_source_from_handle(handle)
|
||||||
EditSource.EditSource(source,self.parent.db,self.parent,
|
EditSource.EditSource(source,self.parent.db,self.parent,
|
||||||
self.topWindow,self.update_display)
|
self.topWindow,self.update_display)
|
||||||
return 1
|
return 1
|
||||||
@@ -141,8 +141,8 @@ class SourceView:
|
|||||||
def build_context_menu(self,event):
|
def build_context_menu(self,event):
|
||||||
"""Builds the menu with editing operations on the source's list"""
|
"""Builds the menu with editing operations on the source's list"""
|
||||||
|
|
||||||
store,iter = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
sel_sensitivity = 1
|
sel_sensitivity = 1
|
||||||
else:
|
else:
|
||||||
sel_sensitivity = 0
|
sel_sensitivity = 0
|
||||||
@@ -168,12 +168,12 @@ class SourceView:
|
|||||||
self.topWindow,self.new_after_edit)
|
self.topWindow,self.new_after_edit)
|
||||||
|
|
||||||
def on_delete_clicked(self,obj):
|
def on_delete_clicked(self,obj):
|
||||||
store,iter = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
id = store.get_value(iter,_HANDLE_COL)
|
handle = store.get_value(node,_HANDLE_COL)
|
||||||
source = self.parent.db.get_source_from_handle(id)
|
source = self.parent.db.get_source_from_handle(handle)
|
||||||
|
|
||||||
if self.is_used(source):
|
if self.is_used(source):
|
||||||
ans = EditSource.DelSrcQuery(source,self.parent.db,self.build_tree)
|
ans = EditSource.DelSrcQuery(source,self.parent.db,self.build_tree)
|
||||||
@@ -237,10 +237,10 @@ class SourceView:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def on_edit_clicked(self,obj):
|
def on_edit_clicked(self,obj):
|
||||||
list_store, iter = self.selection.get_selected()
|
list_store, node = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
id = list_store.get_value(iter,_HANDLE_COL)
|
handle = list_store.get_value(node,_HANDLE_COL)
|
||||||
source = self.parent.db.get_source_from_handle(id)
|
source = self.parent.db.get_source_from_handle(handle)
|
||||||
EditSource.EditSource(source, self.parent.db, self.parent,
|
EditSource.EditSource(source, self.parent.db, self.parent,
|
||||||
self.topWindow, self.update_display)
|
self.topWindow, self.update_display)
|
||||||
|
|
||||||
|
@@ -150,8 +150,8 @@ class SourceSelector:
|
|||||||
gnome.help_display('gramps-manual','gramps-edit-complete')
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
||||||
|
|
||||||
def selection_changed(self,obj):
|
def selection_changed(self,obj):
|
||||||
(store,iter) = self.selection.get_selected()
|
(store,node) = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
self.delete.set_sensitive(gtk.TRUE)
|
self.delete.set_sensitive(gtk.TRUE)
|
||||||
self.edit.set_sensitive(gtk.TRUE)
|
self.edit.set_sensitive(gtk.TRUE)
|
||||||
else:
|
else:
|
||||||
@@ -163,8 +163,8 @@ class SourceSelector:
|
|||||||
for s in self.list:
|
for s in self.list:
|
||||||
base_handle = s.get_base_handle()
|
base_handle = s.get_base_handle()
|
||||||
base = self.db.get_source_from_handle(base_handle)
|
base = self.db.get_source_from_handle(base_handle)
|
||||||
iter = self.model.append()
|
node = self.model.append()
|
||||||
self.model.set(iter,0,base_handle,1,base.get_title())
|
self.model.set(node,0,base_handle,1,base.get_title())
|
||||||
|
|
||||||
def src_ok_clicked(self,obj):
|
def src_ok_clicked(self,obj):
|
||||||
del self.orig[:]
|
del self.orig[:]
|
||||||
@@ -175,9 +175,9 @@ class SourceSelector:
|
|||||||
self.close(obj)
|
self.close(obj)
|
||||||
|
|
||||||
def edit_src_clicked(self,obj):
|
def edit_src_clicked(self,obj):
|
||||||
store,iter = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
col = store.get_path(iter)
|
col = store.get_path(node)
|
||||||
src = self.list[col[0]]
|
src = self.list[col[0]]
|
||||||
SourceEditor(src,self.db,self.update_clist,self)
|
SourceEditor(src,self.db,self.update_clist,self)
|
||||||
|
|
||||||
@@ -189,9 +189,9 @@ class SourceSelector:
|
|||||||
SourceEditor(src,self.db,self.add_ref,self)
|
SourceEditor(src,self.db,self.add_ref,self)
|
||||||
|
|
||||||
def del_src_clicked(self,obj):
|
def del_src_clicked(self,obj):
|
||||||
(store,iter) = self.selection.get_selected()
|
(store,node) = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
path = store.get_path(iter)
|
path = store.get_path(node)
|
||||||
del self.list[path[0]]
|
del self.list[path[0]]
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
@@ -243,9 +243,9 @@ class SourceTab:
|
|||||||
self.model.clear()
|
self.model.clear()
|
||||||
for s in self.list:
|
for s in self.list:
|
||||||
base_handle = s.get_base_handle()
|
base_handle = s.get_base_handle()
|
||||||
|
node = self.model.append()
|
||||||
base = self.db.get_source_from_handle(base_handle)
|
base = self.db.get_source_from_handle(base_handle)
|
||||||
iter = self.model.append()
|
self.model.set(node,0,base_handle,1,base.get_title())
|
||||||
self.model.set(iter,0,base.get_gramps_id(),1,base.get_title())
|
|
||||||
if self.list:
|
if self.list:
|
||||||
Utils.bold_label(self.parent.sources_label)
|
Utils.bold_label(self.parent.sources_label)
|
||||||
else:
|
else:
|
||||||
@@ -256,9 +256,9 @@ class SourceTab:
|
|||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
|
|
||||||
def edit_src_clicked(self,obj):
|
def edit_src_clicked(self,obj):
|
||||||
store,iter = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
col = store.get_path(iter)
|
col = store.get_path(node)
|
||||||
src = self.list[col[0]]
|
src = self.list[col[0]]
|
||||||
SourceEditor(src,self.db,self.update_clist,self)
|
SourceEditor(src,self.db,self.update_clist,self)
|
||||||
|
|
||||||
@@ -272,9 +272,9 @@ class SourceTab:
|
|||||||
inst.redraw()
|
inst.redraw()
|
||||||
|
|
||||||
def del_src_clicked(self,obj):
|
def del_src_clicked(self,obj):
|
||||||
(store,iter) = self.selection.get_selected()
|
(store,node) = self.selection.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
path = store.get_path(iter)
|
path = store.get_path(node)
|
||||||
del self.list[path[0]]
|
del self.list[path[0]]
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
self.redraw()
|
self.redraw()
|
||||||
@@ -460,17 +460,17 @@ class SourceEditor:
|
|||||||
date = unicode(self.get_widget("sdate").get_text())
|
date = unicode(self.get_widget("sdate").get_text())
|
||||||
conf = self.get_widget("conf").get_menu().get_active().get_data('a')
|
conf = self.get_widget("conf").get_menu().get_active().get_data('a')
|
||||||
|
|
||||||
buffer = self.get_widget("scomment").get_buffer()
|
buf = self.get_widget("scomment").get_buffer()
|
||||||
comments = unicode(buffer.get_text(buffer.get_start_iter(),
|
comments = unicode(buf.get_text(buf.get_start_iter(),
|
||||||
buffer.get_end_iter(),gtk.FALSE))
|
buf.get_end_iter(),gtk.FALSE))
|
||||||
|
|
||||||
buffer = self.get_widget("stext").get_buffer()
|
buf = self.get_widget("stext").get_buffer()
|
||||||
text = unicode(buffer.get_text(buffer.get_start_iter(),
|
text = unicode(buf.get_text(buf.get_start_iter(),
|
||||||
buffer.get_end_iter(),gtk.FALSE))
|
buf.get_end_iter(),gtk.FALSE))
|
||||||
|
|
||||||
buffer = self.get_widget('spage').get_buffer()
|
buf = self.get_widget('spage').get_buffer()
|
||||||
page = unicode(buffer.get_text(buffer.get_start_iter(),
|
page = unicode(buf.get_text(buf.get_start_iter(),
|
||||||
buffer.get_end_iter(),gtk.FALSE))
|
buf.get_end_iter(),gtk.FALSE))
|
||||||
|
|
||||||
self.source_ref.set_page(page)
|
self.source_ref.set_page(page)
|
||||||
self.source_ref.get_date().set(date)
|
self.source_ref.get_date().set(date)
|
||||||
|
@@ -128,20 +128,20 @@ class StyleListDisplay:
|
|||||||
Called with the EDIT button is clicked. Calls the StyleEditor to edit the
|
Called with the EDIT button is clicked. Calls the StyleEditor to edit the
|
||||||
selected style.
|
selected style.
|
||||||
"""
|
"""
|
||||||
store,iter = self.list.selection.get_selected()
|
store,node = self.list.selection.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
|
|
||||||
name = self.list.model.get_value(iter,0)
|
name = self.list.model.get_value(node,0)
|
||||||
style = self.sheetlist.get_style_sheet(name)
|
style = self.sheetlist.get_style_sheet(name)
|
||||||
StyleEditor(name,style,self)
|
StyleEditor(name,style,self)
|
||||||
|
|
||||||
def on_delete_clicked(self,obj):
|
def on_delete_clicked(self,obj):
|
||||||
"""Deletes the selected style."""
|
"""Deletes the selected style."""
|
||||||
store,iter = self.list.selection.get_selected()
|
store,node = self.list.selection.get_selected()
|
||||||
if not iter:
|
if not node:
|
||||||
return
|
return
|
||||||
name = self.list.model.get_value(iter,0)
|
name = self.list.model.get_value(node,0)
|
||||||
self.sheetlist.delete_style_sheet(name)
|
self.sheetlist.delete_style_sheet(name)
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
@@ -301,8 +301,8 @@ class StyleEditor:
|
|||||||
old paragraph, then draws the newly selected paragraph"""
|
old paragraph, then draws the newly selected paragraph"""
|
||||||
|
|
||||||
objs = self.plist.get_selected_objects()
|
objs = self.plist.get_selected_objects()
|
||||||
store,iter = self.plist.get_selected()
|
store,node = self.plist.get_selected()
|
||||||
name = store.get_value(iter,0)
|
name = store.get_value(node,0)
|
||||||
if self.first == 0:
|
if self.first == 0:
|
||||||
self.save_paragraph(self.current_p)
|
self.save_paragraph(self.current_p)
|
||||||
else:
|
else:
|
||||||
|
@@ -92,7 +92,7 @@ class ReadTarFile:
|
|||||||
self.pos = 0
|
self.pos = 0
|
||||||
|
|
||||||
def extract_files(self):
|
def extract_files(self):
|
||||||
map = {}
|
data = {}
|
||||||
while 1:
|
while 1:
|
||||||
buf = self.f.read(100)
|
buf = self.f.read(100)
|
||||||
if buf == '':
|
if buf == '':
|
||||||
@@ -103,11 +103,11 @@ class ReadTarFile:
|
|||||||
index = index + 1
|
index = index + 1
|
||||||
else:
|
else:
|
||||||
if index == 0:
|
if index == 0:
|
||||||
return map
|
return data
|
||||||
continue
|
continue
|
||||||
filename = buf[0:index]
|
filename = buf[0:index]
|
||||||
if filename == None:
|
if filename == None:
|
||||||
return map
|
return data
|
||||||
self.f.read(24) # modes
|
self.f.read(24) # modes
|
||||||
l = string.replace(self.f.read(12),chr(0),' ')
|
l = string.replace(self.f.read(12),chr(0),' ')
|
||||||
length = int(l,8)
|
length = int(l,8)
|
||||||
@@ -118,10 +118,11 @@ class ReadTarFile:
|
|||||||
self.f.read(64)
|
self.f.read(64)
|
||||||
self.f.read(183)
|
self.f.read(183)
|
||||||
foo = cStringIO.StringIO()
|
foo = cStringIO.StringIO()
|
||||||
map[filename] = foo
|
data[filename] = foo
|
||||||
foo.write(self.f.read(length))
|
foo.write(self.f.read(length))
|
||||||
foo.reset()
|
foo.reset()
|
||||||
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
self.f.read(_BLKSIZE-(length%_BLKSIZE))
|
||||||
|
return data
|
||||||
|
|
||||||
def extract(self):
|
def extract(self):
|
||||||
while 1:
|
while 1:
|
||||||
|
@@ -63,14 +63,14 @@ class TipParser:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
self.mylist = []
|
self.mylist = []
|
||||||
file = open(const.tipdata)
|
xml_file = open(const.tipdata)
|
||||||
self.tlist = []
|
self.tlist = []
|
||||||
p = xml.parsers.expat.ParserCreate()
|
p = xml.parsers.expat.ParserCreate()
|
||||||
p.StartElementHandler = self.startElement
|
p.StartElementHandler = self.startElement
|
||||||
p.EndElementHandler = self.endElement
|
p.EndElementHandler = self.endElement
|
||||||
p.CharacterDataHandler = self.characters
|
p.CharacterDataHandler = self.characters
|
||||||
p.ParseFile(file)
|
p.ParseFile(xml_file)
|
||||||
file.close()
|
xml_file.close()
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
return self.mylist
|
return self.mylist
|
||||||
|
@@ -209,11 +209,11 @@ def redraw_list(dlist,clist,func):
|
|||||||
clist.clear()
|
clist.clear()
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for object in dlist:
|
for obj in dlist:
|
||||||
col = 0
|
col = 0
|
||||||
iter = clist.append()
|
node = clist.append()
|
||||||
for data in func(object):
|
for data in func(obj):
|
||||||
clist.set_value(iter,col,data)
|
clist.set_value(node,col,data)
|
||||||
col = col + 1
|
col = col + 1
|
||||||
index = index + 1
|
index = index + 1
|
||||||
return index
|
return index
|
||||||
@@ -225,9 +225,9 @@ def redraw_list(dlist,clist,func):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def delete_selected(obj,list):
|
def delete_selected(obj,list):
|
||||||
sel = obj.get_selection()
|
sel = obj.get_selection()
|
||||||
model,iter = sel.get_selected()
|
model,node = sel.get_selected()
|
||||||
if iter:
|
if node:
|
||||||
index = model.get_path(iter)[0]
|
index = model.get_path(node)[0]
|
||||||
del list[index]
|
del list[index]
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -249,9 +249,9 @@ def add_menuitem(menu,msg,obj,func):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def view_photo(photo):
|
def view_photo(photo):
|
||||||
type = photo.get_mime_type()
|
mime_type = photo.get_mime_type()
|
||||||
try:
|
try:
|
||||||
data = GrampsMime.get_application(type)
|
data = GrampsMime.get_application(mime_type)
|
||||||
prog = data[0]
|
prog = data[0]
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
@@ -274,7 +274,7 @@ def strip_id(text):
|
|||||||
text = string.rstrip(text)
|
text = string.rstrip(text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def nautilus_icon(icon,type):
|
def nautilus_icon(icon,mime_type):
|
||||||
import GrampsCfg
|
import GrampsCfg
|
||||||
|
|
||||||
theme = GrampsCfg.client.get_string("/desktop/gnome/file_views/icon_theme")
|
theme = GrampsCfg.client.get_string("/desktop/gnome/file_views/icon_theme")
|
||||||
@@ -288,7 +288,7 @@ def nautilus_icon(icon,type):
|
|||||||
if os.path.isfile(newicon):
|
if os.path.isfile(newicon):
|
||||||
return newicon
|
return newicon
|
||||||
return None
|
return None
|
||||||
elif type == "x-directory/":
|
elif mime_type == "x-directory/":
|
||||||
if theme:
|
if theme:
|
||||||
newicon = "%s/%s/i-directory.png" % (const.nautdir,theme)
|
newicon = "%s/%s/i-directory.png" % (const.nautdir,theme)
|
||||||
else:
|
else:
|
||||||
@@ -297,7 +297,7 @@ def nautilus_icon(icon,type):
|
|||||||
return newicon
|
return newicon
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
icontmp = type.replace('/','-')
|
icontmp = mime_type.replace('/','-')
|
||||||
if theme:
|
if theme:
|
||||||
newicon = "%s/%s/gnome-%s.png" % (const.nautdir,theme,icontmp)
|
newicon = "%s/%s/gnome-%s.png" % (const.nautdir,theme,icontmp)
|
||||||
if os.path.isfile(newicon):
|
if os.path.isfile(newicon):
|
||||||
@@ -321,9 +321,9 @@ def get_mime_type(file):
|
|||||||
except:
|
except:
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
def get_mime_description(type):
|
def get_mime_description(mime_type):
|
||||||
try:
|
try:
|
||||||
value = gnome.vfs.mime_get_description(type)
|
value = gnome.vfs.mime_get_description(mime_type)
|
||||||
if value:
|
if value:
|
||||||
return value
|
return value
|
||||||
else:
|
else:
|
||||||
@@ -338,19 +338,19 @@ def get_mime_description(type):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def thumb_path(dir,mobj):
|
def thumb_path(dir,mobj):
|
||||||
type = mobj.get_mime_type()
|
mime_type = mobj.get_mime_type()
|
||||||
|
|
||||||
if type[0:5] == "image":
|
if mime_type[0:5] == "image":
|
||||||
thumb = "%s/.thumb/%s.jpg" % (os.path.dirname(dir),mobj.get_handle())
|
thumb = "%s/.thumb/%s.jpg" % (os.path.dirname(dir),mobj.get_handle())
|
||||||
try:
|
try:
|
||||||
if RelImage.check_thumb(mobj.get_path(),thumb,const.thumbScale):
|
if RelImage.check_thumb(mobj.get_path(),thumb,const.thumbScale):
|
||||||
return thumb
|
return thumb
|
||||||
else:
|
else:
|
||||||
return find_icon(type)
|
return find_icon(mime_type)
|
||||||
except:
|
except:
|
||||||
return find_icon(type)
|
return find_icon(mime_type)
|
||||||
else:
|
else:
|
||||||
return find_icon(type)
|
return find_icon(mime_type)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -338,15 +338,14 @@ class XmlWriter:
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
||||||
self.write_family_handle(family,2)
|
self.write_family_handle(family,2)
|
||||||
fh = family.get_father_handle()
|
fhandle = family.get_father_handle()
|
||||||
mh = family.get_mother_handle()
|
mhandle = family.get_mother_handle()
|
||||||
if fh:
|
if fhandle:
|
||||||
fid = self.db.get_person_from_handle (fh).get_gramps_id ()
|
fid = self.db.get_person_from_handle (fhandle).get_gramps_id ()
|
||||||
self.write_ref("father",fid,3)
|
self.write_ref("father",fid,3)
|
||||||
if mh:
|
if mhandle:
|
||||||
mid = self.db.get_person_from_handle (mh).get_gramps_id ()
|
mid = self.db.get_person_from_handle (mhandle).get_gramps_id ()
|
||||||
self.write_ref("mother",mid,3)
|
self.write_ref("mother",mid,3)
|
||||||
|
|
||||||
for event_handle in family.get_event_list():
|
for event_handle in family.get_event_list():
|
||||||
event = self.db.get_event_from_handle(event_handle)
|
event = self.db.get_event_from_handle(event_handle)
|
||||||
self.dump_event(event,3)
|
self.dump_event(event,3)
|
||||||
@@ -406,13 +405,13 @@ class XmlWriter:
|
|||||||
keys = self.db.get_media_object_handles()
|
keys = self.db.get_media_object_handles()
|
||||||
sorted_keys = []
|
sorted_keys = []
|
||||||
for key in keys:
|
for key in keys:
|
||||||
object = self.db.get_object_from_handle (key)
|
obj = self.db.get_object_from_handle (key)
|
||||||
tuple = (object.get_gramps_id (), object)
|
tuple = (obj.get_gramps_id (), obj)
|
||||||
sorted_keys.append (tuple)
|
sorted_keys.append (tuple)
|
||||||
|
|
||||||
sorted_keys.sort ()
|
sorted_keys.sort ()
|
||||||
for (gramps_id, object) in sorted_keys:
|
for (gramps_id, obj) in sorted_keys:
|
||||||
self.write_object(object)
|
self.write_object(obj)
|
||||||
self.g.write(" </objects>\n")
|
self.g.write(" </objects>\n")
|
||||||
|
|
||||||
if len(self.db.get_bookmarks()) > 0:
|
if len(self.db.get_bookmarks()) > 0:
|
||||||
@@ -548,8 +547,8 @@ class XmlWriter:
|
|||||||
self.write_date(d,index+1)
|
self.write_date(d,index+1)
|
||||||
self.g.write("%s</sourceref>\n" % (" " * index))
|
self.g.write("%s</sourceref>\n" % (" " * index))
|
||||||
|
|
||||||
def write_ref(self,label,id,index=1):
|
def write_ref(self,label,gid,index=1):
|
||||||
if id:
|
if gid:
|
||||||
self.g.write('%s<%s ref="%s"/>\n' % (" "*index,label,id))
|
self.g.write('%s<%s ref="%s"/>\n' % (" "*index,label,id))
|
||||||
|
|
||||||
def write_id(self,label,person,index=1):
|
def write_id(self,label,person,index=1):
|
||||||
@@ -624,9 +623,9 @@ class XmlWriter:
|
|||||||
|
|
||||||
def dump_name(self,label,name,index=1):
|
def dump_name(self,label,name,index=1):
|
||||||
sp = " "*index
|
sp = " "*index
|
||||||
type = name.get_type()
|
name_type = name.get_type()
|
||||||
if type:
|
if name_type:
|
||||||
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,type,conf_priv(name)))
|
self.g.write('%s<%s type="%s"%s>\n' % (sp,label,name_type,conf_priv(name)))
|
||||||
else:
|
else:
|
||||||
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
|
self.g.write('%s<%s%s>\n' % (sp,label,conf_priv(name)))
|
||||||
self.write_line("first",name.get_first_name(),index+1)
|
self.write_line("first",name.get_first_name(),index+1)
|
||||||
@@ -777,10 +776,10 @@ class XmlWriter:
|
|||||||
self.dump_source_ref(s,3)
|
self.dump_source_ref(s,3)
|
||||||
self.g.write(" </placeobj>\n")
|
self.g.write(" </placeobj>\n")
|
||||||
|
|
||||||
def write_object(self,object):
|
def write_object(self,obj):
|
||||||
id = object.get_gramps_id()
|
handle = obj.get_gramps_id()
|
||||||
type = object.get_mime_type()
|
mime_type = obj.get_mime_type()
|
||||||
path = object.get_path()
|
path = obj.get_path()
|
||||||
if self.strip_photos:
|
if self.strip_photos:
|
||||||
path = os.path.basename(path)
|
path = os.path.basename(path)
|
||||||
else:
|
else:
|
||||||
@@ -788,18 +787,18 @@ class XmlWriter:
|
|||||||
if len(path) >= l:
|
if len(path) >= l:
|
||||||
if self.fileroot == path[0:l]:
|
if self.fileroot == path[0:l]:
|
||||||
path = path[l+1:]
|
path = path[l+1:]
|
||||||
self.g.write(' <object id="%s" src="%s" mime="%s"' % (id,path,type))
|
self.g.write(' <object id="%s" src="%s" mime="%s"' % (handle,path,mime_type))
|
||||||
self.g.write(' description="%s"' % self.fix(object.get_description()))
|
self.g.write(' description="%s"' % self.fix(obj.get_description()))
|
||||||
alist = object.get_attribute_list()
|
alist = obj.get_attribute_list()
|
||||||
note = object.get_note()
|
note = obj.get_note()
|
||||||
slist = object.get_source_references()
|
slist = obj.get_source_references()
|
||||||
if len(alist) == 0 and len(slist) == 0 and note == "":
|
if len(alist) == 0 and len(slist) == 0 and note == "":
|
||||||
self.g.write('/>\n')
|
self.g.write('/>\n')
|
||||||
else:
|
else:
|
||||||
self.g.write('>\n')
|
self.g.write('>\n')
|
||||||
self.write_attribute_list(alist)
|
self.write_attribute_list(alist)
|
||||||
if note != "":
|
if note != "":
|
||||||
self.write_note("note",object.get_note_object(),3)
|
self.write_note("note",obj.get_note_object(),3)
|
||||||
for s in slist:
|
for s in slist:
|
||||||
self.dump_source_ref(s,3)
|
self.dump_source_ref(s,3)
|
||||||
self.g.write(" </object>\n")
|
self.g.write(" </object>\n")
|
||||||
|
Reference in New Issue
Block a user