Fixes for WebPage generation and image handling
svn: r304
This commit is contained in:
parent
8889385911
commit
099bd7fa5c
@ -301,11 +301,10 @@ def exportData(database, filename, callback):
|
|||||||
|
|
||||||
for photo in person.getPhotoList():
|
for photo in person.getPhotoList():
|
||||||
path = photo.getPath()
|
path = photo.getPath()
|
||||||
l = len(fullpath)
|
l = len(fileroot)
|
||||||
if len(path) >= l:
|
if len(path) >= l:
|
||||||
if fullpath == path[0:l]:
|
if fileroot == path[0:l]:
|
||||||
path = path[l+1:]
|
path = path[l+1:]
|
||||||
print path
|
|
||||||
g.write(' <img src="%s"' % fix(path) )
|
g.write(' <img src="%s"' % fix(path) )
|
||||||
g.write(' descrip="%s"' % fix(photo.getDescription()))
|
g.write(' descrip="%s"' % fix(photo.getDescription()))
|
||||||
proplist = photo.getPropertyList()
|
proplist = photo.getPropertyList()
|
||||||
|
@ -920,7 +920,10 @@ def read_file(filename):
|
|||||||
statusbar.set_status("")
|
statusbar.set_status("")
|
||||||
Config.save_last_file("")
|
Config.save_last_file("")
|
||||||
|
|
||||||
|
active_person = None
|
||||||
for person in database.getPersonMap().values():
|
for person in database.getPersonMap().values():
|
||||||
|
if active_person == None:
|
||||||
|
active_person = person
|
||||||
lastname = person.getPrimaryName().getSurname()
|
lastname = person.getPrimaryName().getSurname()
|
||||||
if lastname and lastname not in const.surnames:
|
if lastname and lastname not in const.surnames:
|
||||||
const.surnames.append(lastname)
|
const.surnames.append(lastname)
|
||||||
@ -1469,12 +1472,9 @@ def sort_person_list():
|
|||||||
person_list.set_foreground(i+1,evenfg)
|
person_list.set_foreground(i+1,evenfg)
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
pass
|
pass
|
||||||
|
goto_active_person()
|
||||||
person_list.thaw()
|
person_list.thaw()
|
||||||
|
|
||||||
if id2col.has_key(active_person):
|
|
||||||
row = person_list.find_row_from_data(id2col[active_person])
|
|
||||||
person_list.moveto(row)
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -2279,7 +2279,10 @@ def load_database(name):
|
|||||||
|
|
||||||
Config.save_last_file(name)
|
Config.save_last_file(name)
|
||||||
gtop.get_widget("filter").set_text("")
|
gtop.get_widget("filter").set_text("")
|
||||||
active_person = database.getDefaultPerson()
|
|
||||||
|
person = database.getDefaultPerson()
|
||||||
|
if person:
|
||||||
|
active_person = person
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -2371,10 +2374,11 @@ def goto_active_person():
|
|||||||
person_list.select_row(column,0)
|
person_list.select_row(column,0)
|
||||||
person_list.moveto(column)
|
person_list.moveto(column)
|
||||||
else:
|
else:
|
||||||
person_list.select_row(0,0)
|
if person_list.rows > 0:
|
||||||
person_list.moveto(0)
|
person_list.select_row(0,0)
|
||||||
person,alt = person_list.get_row_data(0)
|
person_list.moveto(0)
|
||||||
change_active_person(person)
|
person,alt = person_list.get_row_data(0)
|
||||||
|
change_active_person(person)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -48,6 +48,7 @@ topDialog = None
|
|||||||
glade_file = os.path.dirname(__file__) + os.sep + "webpage.glade"
|
glade_file = os.path.dirname(__file__) + os.sep + "webpage.glade"
|
||||||
|
|
||||||
restrict = 1
|
restrict = 1
|
||||||
|
private = 1
|
||||||
restrict_photos = 0
|
restrict_photos = 0
|
||||||
no_photos = 0
|
no_photos = 0
|
||||||
styles = StyleSheet()
|
styles = StyleSheet()
|
||||||
@ -90,10 +91,11 @@ class IndividualPage:
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def __init__(self,person,photos,restrict,link,list,dir_name,doc):
|
def __init__(self,person,photos,restrict,private,link,list,dir_name,doc):
|
||||||
self.person = person
|
self.person = person
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.list = list
|
self.list = list
|
||||||
|
self.private = private
|
||||||
self.alive = probably_alive(person) or restrict
|
self.alive = probably_alive(person) or restrict
|
||||||
self.photos = (photos == 2) or (photos == 1 and not self.alive)
|
self.photos = (photos == 2) or (photos == 1 and not self.alive)
|
||||||
self.dir = dir_name
|
self.dir = dir_name
|
||||||
@ -177,7 +179,7 @@ class IndividualPage:
|
|||||||
self.doc.start_paragraph("Data")
|
self.doc.start_paragraph("Data")
|
||||||
if person:
|
if person:
|
||||||
if person in self.list:
|
if person in self.list:
|
||||||
self.doc.start_link("i%s.html" % person.getId())
|
self.doc.start_link("%s.html" % person.getId())
|
||||||
self.doc.write_text(person.getPrimaryName().getRegularName())
|
self.doc.write_text(person.getPrimaryName().getRegularName())
|
||||||
if person in self.list:
|
if person in self.list:
|
||||||
self.doc.end_link()
|
self.doc.end_link()
|
||||||
@ -215,7 +217,7 @@ class IndividualPage:
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def create_page(self):
|
def create_page(self):
|
||||||
filebase = "i%s.html" % self.person.getId()
|
filebase = "%s.html" % self.person.getId()
|
||||||
self.doc.open("%s%s%s" % (self.dir,os.sep,filebase))
|
self.doc.open("%s%s%s" % (self.dir,os.sep,filebase))
|
||||||
|
|
||||||
photo_list = self.person.getPhotoList()
|
photo_list = self.person.getPhotoList()
|
||||||
@ -294,6 +296,8 @@ class IndividualPage:
|
|||||||
event_list = event_list + self.person.getEventList()
|
event_list = event_list + self.person.getEventList()
|
||||||
event_list.sort(by_date)
|
event_list.sort(by_date)
|
||||||
for event in event_list:
|
for event in event_list:
|
||||||
|
if event.getPrivacy():
|
||||||
|
continue
|
||||||
name = _(event.getName())
|
name = _(event.getName())
|
||||||
date = event.getDate()
|
date = event.getDate()
|
||||||
place = event.getPlace()
|
place = event.getPlace()
|
||||||
@ -378,7 +382,7 @@ class IndividualPage:
|
|||||||
self.doc.start_cell("NormalCell",2)
|
self.doc.start_cell("NormalCell",2)
|
||||||
self.doc.start_paragraph("Spouse")
|
self.doc.start_paragraph("Spouse")
|
||||||
if spouse:
|
if spouse:
|
||||||
self.doc.start_link("i%s.html" % spouse.getId())
|
self.doc.start_link("%s.html" % spouse.getId())
|
||||||
self.doc.write_text(spouse.getPrimaryName().getRegularName())
|
self.doc.write_text(spouse.getPrimaryName().getRegularName())
|
||||||
self.doc.end_link()
|
self.doc.end_link()
|
||||||
else:
|
else:
|
||||||
@ -387,10 +391,9 @@ class IndividualPage:
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
event_list = [ family.getMarriage(), family.getDivorce() ]
|
for event in family.getEventList():
|
||||||
event_list = event_list + family.getEventList()
|
if event.getPrivacy() == 0:
|
||||||
for event in event_list:
|
self.write_fam_fact(event)
|
||||||
self.write_fam_fact(event)
|
|
||||||
|
|
||||||
child_list = family.getChildList()
|
child_list = family.getChildList()
|
||||||
if len(child_list) > 0:
|
if len(child_list) > 0:
|
||||||
@ -410,7 +413,7 @@ class IndividualPage:
|
|||||||
first = 0
|
first = 0
|
||||||
else:
|
else:
|
||||||
self.doc.write_text('\n')
|
self.doc.write_text('\n')
|
||||||
self.doc.start_link("i%s.html" % child.getId())
|
self.doc.start_link("%s.html" % child.getId())
|
||||||
self.doc.write_text(child.getPrimaryName().getRegularName())
|
self.doc.write_text(child.getPrimaryName().getRegularName())
|
||||||
self.doc.end_link()
|
self.doc.end_link()
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -693,6 +696,7 @@ def on_ok_clicked(obj):
|
|||||||
templ_name = topDialog.get_widget("htmlTemplate").get_full_path(0)
|
templ_name = topDialog.get_widget("htmlTemplate").get_full_path(0)
|
||||||
|
|
||||||
restrict = topDialog.get_widget("restrict").get_active()
|
restrict = topDialog.get_widget("restrict").get_active()
|
||||||
|
privated = topDialog.get_widget("private").get_active()
|
||||||
restrict_photos = topDialog.get_widget("restrict_photos").get_active()
|
restrict_photos = topDialog.get_widget("restrict_photos").get_active()
|
||||||
no_photos = topDialog.get_widget("nophotos").get_active()
|
no_photos = topDialog.get_widget("nophotos").get_active()
|
||||||
include_link = topDialog.get_widget("include_link").get_active()
|
include_link = topDialog.get_widget("include_link").get_active()
|
||||||
@ -732,8 +736,8 @@ def on_ok_clicked(obj):
|
|||||||
|
|
||||||
for person in ind_list:
|
for person in ind_list:
|
||||||
doc = HtmlLinkDoc(styles,templ_name)
|
doc = HtmlLinkDoc(styles,templ_name)
|
||||||
idoc = IndividualPage(person,photos,restrict,include_link, \
|
idoc = IndividualPage(person,photos,restrict,private,\
|
||||||
ind_list,dir_name,doc)
|
include_link, ind_list,dir_name,doc)
|
||||||
idoc.create_page()
|
idoc.create_page()
|
||||||
idoc.close()
|
idoc.close()
|
||||||
|
|
||||||
@ -760,7 +764,7 @@ def dump_index(person_list,styles,template,html_dir):
|
|||||||
person_list.sort(sort.by_last_name)
|
person_list.sort(sort.by_last_name)
|
||||||
for person in person_list:
|
for person in person_list:
|
||||||
name = person.getPrimaryName().getName()
|
name = person.getPrimaryName().getName()
|
||||||
doc.start_link("i%s.html" % person.getId())
|
doc.start_link("%s.html" % person.getId())
|
||||||
doc.write_text(name)
|
doc.write_text(name)
|
||||||
doc.end_link()
|
doc.end_link()
|
||||||
doc.newline()
|
doc.newline()
|
||||||
|
@ -422,6 +422,21 @@
|
|||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>0</spacing>
|
<spacing>0</spacing>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkCheckButton</class>
|
||||||
|
<name>private</name>
|
||||||
|
<border_width>3</border_width>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<label>Do not include records marked "Private"</label>
|
||||||
|
<active>True</active>
|
||||||
|
<draw_indicator>True</draw_indicator>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCheckButton</class>
|
<class>GtkCheckButton</class>
|
||||||
<name>restrict</name>
|
<name>restrict</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user