Web page enhancements
svn: r796
This commit is contained in:
parent
80313f3ec5
commit
e78176cb80
125
gramps/src/DbPrompter.py
Normal file
125
gramps/src/DbPrompter.py
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
#! /usr/bin/python -O
|
||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000 Donald N. Allingham
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# libraries
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
import libglade
|
||||||
|
import Utils
|
||||||
|
import gtk
|
||||||
|
import const
|
||||||
|
import GrampsCfg
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Make sure a database is opened
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class DbPrompter:
|
||||||
|
def __init__(self,db,want_new):
|
||||||
|
self.db = db
|
||||||
|
self.want_new = want_new
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
opendb = libglade.GladeXML(const.gladeFile, "opendb")
|
||||||
|
opendb.signal_autoconnect({
|
||||||
|
"on_open_ok_clicked" : self.open_ok_clicked,
|
||||||
|
"on_open_cancel_clicked" : self.open_cancel_clicked,
|
||||||
|
"on_opendb_delete_event": self.open_delete_event,
|
||||||
|
})
|
||||||
|
self.new = opendb.get_widget("new")
|
||||||
|
if self.want_new:
|
||||||
|
self.new.set_active(1)
|
||||||
|
|
||||||
|
def open_ok_clicked(self,obj):
|
||||||
|
if self.new.get_active():
|
||||||
|
self.save_as_activate()
|
||||||
|
else:
|
||||||
|
self.open_activate()
|
||||||
|
Utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
|
def save_as_activate(self):
|
||||||
|
wFs = libglade.GladeXML (const.gladeFile, "fileselection")
|
||||||
|
wFs.signal_autoconnect({
|
||||||
|
"on_ok_button1_clicked": self.save_ok_button_clicked,
|
||||||
|
"destroy_passed_object": self.cancel_button_clicked,
|
||||||
|
})
|
||||||
|
|
||||||
|
def save_ok_button_clicked(self,obj):
|
||||||
|
filename = obj.get_filename()
|
||||||
|
if filename:
|
||||||
|
Utils.destroy_passed_object(obj)
|
||||||
|
if GrampsCfg.usevc and GrampsCfg.vc_comment:
|
||||||
|
self.db.display_comment_box(filename)
|
||||||
|
else:
|
||||||
|
self.db.save_file(filename,_("No Comment Provided"))
|
||||||
|
|
||||||
|
def open_activate(self):
|
||||||
|
wFs = libglade.GladeXML(const.revisionFile, "dbopen")
|
||||||
|
wFs.signal_autoconnect({
|
||||||
|
"on_ok_button1_clicked": self.ok_button_clicked,
|
||||||
|
"destroy_passed_object": self.cancel_button_clicked,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.fileSelector = wFs.get_widget("dbopen")
|
||||||
|
self.dbname = wFs.get_widget("dbname")
|
||||||
|
self.getoldrev = wFs.get_widget("getoldrev")
|
||||||
|
self.dbname.set_default_path(GrampsCfg.db_dir)
|
||||||
|
self.getoldrev.set_sensitive(GrampsCfg.usevc)
|
||||||
|
|
||||||
|
def cancel_button_clicked(self,obj):
|
||||||
|
Utils.destroy_passed_object(obj)
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
def ok_button_clicked(self,obj):
|
||||||
|
filename = self.dbname.get_full_path(0)
|
||||||
|
|
||||||
|
if not filename:
|
||||||
|
return
|
||||||
|
|
||||||
|
Utils.destroy_passed_object(obj)
|
||||||
|
self.db.clear_database()
|
||||||
|
|
||||||
|
if self.getoldrev.get_active():
|
||||||
|
vc = VersionControl.RcsVersionControl(filename)
|
||||||
|
VersionControl.RevisionSelect(self.db.database,filename,vc,
|
||||||
|
self.db.load_revision,self.show)
|
||||||
|
else:
|
||||||
|
self.db.read_file(filename)
|
||||||
|
|
||||||
|
def open_delete_event(self,obj,event):
|
||||||
|
gtk.mainquit()
|
||||||
|
|
||||||
|
def open_cancel_clicked(self,obj):
|
||||||
|
gtk.mainquit()
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Start it all
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
if __name__ == '__main__':
|
||||||
|
Gramps(None)
|
||||||
|
gtk.mainloop()
|
@ -105,6 +105,13 @@ class LdsOrd(SourceNote):
|
|||||||
self.status = 0
|
self.status = 0
|
||||||
self.place = None
|
self.place = None
|
||||||
|
|
||||||
|
def getPlaceName(self):
|
||||||
|
"""returns the title of the Place associated with the Ordinance"""
|
||||||
|
if self.place:
|
||||||
|
return self.place.get_title()
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
def setPlace(self,place):
|
def setPlace(self,place):
|
||||||
"""sets the Place instance of the Event"""
|
"""sets the Place instance of the Event"""
|
||||||
self.place = place
|
self.place = place
|
||||||
|
@ -673,7 +673,6 @@ class ReportDialog:
|
|||||||
table.attach(self.extra_textbox_label,0,1,row,row+1,FILL,FILL,pad,pad)
|
table.attach(self.extra_textbox_label,0,1,row,row+1,FILL,FILL,pad,pad)
|
||||||
table.attach(self.extra_textbox,1,2,row,row+1,xpadding=pad,ypadding=pad)
|
table.attach(self.extra_textbox,1,2,row,row+1,xpadding=pad,ypadding=pad)
|
||||||
row = row + 1
|
row = row + 1
|
||||||
# self.topDialog.get_widget("extra_scrolledwindow").show()
|
|
||||||
|
|
||||||
# Setup requested widgets
|
# Setup requested widgets
|
||||||
for (text,widget) in self.widgets:
|
for (text,widget) in self.widgets:
|
||||||
|
@ -76,6 +76,7 @@ class HtmlDoc(TextDoc):
|
|||||||
self.load_template()
|
self.load_template()
|
||||||
self.build_header()
|
self.build_header()
|
||||||
self.build_style_declaration()
|
self.build_style_declaration()
|
||||||
|
self.image_dir = "images"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.f = None
|
self.f = None
|
||||||
@ -88,7 +89,11 @@ class HtmlDoc(TextDoc):
|
|||||||
self.style_declaration = source.style_declaration
|
self.style_declaration = source.style_declaration
|
||||||
self.table_styles = source.table_styles;
|
self.table_styles = source.table_styles;
|
||||||
self.cell_styles = source.cell_styles;
|
self.cell_styles = source.cell_styles;
|
||||||
|
self.image_dir = source.image_dir
|
||||||
|
|
||||||
|
def set_image_dir(self,dirname):
|
||||||
|
self.image_dir = dirname
|
||||||
|
|
||||||
def load_template(self):
|
def load_template(self):
|
||||||
start = re.compile(r"<!--\s*START\s*-->")
|
start = re.compile(r"<!--\s*START\s*-->")
|
||||||
stop = re.compile(r"<!--\s*STOP\s*-->")
|
stop = re.compile(r"<!--\s*STOP\s*-->")
|
||||||
@ -232,7 +237,11 @@ class HtmlDoc(TextDoc):
|
|||||||
size = int(max(x,y) * float(150.0/2.54))
|
size = int(max(x,y) * float(150.0/2.54))
|
||||||
|
|
||||||
refname = "is%s" % os.path.basename(name)
|
refname = "is%s" % os.path.basename(name)
|
||||||
imdir = self.base + os.sep + "images"
|
|
||||||
|
if self.image_dir:
|
||||||
|
imdir = "%s/%s" % (self.base,self.image_dir)
|
||||||
|
else:
|
||||||
|
imdir = self.base
|
||||||
|
|
||||||
if not os.path.isdir(imdir):
|
if not os.path.isdir(imdir):
|
||||||
try:
|
try:
|
||||||
@ -242,7 +251,7 @@ class HtmlDoc(TextDoc):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = ImgManip.ImgManip(name)
|
img = ImgManip.ImgManip(name)
|
||||||
img.jpg_thumbnail(imdir + os.sep + refname,size,size)
|
img.jpg_thumbnail("%s/%s" % (imdir,refname),size,size)
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -253,8 +262,11 @@ class HtmlDoc(TextDoc):
|
|||||||
else:
|
else:
|
||||||
xtra = ''
|
xtra = ''
|
||||||
|
|
||||||
self.f.write('<img src="images/%s" border="0""%s>\n' % \
|
if self.image_dir:
|
||||||
(refname,xtra))
|
self.f.write('<img src="%s/%s" border="0""%s>\n' % \
|
||||||
|
(self.image_dir,refname,xtra))
|
||||||
|
else:
|
||||||
|
self.f.write('<img src="%s" border="0""%s>\n' % (refname,xtra))
|
||||||
|
|
||||||
def start_table(self,name,style):
|
def start_table(self,name,style):
|
||||||
self.tbl = self.table_styles[style]
|
self.tbl = self.table_styles[style]
|
||||||
|
@ -70,6 +70,7 @@ import EditPerson
|
|||||||
import Marriage
|
import Marriage
|
||||||
import Find
|
import Find
|
||||||
import VersionControl
|
import VersionControl
|
||||||
|
import WriteXML
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -95,10 +96,10 @@ class Gramps:
|
|||||||
self.c_gender = 3
|
self.c_gender = 3
|
||||||
self.c_id = 2
|
self.c_id = 2
|
||||||
self.c_name = 1
|
self.c_name = 1
|
||||||
self.c_sort_column = self.c_birth_order
|
self.c_sort_col = self.c_birth_order
|
||||||
self.c_sort_direct = GTK.SORT_ASCENDING
|
self.c_sort_dir = GTK.SORT_ASCENDING
|
||||||
self.sort_column = 0
|
self.sort_col = 0
|
||||||
self.sort_direct = GTK.SORT_ASCENDING
|
self.sort_dir = GTK.SORT_ASCENDING
|
||||||
self.id2col = {}
|
self.id2col = {}
|
||||||
self.alt2col = {}
|
self.alt2col = {}
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ class Gramps:
|
|||||||
|
|
||||||
self.database = GrampsDB()
|
self.database = GrampsDB()
|
||||||
|
|
||||||
(self.sort_column,self.sort_direct) = GrampsCfg.get_sort_cols("person",self.sort_column,self.sort_direct)
|
(self.sort_col,self.sort_dir) = GrampsCfg.get_sort_cols("person",self.sort_col,self.sort_dir)
|
||||||
|
|
||||||
GrampsCfg.loadConfig(self.full_update)
|
GrampsCfg.loadConfig(self.full_update)
|
||||||
self.init_interface()
|
self.init_interface()
|
||||||
@ -119,8 +120,8 @@ class Gramps:
|
|||||||
self.col_arr = [ self.nameArrow, self.idArrow, self.genderArrow,
|
self.col_arr = [ self.nameArrow, self.idArrow, self.genderArrow,
|
||||||
self.dateArrow, self.deathArrow]
|
self.dateArrow, self.deathArrow]
|
||||||
|
|
||||||
self.change_sort(self.sort_column,self.sort_direct==GTK.SORT_DESCENDING)
|
self.change_sort(self.sort_col,self.sort_dir==GTK.SORT_DESCENDING)
|
||||||
self.set_sort_arrow(self.sort_column,self.sort_direct)
|
self.set_sort_arrow(self.sort_col,self.sort_dir)
|
||||||
|
|
||||||
self.database.set_iprefix(GrampsCfg.iprefix)
|
self.database.set_iprefix(GrampsCfg.iprefix)
|
||||||
self.database.set_oprefix(GrampsCfg.oprefix)
|
self.database.set_oprefix(GrampsCfg.oprefix)
|
||||||
@ -133,7 +134,8 @@ class Gramps:
|
|||||||
elif GrampsCfg.lastfile != None and GrampsCfg.lastfile != "" and GrampsCfg.autoload:
|
elif GrampsCfg.lastfile != None and GrampsCfg.lastfile != "" and GrampsCfg.autoload:
|
||||||
self.auto_save_load(GrampsCfg.lastfile)
|
self.auto_save_load(GrampsCfg.lastfile)
|
||||||
else:
|
else:
|
||||||
DbPrompter(self,0)
|
import DbPrompter
|
||||||
|
DbPrompter.DbPrompter(self,0)
|
||||||
|
|
||||||
if GrampsCfg.autosave_int != 0:
|
if GrampsCfg.autosave_int != 0:
|
||||||
Utils.enable_autosave(self.autosave_database,GrampsCfg.autosave_int)
|
Utils.enable_autosave(self.autosave_database,GrampsCfg.autosave_int)
|
||||||
@ -141,6 +143,9 @@ class Gramps:
|
|||||||
self.database.setResearcher(GrampsCfg.get_researcher())
|
self.database.setResearcher(GrampsCfg.get_researcher())
|
||||||
|
|
||||||
def init_interface(self):
|
def init_interface(self):
|
||||||
|
"""Initializes the GLADE interface, and gets references to the
|
||||||
|
widgets that it will need.
|
||||||
|
"""
|
||||||
self.gtop = libglade.GladeXML(const.gladeFile, "gramps")
|
self.gtop = libglade.GladeXML(const.gladeFile, "gramps")
|
||||||
|
|
||||||
self.statusbar = self.gtop.get_widget("statusbar")
|
self.statusbar = self.gtop.get_widget("statusbar")
|
||||||
@ -507,10 +512,11 @@ class Gramps:
|
|||||||
gnome.ui.GnomeQuestionDialog(msg,self.new_database_response)
|
gnome.ui.GnomeQuestionDialog(msg,self.new_database_response)
|
||||||
|
|
||||||
def new_database_response(self,val):
|
def new_database_response(self,val):
|
||||||
|
import DbPrompter
|
||||||
if val == 1:
|
if val == 1:
|
||||||
return
|
return
|
||||||
self.clear_database()
|
self.clear_database()
|
||||||
DbPrompter(self.database,1)
|
DbPrompter.DbPrompter(self.database,1)
|
||||||
|
|
||||||
def clear_database(self):
|
def clear_database(self):
|
||||||
"""Clear out the database if permission was granted"""
|
"""Clear out the database if permission was granted"""
|
||||||
@ -641,6 +647,7 @@ class Gramps:
|
|||||||
self.displayError(_("%s is not a directory") % filename)
|
self.displayError(_("%s is not a directory") % filename)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
self.statusbar.set_status(_("Loading %s ...") % filename)
|
self.statusbar.set_status(_("Loading %s ...") % filename)
|
||||||
|
|
||||||
if self.load_database(filename) == 1:
|
if self.load_database(filename) == 1:
|
||||||
@ -662,7 +669,6 @@ class Gramps:
|
|||||||
self.save_file(filename,_("No Comment Provided"))
|
self.save_file(filename,_("No Comment Provided"))
|
||||||
|
|
||||||
def save_file(self,filename,comment):
|
def save_file(self,filename,comment):
|
||||||
import WriteXML
|
|
||||||
|
|
||||||
path = filename
|
path = filename
|
||||||
filename = os.path.normpath(filename)
|
filename = os.path.normpath(filename)
|
||||||
@ -680,14 +686,10 @@ class Gramps:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.mkdir(filename)
|
os.mkdir(filename)
|
||||||
except IOError, msg:
|
except (OSError,IOError), msg:
|
||||||
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename +\
|
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename +\
|
||||||
"\n" + str(msg))
|
"\n" + str(msg))
|
||||||
return
|
return
|
||||||
except OSError, msg:
|
|
||||||
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename + \
|
|
||||||
"\n" + str(msg))
|
|
||||||
return
|
|
||||||
except:
|
except:
|
||||||
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename)
|
gnome.ui.GnomeErrorDialog(_("Could not create %s") % filename)
|
||||||
return
|
return
|
||||||
@ -726,7 +728,6 @@ class Gramps:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def autosave_database(self):
|
def autosave_database(self):
|
||||||
import WriteXML
|
|
||||||
|
|
||||||
path = self.database.getSavePath()
|
path = self.database.getSavePath()
|
||||||
filename = os.path.normpath(path)
|
filename = os.path.normpath(path)
|
||||||
@ -738,8 +739,8 @@ class Gramps:
|
|||||||
try:
|
try:
|
||||||
WriteXML.quick_write(self.database,filename,self.quick_progress)
|
WriteXML.quick_write(self.database,filename,self.quick_progress)
|
||||||
self.statusbar.set_status(_("autosave complete"));
|
self.statusbar.set_status(_("autosave complete"));
|
||||||
except (IOError,OSError):
|
except (IOError,OSError),msg:
|
||||||
self.statusbar.set_status(_("autosave failed"));
|
self.statusbar.set_status(_("autosave failed") + (" - %s" % msg));
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
@ -855,9 +856,7 @@ class Gramps:
|
|||||||
def on_person_list_click_column(self,obj,column):
|
def on_person_list_click_column(self,obj,column):
|
||||||
self.change_sort(column)
|
self.change_sort(column)
|
||||||
|
|
||||||
|
|
||||||
def set_sort_arrow(self,column,direct):
|
def set_sort_arrow(self,column,direct):
|
||||||
|
|
||||||
arrow = self.col_arr[column]
|
arrow = self.col_arr[column]
|
||||||
for a in self.col_arr:
|
for a in self.col_arr:
|
||||||
if arrow != a:
|
if arrow != a:
|
||||||
@ -869,7 +868,6 @@ class Gramps:
|
|||||||
arrow.set(GTK.ARROW_UP,2)
|
arrow.set(GTK.ARROW_UP,2)
|
||||||
|
|
||||||
def change_sort(self,column,change=1):
|
def change_sort(self,column,change=1):
|
||||||
|
|
||||||
arrow = self.col_arr[column]
|
arrow = self.col_arr[column]
|
||||||
for a in self.col_arr:
|
for a in self.col_arr:
|
||||||
if arrow != a:
|
if arrow != a:
|
||||||
@ -877,28 +875,28 @@ class Gramps:
|
|||||||
arrow.show()
|
arrow.show()
|
||||||
|
|
||||||
self.person_list.set_sort_column(self.col_map[column])
|
self.person_list.set_sort_column(self.col_map[column])
|
||||||
self.person_list.set_sort_type(self.sort_direct)
|
self.person_list.set_sort_type(self.sort_dir)
|
||||||
|
|
||||||
self.sort_person_list()
|
self.sort_person_list()
|
||||||
|
|
||||||
if change:
|
if change:
|
||||||
if self.sort_column == column:
|
if self.sort_col == column:
|
||||||
if self.sort_direct == GTK.SORT_DESCENDING:
|
if self.sort_dir == GTK.SORT_DESCENDING:
|
||||||
self.sort_direct = GTK.SORT_ASCENDING
|
self.sort_dir = GTK.SORT_ASCENDING
|
||||||
arrow.set(GTK.ARROW_DOWN,2)
|
arrow.set(GTK.ARROW_DOWN,2)
|
||||||
else:
|
else:
|
||||||
self.sort_direct = GTK.SORT_DESCENDING
|
self.sort_dir = GTK.SORT_DESCENDING
|
||||||
arrow.set(GTK.ARROW_UP,2)
|
arrow.set(GTK.ARROW_UP,2)
|
||||||
else:
|
else:
|
||||||
self.sort_direct = GTK.SORT_ASCENDING
|
self.sort_dir = GTK.SORT_ASCENDING
|
||||||
arrow.set(GTK.ARROW_DOWN,2)
|
arrow.set(GTK.ARROW_DOWN,2)
|
||||||
self.sort_column = column
|
self.sort_col = column
|
||||||
|
|
||||||
if self.id2col.has_key(self.active_person):
|
if self.id2col.has_key(self.active_person):
|
||||||
data = self.id2col[self.active_person]
|
data = self.id2col[self.active_person]
|
||||||
row = self.person_list.find_row_from_data(data)
|
row = self.person_list.find_row_from_data(data)
|
||||||
self.person_list.moveto(row)
|
self.person_list.moveto(row)
|
||||||
GrampsCfg.save_sort_cols("person",self.sort_column,self.sort_direct)
|
GrampsCfg.save_sort_cols("person",self.sort_col,self.sort_dir)
|
||||||
|
|
||||||
def sort_person_list(self):
|
def sort_person_list(self):
|
||||||
self.person_list.freeze()
|
self.person_list.freeze()
|
||||||
@ -1004,19 +1002,19 @@ class Gramps:
|
|||||||
self.cGenderArrow.hide()
|
self.cGenderArrow.hide()
|
||||||
arrow.show()
|
arrow.show()
|
||||||
|
|
||||||
if self.c_sort_column == column:
|
if self.c_sort_col == column:
|
||||||
if self.c_sort_direct == GTK.SORT_DESCENDING:
|
if self.c_sort_dir == GTK.SORT_DESCENDING:
|
||||||
self.c_sort_direct = GTK.SORT_ASCENDING
|
self.c_sort_dir = GTK.SORT_ASCENDING
|
||||||
arrow.set(GTK.ARROW_DOWN,2)
|
arrow.set(GTK.ARROW_DOWN,2)
|
||||||
else:
|
else:
|
||||||
self.c_sort_direct = GTK.SORT_DESCENDING
|
self.c_sort_dir = GTK.SORT_DESCENDING
|
||||||
arrow.set(GTK.ARROW_UP,2)
|
arrow.set(GTK.ARROW_UP,2)
|
||||||
else:
|
else:
|
||||||
self.c_sort_direct = GTK.SORT_ASCENDING
|
self.c_sort_dir = GTK.SORT_ASCENDING
|
||||||
self.c_sort_column = column
|
self.c_sort_col = column
|
||||||
clist.set_sort_type(self.c_sort_direct)
|
clist.set_sort_type(self.c_sort_dir)
|
||||||
clist.set_sort_column(self.c_sort_column)
|
clist.set_sort_column(self.c_sort_col)
|
||||||
clist.set_reorderable(self.c_sort_column == self.c_birth_order)
|
clist.set_reorderable(self.c_sort_col == self.c_birth_order)
|
||||||
|
|
||||||
def sort_child_list(self,clist):
|
def sort_child_list(self,clist):
|
||||||
clist.freeze()
|
clist.freeze()
|
||||||
@ -1069,7 +1067,7 @@ class Gramps:
|
|||||||
|
|
||||||
# This function deals with ascending order lists. Convert if
|
# This function deals with ascending order lists. Convert if
|
||||||
# necessary.
|
# necessary.
|
||||||
if (self.c_sort_direct == GTK.SORT_DESCENDING):
|
if (self.c_sort_dir == GTK.SORT_DESCENDING):
|
||||||
clist_order.reverse()
|
clist_order.reverse()
|
||||||
max_index = len(clist_order) - 1
|
max_index = len(clist_order) - 1
|
||||||
fm = max_index - fm
|
fm = max_index - fm
|
||||||
@ -1098,7 +1096,7 @@ class Gramps:
|
|||||||
|
|
||||||
# Convert the original list back to whatever ordering is being
|
# Convert the original list back to whatever ordering is being
|
||||||
# used by the clist itself.
|
# used by the clist itself.
|
||||||
if (self.c_sort_direct == GTK.SORT_DESCENDING):
|
if (self.c_sort_dir == GTK.SORT_DESCENDING):
|
||||||
clist_order.reverse()
|
clist_order.reverse()
|
||||||
|
|
||||||
# Update the clist indices so any change of sorting works
|
# Update the clist indices so any change of sorting works
|
||||||
@ -1494,9 +1492,9 @@ class Gramps:
|
|||||||
self.active_child = None
|
self.active_child = None
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
self.child_list.set_sort_type(self.c_sort_direct)
|
self.child_list.set_sort_type(self.c_sort_dir)
|
||||||
self.child_list.set_sort_column(self.c_sort_column)
|
self.child_list.set_sort_column(self.c_sort_col)
|
||||||
self.child_list.set_reorderable(self.c_sort_column == self.c_birth_order)
|
self.child_list.set_reorderable(self.c_sort_col == self.c_birth_order)
|
||||||
|
|
||||||
if family != None:
|
if family != None:
|
||||||
if self.active_person.getGender() == Person.male:
|
if self.active_person.getGender() == Person.male:
|
||||||
@ -1783,92 +1781,6 @@ class Gramps:
|
|||||||
elif event.keyval == GDK.Insert:
|
elif event.keyval == GDK.Insert:
|
||||||
self.load_new_person(obj)
|
self.load_new_person(obj)
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Make sure a database is opened
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class DbPrompter:
|
|
||||||
def __init__(self,db,want_new):
|
|
||||||
self.db = db
|
|
||||||
self.want_new = want_new
|
|
||||||
self.show()
|
|
||||||
|
|
||||||
def show(self):
|
|
||||||
opendb = libglade.GladeXML(const.gladeFile, "opendb")
|
|
||||||
opendb.signal_autoconnect({
|
|
||||||
"on_open_ok_clicked" : self.open_ok_clicked,
|
|
||||||
"on_open_cancel_clicked" : self.open_cancel_clicked,
|
|
||||||
"on_opendb_delete_event": self.open_delete_event,
|
|
||||||
})
|
|
||||||
self.new = opendb.get_widget("new")
|
|
||||||
if self.want_new:
|
|
||||||
self.new.set_active(1)
|
|
||||||
|
|
||||||
def open_ok_clicked(self,obj):
|
|
||||||
if self.new.get_active():
|
|
||||||
self.save_as_activate()
|
|
||||||
else:
|
|
||||||
self.open_activate()
|
|
||||||
Utils.destroy_passed_object(obj)
|
|
||||||
|
|
||||||
def save_as_activate(self):
|
|
||||||
wFs = libglade.GladeXML (const.gladeFile, "fileselection")
|
|
||||||
wFs.signal_autoconnect({
|
|
||||||
"on_ok_button1_clicked": self.save_ok_button_clicked,
|
|
||||||
"destroy_passed_object": self.cancel_button_clicked,
|
|
||||||
})
|
|
||||||
|
|
||||||
def save_ok_button_clicked(self,obj):
|
|
||||||
filename = obj.get_filename()
|
|
||||||
if filename:
|
|
||||||
Utils.destroy_passed_object(obj)
|
|
||||||
if GrampsCfg.usevc and GrampsCfg.vc_comment:
|
|
||||||
self.db.display_comment_box(filename)
|
|
||||||
else:
|
|
||||||
self.db.save_file(filename,_("No Comment Provided"))
|
|
||||||
|
|
||||||
def open_activate(self):
|
|
||||||
wFs = libglade.GladeXML(const.revisionFile, "dbopen")
|
|
||||||
wFs.signal_autoconnect({
|
|
||||||
"on_ok_button1_clicked": self.ok_button_clicked,
|
|
||||||
"destroy_passed_object": self.cancel_button_clicked,
|
|
||||||
})
|
|
||||||
|
|
||||||
self.fileSelector = wFs.get_widget("dbopen")
|
|
||||||
self.dbname = wFs.get_widget("dbname")
|
|
||||||
self.getoldrev = wFs.get_widget("getoldrev")
|
|
||||||
self.dbname.set_default_path(GrampsCfg.db_dir)
|
|
||||||
self.getoldrev.set_sensitive(GrampsCfg.usevc)
|
|
||||||
|
|
||||||
def cancel_button_clicked(self,obj):
|
|
||||||
Utils.destroy_passed_object(obj)
|
|
||||||
self.show()
|
|
||||||
|
|
||||||
def ok_button_clicked(self,obj):
|
|
||||||
filename = self.dbname.get_full_path(0)
|
|
||||||
|
|
||||||
if not filename:
|
|
||||||
return
|
|
||||||
|
|
||||||
Utils.destroy_passed_object(obj)
|
|
||||||
self.db.clear_database()
|
|
||||||
|
|
||||||
if self.getoldrev.get_active():
|
|
||||||
vc = VersionControl.RcsVersionControl(filename)
|
|
||||||
VersionControl.RevisionSelect(self.db.database,filename,vc,
|
|
||||||
self.db.load_revision,self.show)
|
|
||||||
else:
|
|
||||||
self.db.read_file(filename)
|
|
||||||
|
|
||||||
def open_delete_event(self,obj,event):
|
|
||||||
gtk.mainquit()
|
|
||||||
|
|
||||||
def open_cancel_clicked(self,obj):
|
|
||||||
gtk.mainquit()
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Start it all
|
# Start it all
|
||||||
|
@ -71,7 +71,7 @@ class HtmlLinkDoc(HtmlDoc):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class IndividualPage:
|
class IndividualPage:
|
||||||
|
|
||||||
def __init__(self,person,photos,restrict,private,uc,link,map,dir_name,doc):
|
def __init__(self,person,photos,restrict,private,uc,link,map,dir_name,imgdir,doc):
|
||||||
self.person = person
|
self.person = person
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.list = map
|
self.list = map
|
||||||
@ -83,6 +83,7 @@ class IndividualPage:
|
|||||||
self.link = link
|
self.link = link
|
||||||
self.slist = []
|
self.slist = []
|
||||||
self.scnt = 1
|
self.scnt = 1
|
||||||
|
self.image_dir = imgdir
|
||||||
|
|
||||||
name = person.getPrimaryName().getRegularName()
|
name = person.getPrimaryName().getRegularName()
|
||||||
self.doc.set_title(_("Summary of %s") % name)
|
self.doc.set_title(_("Summary of %s") % name)
|
||||||
@ -199,7 +200,7 @@ class IndividualPage:
|
|||||||
"""Generate the HTML page for the specific person"""
|
"""Generate the HTML page for the specific person"""
|
||||||
|
|
||||||
filebase = "%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" % (self.dir,filebase))
|
||||||
|
|
||||||
photo_list = self.person.getPhotoList()
|
photo_list = self.person.getPhotoList()
|
||||||
name_obj = self.person.getPrimaryName()
|
name_obj = self.person.getPrimaryName()
|
||||||
@ -311,11 +312,19 @@ class IndividualPage:
|
|||||||
try:
|
try:
|
||||||
src = obj.getReference().getPath()
|
src = obj.getReference().getPath()
|
||||||
base = os.path.basename(src)
|
base = os.path.basename(src)
|
||||||
shutil.copy(src,"%s/images/%s" % (self.dir,base))
|
|
||||||
|
if self.image_dir:
|
||||||
|
shutil.copy(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||||
|
else:
|
||||||
|
shutil.copy(src,"%s/%s" % (self.dir,base))
|
||||||
|
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell("ImageCell")
|
self.doc.start_cell("ImageCell")
|
||||||
self.doc.start_paragraph("Data")
|
self.doc.start_paragraph("Data")
|
||||||
self.doc.start_link("images/%s" % base)
|
if self.image_dir:
|
||||||
|
self.doc.start_link("%s/%s" % (self.image_dir,base))
|
||||||
|
else:
|
||||||
|
self.doc.start_link("%s" % base)
|
||||||
self.doc.add_photo(src,"row",1.5,1.5)
|
self.doc.add_photo(src,"row",1.5,1.5)
|
||||||
self.doc.end_link()
|
self.doc.end_link()
|
||||||
|
|
||||||
@ -646,7 +655,8 @@ filter_map = {
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class WebReport(Report):
|
class WebReport(Report):
|
||||||
def __init__(self,db,person,target_path,max_gen,photos,filter,restrict,
|
def __init__(self,db,person,target_path,max_gen,photos,filter,restrict,
|
||||||
private, srccomments, include_link, style, template_name):
|
private, srccomments, include_link, style, image_dir,
|
||||||
|
template_name):
|
||||||
self.db = db
|
self.db = db
|
||||||
self.person = person
|
self.person = person
|
||||||
self.target_path = target_path
|
self.target_path = target_path
|
||||||
@ -658,6 +668,7 @@ class WebReport(Report):
|
|||||||
self.srccomments = srccomments
|
self.srccomments = srccomments
|
||||||
self.include_link = include_link
|
self.include_link = include_link
|
||||||
self.selected_style = style
|
self.selected_style = style
|
||||||
|
self.image_dir = image_dir
|
||||||
self.template_name = template_name
|
self.template_name = template_name
|
||||||
|
|
||||||
def get_progressbar_data(self):
|
def get_progressbar_data(self):
|
||||||
@ -673,7 +684,7 @@ class WebReport(Report):
|
|||||||
doc = HtmlLinkDoc(self.selected_style,None,template,None)
|
doc = HtmlLinkDoc(self.selected_style,None,template,None)
|
||||||
doc.set_title(_("Family Tree Index"))
|
doc.set_title(_("Family Tree Index"))
|
||||||
|
|
||||||
doc.open(html_dir + os.sep + "index.html")
|
doc.open("%s/index.html" % html_dir)
|
||||||
doc.start_paragraph("Title")
|
doc.start_paragraph("Title")
|
||||||
doc.write_text(_("Family Tree Index"))
|
doc.write_text(_("Family Tree Index"))
|
||||||
doc.end_paragraph()
|
doc.end_paragraph()
|
||||||
@ -708,8 +719,11 @@ class WebReport(Report):
|
|||||||
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
GnomeErrorDialog(_("Could not create the directory : %s") % \
|
||||||
dir_name)
|
dir_name)
|
||||||
return
|
return
|
||||||
|
|
||||||
image_dir_name = os.path.join(dir_name, "images")
|
if self.image_dir:
|
||||||
|
image_dir_name = os.path.join(dir_name, self.image_dir)
|
||||||
|
else:
|
||||||
|
image_dir_name = dir_name
|
||||||
if not os.path.isdir(image_dir_name) and self.photos != 0:
|
if not os.path.isdir(image_dir_name) and self.photos != 0:
|
||||||
try:
|
try:
|
||||||
os.mkdir(image_dir_name)
|
os.mkdir(image_dir_name)
|
||||||
@ -728,6 +742,8 @@ class WebReport(Report):
|
|||||||
self.progress_bar_setup(float(len(ind_list)))
|
self.progress_bar_setup(float(len(ind_list)))
|
||||||
|
|
||||||
doc = HtmlLinkDoc(self.selected_style,None,self.template_name,None)
|
doc = HtmlLinkDoc(self.selected_style,None,self.template_name,None)
|
||||||
|
doc.set_image_dir(self.image_dir)
|
||||||
|
|
||||||
self.add_styles(doc)
|
self.add_styles(doc)
|
||||||
doc.build_style_declaration()
|
doc.build_style_declaration()
|
||||||
|
|
||||||
@ -738,7 +754,8 @@ class WebReport(Report):
|
|||||||
tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc)
|
tdoc = HtmlLinkDoc(self.selected_style,None,None,None,doc)
|
||||||
idoc = IndividualPage(person, self.photos, self.restrict,
|
idoc = IndividualPage(person, self.photos, self.restrict,
|
||||||
self.private, self.srccomments,
|
self.private, self.srccomments,
|
||||||
self.include_link, my_map, dir_name, tdoc)
|
self.include_link, my_map, dir_name,
|
||||||
|
self.image_dir, tdoc)
|
||||||
idoc.create_page()
|
idoc.create_page()
|
||||||
idoc.close()
|
idoc.close()
|
||||||
self.progress_bar_step()
|
self.progress_bar_step()
|
||||||
@ -784,6 +801,7 @@ class WebReportDialog(ReportDialog):
|
|||||||
no_img_msg = _("Do not use images")
|
no_img_msg = _("Do not use images")
|
||||||
no_limg_msg = _("Do not use images for living people")
|
no_limg_msg = _("Do not use images for living people")
|
||||||
no_com_msg = _("Do not include comments and text in source information")
|
no_com_msg = _("Do not include comments and text in source information")
|
||||||
|
imgdir_msg = _("Image subdirectory")
|
||||||
|
|
||||||
self.use_link = GtkCheckButton(lnk_msg)
|
self.use_link = GtkCheckButton(lnk_msg)
|
||||||
self.use_link.set_active(1)
|
self.use_link.set_active(1)
|
||||||
@ -793,8 +811,12 @@ class WebReportDialog(ReportDialog):
|
|||||||
self.no_images = GtkCheckButton(no_img_msg)
|
self.no_images = GtkCheckButton(no_img_msg)
|
||||||
self.no_living_images = GtkCheckButton(no_limg_msg)
|
self.no_living_images = GtkCheckButton(no_limg_msg)
|
||||||
self.no_comments = GtkCheckButton(no_com_msg)
|
self.no_comments = GtkCheckButton(no_com_msg)
|
||||||
|
self.imgdir = GtkEntry()
|
||||||
|
self.imgdir.set_text("images")
|
||||||
|
|
||||||
|
self.add_option(imgdir_msg,self.imgdir)
|
||||||
self.add_option('',self.use_link)
|
self.add_option('',self.use_link)
|
||||||
|
|
||||||
title = _("Privacy Options")
|
title = _("Privacy Options")
|
||||||
self.add_frame_option(title,None,self.no_private)
|
self.add_frame_option(title,None,self.no_private)
|
||||||
self.add_frame_option(title,None,self.restrict_living)
|
self.add_frame_option(title,None,self.restrict_living)
|
||||||
@ -987,6 +1009,8 @@ class WebReportDialog(ReportDialog):
|
|||||||
user selected choices for later use."""
|
user selected choices for later use."""
|
||||||
self.restrict = self.restrict_living.get_active()
|
self.restrict = self.restrict_living.get_active()
|
||||||
self.private = self.no_private.get_active()
|
self.private = self.no_private.get_active()
|
||||||
|
self.img_dir_text = self.imgdir.get_text()
|
||||||
|
|
||||||
self.srccomments = self.no_comments.get_active()
|
self.srccomments = self.no_comments.get_active()
|
||||||
if self.no_images.get_active() == 1:
|
if self.no_images.get_active() == 1:
|
||||||
self.photos = 0
|
self.photos = 0
|
||||||
@ -1021,7 +1045,7 @@ class WebReportDialog(ReportDialog):
|
|||||||
self.max_gen, self.photos, self.filter,
|
self.max_gen, self.photos, self.filter,
|
||||||
self.restrict, self.private, self.srccomments,
|
self.restrict, self.private, self.srccomments,
|
||||||
self.include_link, self.selected_style,
|
self.include_link, self.selected_style,
|
||||||
self.template_name)
|
self.img_dir_text,self.template_name)
|
||||||
MyReport.write_report()
|
MyReport.write_report()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user