* src/AddMedia.py: handle "note only" media object
* src/DisplayModels.py: handle media type of None * src/ImageSelect.py: Add "internal note" check box * src/MediaView.py: handle media type of None * src/NoteEdit.py: use glade definition * src/gramps.glade: add note editor * src/plubins/NavWebPage.py: Add default pages svn: r4035
This commit is contained in:
parent
d38cf31a31
commit
064311fc73
@ -1,3 +1,12 @@
|
|||||||
|
2005-02-15 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/AddMedia.py: handle "note only" media object
|
||||||
|
* src/DisplayModels.py: handle media type of None
|
||||||
|
* src/ImageSelect.py: Add "internal note" check box
|
||||||
|
* src/MediaView.py: handle media type of None
|
||||||
|
* src/NoteEdit.py: use glade definition
|
||||||
|
* src/gramps.glade: add note editor
|
||||||
|
* src/plubins/NavWebPage.py: Add default pages
|
||||||
|
|
||||||
2005-02-15 Alex Roitman <shura@alex.neuro.umn.edu>
|
2005-02-15 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* doc/gramps-manual/C/authors.xml: Add list of contributors.
|
* doc/gramps-manual/C/authors.xml: Add list of contributors.
|
||||||
* doc/gramps-manual/C/getstart.xml: Update.
|
* doc/gramps-manual/C/getstart.xml: Update.
|
||||||
|
@ -83,6 +83,8 @@ class AddMediaObject:
|
|||||||
self.description = self.glade.get_widget("photoDescription")
|
self.description = self.glade.get_widget("photoDescription")
|
||||||
self.image = self.glade.get_widget("image")
|
self.image = self.glade.get_widget("image")
|
||||||
self.file_text = self.glade.get_widget("fname")
|
self.file_text = self.glade.get_widget("fname")
|
||||||
|
self.internal = self.glade.get_widget('internal')
|
||||||
|
self.internal.connect('toggled',self.internal_toggled)
|
||||||
self.update = update
|
self.update = update
|
||||||
self.temp_name = ""
|
self.temp_name = ""
|
||||||
self.object = None
|
self.object = None
|
||||||
@ -97,6 +99,9 @@ class AddMediaObject:
|
|||||||
|
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
def internal_toggled(self, obj):
|
||||||
|
self.file_text.set_sensitive(not obj.get_active())
|
||||||
|
|
||||||
def on_help_imagesel_clicked(self,obj):
|
def on_help_imagesel_clicked(self,obj):
|
||||||
"""Display the relevant portion of GRAMPS manual"""
|
"""Display the relevant portion of GRAMPS manual"""
|
||||||
gnome.help_display('gramps-manual','gramps-edit-quick')
|
gnome.help_display('gramps-manual','gramps-edit-quick')
|
||||||
@ -107,9 +112,18 @@ class AddMediaObject:
|
|||||||
Callback function called with the save button is pressed.
|
Callback function called with the save button is pressed.
|
||||||
A new media object is created, and added to the database.
|
A new media object is created, and added to the database.
|
||||||
"""
|
"""
|
||||||
filename = self.file_text.get_filename()
|
|
||||||
description = unicode(self.description.get_text())
|
description = unicode(self.description.get_text())
|
||||||
|
|
||||||
|
if self.internal.get_active():
|
||||||
|
import NoteEdit
|
||||||
|
|
||||||
|
mobj = RelLib.MediaObject()
|
||||||
|
mobj.set_description(description)
|
||||||
|
mobj.set_mime_type(None)
|
||||||
|
else:
|
||||||
|
filename = self.file_text.get_filename()
|
||||||
|
|
||||||
if os.path.exists(filename) == 0:
|
if os.path.exists(filename) == 0:
|
||||||
msgstr = _("Cannot import %s")
|
msgstr = _("Cannot import %s")
|
||||||
msgstr2 = _("The filename supplied could not be found.")
|
msgstr2 = _("The filename supplied could not be found.")
|
||||||
@ -123,13 +137,11 @@ class AddMediaObject:
|
|||||||
mobj = RelLib.MediaObject()
|
mobj = RelLib.MediaObject()
|
||||||
mobj.set_description(description)
|
mobj.set_description(description)
|
||||||
mobj.set_mime_type(mtype)
|
mobj.set_mime_type(mtype)
|
||||||
|
|
||||||
trans = self.db.transaction_begin()
|
|
||||||
self.db.add_object(mobj,trans)
|
|
||||||
|
|
||||||
name = filename
|
name = filename
|
||||||
mobj.set_path(name)
|
mobj.set_path(name)
|
||||||
|
|
||||||
|
trans = self.db.transaction_begin()
|
||||||
|
self.db.add_object(mobj,trans)
|
||||||
self.object = mobj
|
self.object = mobj
|
||||||
self.db.commit_media_object(mobj,trans)
|
self.db.commit_media_object(mobj,trans)
|
||||||
self.db.transaction_commit(trans,_("Add Media Object"))
|
self.db.transaction_commit(trans,_("Add Media Object"))
|
||||||
|
@ -395,7 +395,10 @@ class MediaModel(BaseModel):
|
|||||||
return unicode(data[2])
|
return unicode(data[2])
|
||||||
|
|
||||||
def column_mime(self,data):
|
def column_mime(self,data):
|
||||||
|
if data[3]:
|
||||||
return unicode(data[3])
|
return unicode(data[3])
|
||||||
|
else:
|
||||||
|
return _('Note')
|
||||||
|
|
||||||
def column_id(self,data):
|
def column_id(self,data):
|
||||||
return unicode(data[1])
|
return unicode(data[1])
|
||||||
|
@ -479,7 +479,9 @@ class EditPerson:
|
|||||||
ph = media_list[0]
|
ph = media_list[0]
|
||||||
object_handle = ph.get_reference_handle()
|
object_handle = ph.get_reference_handle()
|
||||||
obj = self.db.get_object_from_handle(object_handle)
|
obj = self.db.get_object_from_handle(object_handle)
|
||||||
ImageSelect.LocalMediaProperties(ph,obj.get_path(),self,self.window)
|
ImageSelect.LocalMediaProperties(ph,obj.get_path(),
|
||||||
|
self,self.window)
|
||||||
|
|
||||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||||
media_list = self.person.get_media_list()
|
media_list = self.person.get_media_list()
|
||||||
if media_list:
|
if media_list:
|
||||||
|
@ -112,7 +112,9 @@ class ImageSelect:
|
|||||||
self.fname = self.glade.get_widget("fname")
|
self.fname = self.glade.get_widget("fname")
|
||||||
self.image = self.glade.get_widget("image")
|
self.image = self.glade.get_widget("image")
|
||||||
self.description = self.glade.get_widget("photoDescription")
|
self.description = self.glade.get_widget("photoDescription")
|
||||||
|
self.internal = self.glade.get_widget('internal')
|
||||||
self.temp_name = ""
|
self.temp_name = ""
|
||||||
|
self.internal.hide()
|
||||||
|
|
||||||
Utils.set_titles(self.window,self.glade.get_widget('title'),
|
Utils.set_titles(self.window,self.glade.get_widget('title'),
|
||||||
_('Select a media object'))
|
_('Select a media object'))
|
||||||
@ -122,6 +124,8 @@ class ImageSelect:
|
|||||||
"on_help_imagesel_clicked" : self.on_help_imagesel_clicked,
|
"on_help_imagesel_clicked" : self.on_help_imagesel_clicked,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.internal.connect('toggled',self.internal_toggled)
|
||||||
|
|
||||||
if os.path.isdir(_last_path):
|
if os.path.isdir(_last_path):
|
||||||
self.fname.set_current_folder(_last_path)
|
self.fname.set_current_folder(_last_path)
|
||||||
|
|
||||||
@ -953,7 +957,8 @@ class GlobalMediaProperties:
|
|||||||
else:
|
else:
|
||||||
self.srcreflist = []
|
self.srcreflist = []
|
||||||
|
|
||||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self,
|
self.sourcetab = Sources.SourceTab(
|
||||||
|
self.srcreflist,self,
|
||||||
self.change_dialog,
|
self.change_dialog,
|
||||||
self.window, self.slist,
|
self.window, self.slist,
|
||||||
self.change_dialog.get_widget('gl_add_src'),
|
self.change_dialog.get_widget('gl_add_src'),
|
||||||
@ -962,15 +967,19 @@ class GlobalMediaProperties:
|
|||||||
|
|
||||||
self.descr_window.set_text(self.obj.get_description())
|
self.descr_window.set_text(self.obj.get_description())
|
||||||
mtype = self.obj.get_mime_type()
|
mtype = self.obj.get_mime_type()
|
||||||
|
if mtype:
|
||||||
pb = ImgManip.get_thumbnail_image(self.obj.get_path())
|
pb = ImgManip.get_thumbnail_image(self.obj.get_path())
|
||||||
self.pixmap.set_from_pixbuf(pb)
|
self.pixmap.set_from_pixbuf(pb)
|
||||||
|
descr = Utils.get_mime_description(mtype)
|
||||||
|
self.change_dialog.get_widget("type").set_text(descr)
|
||||||
|
else:
|
||||||
|
self.change_dialog.get_widget("type").set_text(_('Note'))
|
||||||
|
self.pixmap.hide()
|
||||||
|
|
||||||
self.change_dialog.get_widget("gid").set_text(self.obj.get_gramps_id())
|
self.change_dialog.get_widget("gid").set_text(self.obj.get_gramps_id())
|
||||||
self.makelocal = self.change_dialog.get_widget("makelocal")
|
|
||||||
|
|
||||||
self.update_info()
|
self.update_info()
|
||||||
|
|
||||||
self.change_dialog.get_widget("type").set_text(Utils.get_mime_description(mtype))
|
|
||||||
if self.obj.get_note():
|
if self.obj.get_note():
|
||||||
self.notes.get_buffer().set_text(self.obj.get_note())
|
self.notes.get_buffer().set_text(self.obj.get_note())
|
||||||
Utils.bold_label(self.notes_label)
|
Utils.bold_label(self.notes_label)
|
||||||
|
@ -181,23 +181,28 @@ class MediaView:
|
|||||||
mobj = self.db.get_object_from_handle(handle)
|
mobj = self.db.get_object_from_handle(handle)
|
||||||
mtype = mobj.get_mime_type()
|
mtype = mobj.get_mime_type()
|
||||||
path = mobj.get_path()
|
path = mobj.get_path()
|
||||||
|
if mtype:
|
||||||
type_name = Utils.get_mime_description(mtype)
|
type_name = Utils.get_mime_description(mtype)
|
||||||
image = ImgManip.get_thumbnail_image(path)
|
image = ImgManip.get_thumbnail_image(path)
|
||||||
if image != None:
|
if image != None:
|
||||||
self.preview.set_from_pixbuf(image)
|
self.preview.set_from_pixbuf(image)
|
||||||
else:
|
else:
|
||||||
icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(mtype))
|
icon = Utils.find_icon(mtype)
|
||||||
|
icon_image = gtk.gdk.pixbuf_new_from_file(icon)
|
||||||
self.preview.set_from_pixbuf(icon_image)
|
self.preview.set_from_pixbuf(icon_image)
|
||||||
|
else:
|
||||||
|
icon = Utils.find_icon('text/plain')
|
||||||
|
icon_image = gtk.gdk.pixbuf_new_from_file(icon)
|
||||||
|
self.preview.set_from_pixbuf(icon_image)
|
||||||
|
type_name = _('Note')
|
||||||
|
|
||||||
self.mid.set_text(mobj.get_gramps_id())
|
self.mid.set_text(mobj.get_gramps_id())
|
||||||
self.mtype.set_text(type_name)
|
self.mtype.set_text(type_name)
|
||||||
self.mdesc.set_text(mobj.get_description())
|
self.mdesc.set_text(mobj.get_description())
|
||||||
if len(path) == 0 or fexists == 0:
|
if len(path) == 0 or fexists == 0:
|
||||||
self.mpath.set_text(_("The file no longer exists"))
|
self.mpath.set_text(_("The file no longer exists"))
|
||||||
elif path[0] == "/":
|
|
||||||
self.mpath.set_text(path)
|
|
||||||
else:
|
else:
|
||||||
self.mpath.set_text(_("<local>"))
|
self.mpath.set_text(path)
|
||||||
self.mdetails.set_text(Utils.get_detail_text(mobj,0))
|
self.mdetails.set_text(Utils.get_detail_text(mobj,0))
|
||||||
|
|
||||||
def on_button_press_event(self,obj,event):
|
def on_button_press_event(self,obj,event):
|
||||||
@ -230,7 +235,7 @@ class MediaView:
|
|||||||
Utils.add_menuitem(menu,_("View in the default viewer"),None,
|
Utils.add_menuitem(menu,_("View in the default viewer"),None,
|
||||||
self.popup_view_photo)
|
self.popup_view_photo)
|
||||||
|
|
||||||
if mime_type[0:5] == "image":
|
if mime_type and mime_type[0:5] == "image":
|
||||||
Utils.add_menuitem(menu,_("Edit with the GIMP"),
|
Utils.add_menuitem(menu,_("Edit with the GIMP"),
|
||||||
None,self.popup_edit_photo)
|
None,self.popup_edit_photo)
|
||||||
item = gtk.MenuItem()
|
item = gtk.MenuItem()
|
||||||
@ -263,9 +268,8 @@ class MediaView:
|
|||||||
os.execvp(const.editor,[const.editor, self.obj.get_path()])
|
os.execvp(const.editor,[const.editor, self.obj.get_path()])
|
||||||
|
|
||||||
def popup_change_description(self, obj):
|
def popup_change_description(self, obj):
|
||||||
ImageSelect.GlobalMediaProperties(self.db,self.obj,
|
ImageSelect.GlobalMediaProperties(
|
||||||
self.update_display,
|
self.db, self.obj, self.update_display, self,self.topWindow)
|
||||||
self,self.topWindow)
|
|
||||||
|
|
||||||
def on_add_clicked(self,obj):
|
def on_add_clicked(self,obj):
|
||||||
"""Add a new media object to the media list"""
|
"""Add a new media object to the media list"""
|
||||||
@ -289,9 +293,19 @@ class MediaView:
|
|||||||
if node:
|
if node:
|
||||||
handle = list_store.get_value(node,_HANDLE_COL)
|
handle = list_store.get_value(node,_HANDLE_COL)
|
||||||
obj = self.db.get_object_from_handle(handle)
|
obj = self.db.get_object_from_handle(handle)
|
||||||
ImageSelect.GlobalMediaProperties(self.db,obj,
|
if obj.get_mime_type():
|
||||||
self.update_display,
|
ImageSelect.GlobalMediaProperties(
|
||||||
|
self.db,obj, self.update_display,
|
||||||
self,self.topWindow)
|
self,self.topWindow)
|
||||||
|
else:
|
||||||
|
import NoteEdit
|
||||||
|
NoteEdit.NoteEditor(obj,self.parent,self.topWindow,
|
||||||
|
self.note_callback)
|
||||||
|
|
||||||
|
def note_callback(self,data):
|
||||||
|
trans = self.db.transaction_begin()
|
||||||
|
self.db.commit_media_object(data,trans)
|
||||||
|
self.db.transaction_commit(trans,_("Edit Media Object"))
|
||||||
|
|
||||||
def on_delete_clicked(self,obj):
|
def on_delete_clicked(self,obj):
|
||||||
store,node = self.selection.get_selected()
|
store,node = self.selection.get_selected()
|
||||||
@ -357,6 +371,7 @@ class MediaView:
|
|||||||
if (const.dnd_images):
|
if (const.dnd_images):
|
||||||
handle = store.get_value(node,_HANDLE_COL)
|
handle = store.get_value(node,_HANDLE_COL)
|
||||||
obj = self.db.get_object_from_handle(handle)
|
obj = self.db.get_object_from_handle(handle)
|
||||||
|
if obj.get_path():
|
||||||
image = ImgManip.get_thumbnail_image(obj.get_path())
|
image = ImgManip.get_thumbnail_image(obj.get_path())
|
||||||
context.set_icon_pixbuf(image,0,0)
|
context.set_icon_pixbuf(image,0,0)
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gtk
|
import gtk
|
||||||
|
import gtk.glade
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -33,6 +34,8 @@ import gtk
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
import const
|
||||||
|
import Utils
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -41,9 +44,10 @@ from gettext import gettext as _
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class NoteEditor:
|
class NoteEditor:
|
||||||
"""Displays a simple text editor that allows a person to edit a note"""
|
"""Displays a simple text editor that allows a person to edit a note"""
|
||||||
def __init__(self,data,parent,parent_window=None):
|
def __init__(self,data,parent,parent_window=None,callback=None):
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.callback = callback
|
||||||
if data:
|
if data:
|
||||||
if self.parent.child_windows.has_key(data):
|
if self.parent.child_windows.has_key(data):
|
||||||
self.parent.child_windows[data].present(None)
|
self.parent.child_windows[data].present(None)
|
||||||
@ -54,45 +58,36 @@ class NoteEditor:
|
|||||||
self.win_key = self
|
self.win_key = self
|
||||||
self.data = data
|
self.data = data
|
||||||
self.parent_window = parent_window
|
self.parent_window = parent_window
|
||||||
|
self.glade = gtk.glade.XML(const.gladeFile,"note_edit")
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
"""Displays the NoteEditor window"""
|
"""Displays the NoteEditor window"""
|
||||||
title = "%s - GRAMPS" % _("Edit Note")
|
title = "%s - GRAMPS" % _("Edit Note")
|
||||||
|
|
||||||
self.top = gtk.Dialog(title)
|
self.top = self.glade.get_widget('note_edit')
|
||||||
self.top.set_default_size(450,300)
|
alt_title = self.glade.get_widget('title_msg')
|
||||||
|
Utils.set_titles(self.top, alt_title, _('Note Editor'))
|
||||||
|
|
||||||
vbox = gtk.VBox()
|
if self.callback:
|
||||||
self.top.vbox.pack_start(vbox,gtk.TRUE,gtk.TRUE,0)
|
self.title_entry = self.glade.get_widget('title')
|
||||||
label = gtk.Label('<span weight="bold" size="larger">%s</span>' % _('Edit Note'))
|
self.title_entry.set_text(self.data.get_description())
|
||||||
label.set_use_markup(gtk.TRUE)
|
else:
|
||||||
vbox.pack_start(label, gtk.FALSE, gtk.FALSE, 10)
|
self.glade.get_widget('tbox').hide()
|
||||||
|
|
||||||
self.entry = gtk.TextView()
|
self.entry = self.glade.get_widget('note')
|
||||||
self.entry.set_editable(gtk.TRUE)
|
self.entry.set_editable(gtk.TRUE)
|
||||||
self.entry.show()
|
|
||||||
|
|
||||||
scroll = gtk.ScrolledWindow()
|
|
||||||
scroll.add(self.entry)
|
|
||||||
scroll.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
|
||||||
scroll.set_shadow_type(gtk.SHADOW_IN)
|
|
||||||
scroll.show()
|
|
||||||
vbox.pack_start(scroll, gtk.TRUE, gtk.TRUE, 0)
|
|
||||||
|
|
||||||
self.entry.get_buffer().set_text(self.data.get_note())
|
self.entry.get_buffer().set_text(self.data.get_note())
|
||||||
|
|
||||||
cancel_button = self.top.add_button(gtk.STOCK_CANCEL,1)
|
cancel_button = self.glade.get_widget('cancel')
|
||||||
ok_button = self.top.add_button(gtk.STOCK_OK,0)
|
ok_button = self.glade.get_widget('ok')
|
||||||
cancel_button.connect("clicked",self.close)
|
cancel_button.connect("clicked",self.close)
|
||||||
ok_button.connect("clicked",self.on_save_note_clicked)
|
ok_button.connect("clicked",self.on_save_note_clicked)
|
||||||
self.top.connect("delete_event",self.on_delete_event)
|
self.top.connect("delete_event",self.on_delete_event)
|
||||||
self.top.show_all()
|
|
||||||
|
|
||||||
if self.parent_window:
|
if self.parent_window:
|
||||||
self.top.set_transient_for(self.parent_window)
|
self.top.set_transient_for(self.parent_window)
|
||||||
self.add_itself_to_menu()
|
self.add_itself_to_menu()
|
||||||
self.top.show()
|
|
||||||
|
|
||||||
def on_delete_event(self,*obj):
|
def on_delete_event(self,*obj):
|
||||||
self.remove_itself_from_menu()
|
self.remove_itself_from_menu()
|
||||||
@ -122,4 +117,7 @@ class NoteEditor:
|
|||||||
tbuffer.get_end_iter(),gtk.FALSE))
|
tbuffer.get_end_iter(),gtk.FALSE))
|
||||||
if text != self.data.get_note():
|
if text != self.data.get_note():
|
||||||
self.data.set_note(text)
|
self.data.set_note(text)
|
||||||
|
if self.callback:
|
||||||
|
self.data.set_description(self.title_entry.get_text())
|
||||||
|
self.callback(self.data)
|
||||||
self.close(obj)
|
self.close(obj)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -59,6 +59,7 @@ import BaseDoc
|
|||||||
from NameDisplay import displayer as _nd
|
from NameDisplay import displayer as _nd
|
||||||
from DateHandler import displayer as _dd
|
from DateHandler import displayer as _dd
|
||||||
import ReportUtils
|
import ReportUtils
|
||||||
|
import sets
|
||||||
|
|
||||||
_NARRATIVE = "narrative.css"
|
_NARRATIVE = "narrative.css"
|
||||||
|
|
||||||
@ -134,8 +135,9 @@ class BasePage:
|
|||||||
ofile.write('<br>\n')
|
ofile.write('<br>\n')
|
||||||
ofile.write('<br>\n')
|
ofile.write('<br>\n')
|
||||||
ofile.write('<hr>\n')
|
ofile.write('<hr>\n')
|
||||||
ofile.write('<div class="footer">')
|
ofile.write('<div class="footer">Generated by ')
|
||||||
ofile.write('Generated by <a href="http://gramps.sourceforge.net">GRAMPS</a> on 13 December 2004.')
|
ofile.write('<a href="http://gramps.sourceforge.net">GRAMPS</a> ')
|
||||||
|
ofile.write('on 13 December 2004.')
|
||||||
ofile.write('</div>\n')
|
ofile.write('</div>\n')
|
||||||
ofile.write('</body>\n')
|
ofile.write('</body>\n')
|
||||||
ofile.write('</html>\n')
|
ofile.write('</html>\n')
|
||||||
@ -225,7 +227,7 @@ class IndividualListPage(BasePage):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class PlaceListPage(BasePage):
|
class PlaceListPage(BasePage):
|
||||||
|
|
||||||
def __init__(self, db, title, handle_list, html_dir):
|
def __init__(self, db, title, place_handles, html_dir, src_list):
|
||||||
BasePage.__init__(self,title)
|
BasePage.__init__(self,title)
|
||||||
page_name = os.path.join(html_dir,"places.html")
|
page_name = os.path.join(html_dir,"places.html")
|
||||||
ofile = open(page_name, "w")
|
ofile = open(page_name, "w")
|
||||||
@ -246,6 +248,7 @@ class PlaceListPage(BasePage):
|
|||||||
ofile.write('</tr>\n')
|
ofile.write('</tr>\n')
|
||||||
|
|
||||||
self.sort = Sort.Sort(db)
|
self.sort = Sort.Sort(db)
|
||||||
|
handle_list = list(place_handles)
|
||||||
handle_list.sort(self.sort.by_place_title)
|
handle_list.sort(self.sort.by_place_title)
|
||||||
last_name = ""
|
last_name = ""
|
||||||
last_letter = ''
|
last_letter = ''
|
||||||
@ -388,7 +391,7 @@ class HomePage(BasePage):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class SourcesPage(BasePage):
|
class SourcesPage(BasePage):
|
||||||
|
|
||||||
def __init__(self, db, title, handle_list, html_dir):
|
def __init__(self, db, title, handle_set, html_dir):
|
||||||
BasePage.__init__(self,title)
|
BasePage.__init__(self,title)
|
||||||
page_name = os.path.join(html_dir,"sources.html")
|
page_name = os.path.join(html_dir,"sources.html")
|
||||||
|
|
||||||
@ -396,7 +399,19 @@ class SourcesPage(BasePage):
|
|||||||
self.display_header(ofile,_('Sources'),
|
self.display_header(ofile,_('Sources'),
|
||||||
db.get_researcher().get_name())
|
db.get_researcher().get_name())
|
||||||
|
|
||||||
ofile.write('<h3>%s</h3>\n' % _('Sources'))
|
handle_list = list(handle_set)
|
||||||
|
|
||||||
|
ofile.write('<h3>%s</h3>\n<p>' % _('Sources'))
|
||||||
|
ofile.write(_('All sources cited in the project.'))
|
||||||
|
ofile.write('</p>\n<blockquote>\n<table class="infolist">\n')
|
||||||
|
|
||||||
|
index = 1
|
||||||
|
for handle in handle_list:
|
||||||
|
ofile.write('<tr><td class="category">%d.</td>\n' % index)
|
||||||
|
ofile.write('<td class="data">')
|
||||||
|
ofile.write('</td></tr>\n')
|
||||||
|
|
||||||
|
ofile.write('</table>\n<blockquote>\n')
|
||||||
|
|
||||||
self.display_footer(ofile)
|
self.display_footer(ofile)
|
||||||
ofile.close()
|
ofile.close()
|
||||||
@ -454,19 +469,20 @@ class IndividualPage(BasePage):
|
|||||||
RelLib.Person.UNKNOWN : const.unknown,
|
RelLib.Person.UNKNOWN : const.unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, db, person, title, dirpath, ind_list):
|
def __init__(self, db, person, title, dirpath, ind_list,
|
||||||
|
place_list, src_list):
|
||||||
BasePage.__init__(self,title)
|
BasePage.__init__(self,title)
|
||||||
self.person = person
|
self.person = person
|
||||||
self.db = db
|
self.db = db
|
||||||
self.ind_list = ind_list
|
self.ind_list = ind_list
|
||||||
self.dirpath = dirpath
|
self.dirpath = dirpath
|
||||||
|
self.src_list = src_list
|
||||||
gramps_id = self.person.get_gramps_id()
|
self.place_list = place_list
|
||||||
self.sort_name = _nd.sorted(self.person)
|
self.sort_name = _nd.sorted(self.person)
|
||||||
self.name = _nd.sorted(self.person)
|
self.name = _nd.sorted(self.person)
|
||||||
|
|
||||||
ofile = open(os.path.join(dirpath,"%s.html" % gramps_id), "w")
|
ofile = open(os.path.join(dirpath,"%s.html" % person.gramps_id), "w")
|
||||||
self.display_header(ofile, 'My Family Tree',
|
self.display_header(ofile, title,
|
||||||
self.db.get_researcher().get_name())
|
self.db.get_researcher().get_name())
|
||||||
self.display_ind_general(ofile)
|
self.display_ind_general(ofile)
|
||||||
self.display_ind_events(ofile)
|
self.display_ind_events(ofile)
|
||||||
@ -488,6 +504,8 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
index = 1
|
index = 1
|
||||||
for sref in sreflist:
|
for sref in sreflist:
|
||||||
|
self.src_list.add(sref.get_base_handle())
|
||||||
|
|
||||||
source = self.db.get_source_from_handle(sref.get_base_handle())
|
source = self.db.get_source_from_handle(sref.get_base_handle())
|
||||||
author = source.get_author()
|
author = source.get_author()
|
||||||
title = source.get_title()
|
title = source.get_title()
|
||||||
@ -761,9 +779,12 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
def format_event(self,event):
|
def format_event(self,event):
|
||||||
descr = event.get_description()
|
descr = event.get_description()
|
||||||
place = ReportUtils.place_name(self.db,event.get_place_handle())
|
place_handle = event.get_place_handle()
|
||||||
date = _dd.display(event.get_date_object())
|
if place_handle:
|
||||||
|
self.place_list.add(place_handle)
|
||||||
|
place = ReportUtils.place_name(self.db,place_handle)
|
||||||
|
|
||||||
|
date = _dd.display(event.get_date_object())
|
||||||
tmap = {'description' : descr, 'date' : date, 'place' : place}
|
tmap = {'description' : descr, 'date' : date, 'place' : place}
|
||||||
|
|
||||||
if descr and date and place:
|
if descr and date and place:
|
||||||
@ -903,9 +924,13 @@ class WebReport(Report.Report):
|
|||||||
DownloadPage(self.database,self.title,dir_name)
|
DownloadPage(self.database,self.title,dir_name)
|
||||||
IntroductionPage(self.database,self.title,dir_name)
|
IntroductionPage(self.database,self.title,dir_name)
|
||||||
|
|
||||||
|
place_list = sets.Set()
|
||||||
|
source_list = sets.Set()
|
||||||
|
|
||||||
for person_handle in ind_list:
|
for person_handle in ind_list:
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
idoc = IndividualPage(self.database,person,self.title,dir_name, ind_list)
|
idoc = IndividualPage(self.database, person, self.title,
|
||||||
|
dir_name, ind_list, place_list, source_list)
|
||||||
self.progress_bar_step()
|
self.progress_bar_step()
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration()
|
gtk.main_iteration()
|
||||||
@ -917,10 +942,9 @@ class WebReport(Report.Report):
|
|||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration()
|
gtk.main_iteration()
|
||||||
|
|
||||||
SourcesPage(self.database,self.title,
|
PlaceListPage(self.database, self.title, place_list,
|
||||||
self.database.get_source_handles(),dir_name)
|
dir_name, source_list)
|
||||||
PlaceListPage(self.database,self.title,
|
SourcesPage(self.database,self.title, source_list, dir_name)
|
||||||
self.database.get_place_handles(),dir_name)
|
|
||||||
self.progress_bar_done()
|
self.progress_bar_done()
|
||||||
|
|
||||||
def write_css(self,dir_name):
|
def write_css(self,dir_name):
|
||||||
|
Loading…
Reference in New Issue
Block a user