2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2003-05-17 09:44:13 +05:30
|
|
|
# Copyright (C) 2000-2003 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
import const
|
|
|
|
import gtk.glade
|
2003-05-13 01:09:49 +05:30
|
|
|
import gnome
|
|
|
|
import gnome.ui
|
2002-10-20 19:55:16 +05:30
|
|
|
import gconf
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2003-05-13 01:09:49 +05:30
|
|
|
|
2003-03-20 05:39:22 +05:30
|
|
|
_StartupEntry = "/apps/gramps/startup"
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def need_to_run():
|
|
|
|
client = gconf.client_get_default()
|
|
|
|
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
2003-03-20 05:39:22 +05:30
|
|
|
val = client.get_int(_StartupEntry)
|
|
|
|
if val == None:
|
2002-10-20 19:55:16 +05:30
|
|
|
return 1
|
|
|
|
if val < const.startup:
|
|
|
|
return 1
|
|
|
|
return 0
|
|
|
|
|
|
|
|
class StartupDialog:
|
|
|
|
|
2003-05-17 09:44:13 +05:30
|
|
|
def __init__(self,task,args):
|
2003-05-13 01:09:49 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.task = task
|
2003-05-17 09:44:13 +05:30
|
|
|
self.args = args
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
self.w = gtk.Window()
|
|
|
|
self.fg_color = gtk.gdk.color_parse('#7d684a')
|
|
|
|
self.bg_color = gtk.gdk.color_parse('#e1dbc5')
|
2003-05-13 03:11:02 +05:30
|
|
|
self.logo = gtk.gdk.pixbuf_new_from_file("%s/gramps.png" % const.rootDir)
|
|
|
|
self.splash = gtk.gdk.pixbuf_new_from_file("%s/splash.jpg" % const.rootDir)
|
2003-05-13 08:32:58 +05:30
|
|
|
|
|
|
|
self.client = gconf.client_get_default()
|
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
d = gnome.ui.Druid()
|
|
|
|
self.w.add(d)
|
|
|
|
d.add(self.build_page1())
|
|
|
|
d.add(self.build_page2())
|
|
|
|
d.add(self.build_page3())
|
|
|
|
d.add(self.build_page4())
|
|
|
|
d.add(self.build_page5())
|
|
|
|
d.add(self.build_page_last())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
d.connect('cancel',self.close)
|
|
|
|
self.w.connect("destroy_event", self.close)
|
|
|
|
|
|
|
|
self.w.show_all()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
def close(self,obj):
|
2003-05-17 09:44:13 +05:30
|
|
|
self.task(self.args)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
def build_page1(self):
|
|
|
|
p = gnome.ui.DruidPageEdge(0)
|
|
|
|
p.set_title(_('Getting Started'))
|
|
|
|
p.set_title_color(self.fg_color)
|
|
|
|
p.set_bg_color(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
p.set_watermark(self.splash)
|
|
|
|
p.set_text(_('Welcome to GRAMPS, the Genealogical Research '
|
|
|
|
'and Analysis Management Programming System.\n'
|
|
|
|
'Several options and information need to be gathered '
|
|
|
|
'before GRAMPS is ready to be used. Any of this '
|
|
|
|
'information can be changed in the future in the '
|
|
|
|
'Preferences dialog under the Settings menu.'))
|
|
|
|
return p
|
|
|
|
|
|
|
|
def build_page_last(self):
|
|
|
|
p = gnome.ui.DruidPageEdge(1)
|
|
|
|
p.set_title(_('Complete'))
|
|
|
|
p.set_title_color(self.fg_color)
|
|
|
|
p.set_bg_color(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
p.set_watermark(self.splash)
|
|
|
|
p.connect('finish',self.complete)
|
|
|
|
|
|
|
|
p.set_text(_('GRAMPS is an Open Source project. Its success '
|
|
|
|
'depends on the users. User feedback is important. '
|
|
|
|
'Please join the mailing lists, submit bug reports, '
|
2003-05-28 21:25:59 +05:30
|
|
|
'suggest improvements, and see how you can '
|
2003-05-13 01:09:49 +05:30
|
|
|
'contribute.\n\nPlease enjoy using GRAMPS.'))
|
|
|
|
return p
|
|
|
|
|
2003-05-15 05:55:26 +05:30
|
|
|
def get_string(self,key):
|
|
|
|
val = self.client.get_string(key)
|
|
|
|
if val == None:
|
|
|
|
return ""
|
|
|
|
else:
|
|
|
|
return val
|
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
def complete(self,obj,obj2):
|
|
|
|
self.client.set_string('/apps/gramps/researcher-name',self.name.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-addr',self.addr.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-city',self.city.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-state',self.state.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-postal',self.postal.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-country',self.country.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-phone',self.phone.get_text())
|
|
|
|
self.client.set_string('/apps/gramps/researcher-email',self.email.get_text())
|
|
|
|
|
|
|
|
if self.date1.get_active():
|
|
|
|
self.client.set_int("/apps/gramps/dateEntry",0)
|
|
|
|
elif self.date2.get_active():
|
|
|
|
self.client.set_int("/apps/gramps/dateEntry",1)
|
|
|
|
elif self.date3.get_active():
|
|
|
|
self.client.set_int("/apps/gramps/dateEntry",2)
|
|
|
|
|
|
|
|
self.client.set_int("/apps/gramps/ShowCalendar",self.calendar.get_active())
|
|
|
|
self.client.set_int("/apps/gramps/UseLDS",self.lds.get_active())
|
2003-01-10 10:51:32 +05:30
|
|
|
self.client.set_int(_StartupEntry,const.startup)
|
2003-05-13 01:09:49 +05:30
|
|
|
self.w.destroy()
|
2003-05-17 09:44:13 +05:30
|
|
|
self.task(self.args)
|
2003-05-13 01:09:49 +05:30
|
|
|
|
|
|
|
def build_page2(self):
|
|
|
|
p = gnome.ui.DruidPageStandard()
|
|
|
|
p.set_title(_('Researcher Information'))
|
|
|
|
p.set_title_foreground(self.fg_color)
|
|
|
|
p.set_background(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
|
|
|
|
box = gtk.VBox()
|
|
|
|
box.set_spacing(12)
|
|
|
|
p.append_item("",box,"")
|
|
|
|
|
|
|
|
label = gtk.Label(_('In order to create valid GEDCOM files, the following information '
|
2003-05-13 08:32:58 +05:30
|
|
|
'needs to be entered. If you do not plan to generate GEDCOM files, '
|
2003-05-13 01:09:49 +05:30
|
|
|
'you may leave this empty.'))
|
|
|
|
label.set_line_wrap(gtk.TRUE)
|
|
|
|
|
|
|
|
box.pack_start(label)
|
|
|
|
|
|
|
|
table = gtk.Table(8,4)
|
|
|
|
table.set_row_spacings(6)
|
|
|
|
table.set_col_spacings(6)
|
|
|
|
|
|
|
|
self.name = make_label(table,_('Name:'),0,0,1,1,4)
|
|
|
|
self.addr = make_label(table,_('Address:'),1,0,1,1,4)
|
|
|
|
self.city = make_label(table,_('City:'),2,0,1,1,2)
|
|
|
|
self.state = make_label(table,_('State/Province:'),2,2,3,3,4)
|
|
|
|
self.country = make_label(table,_('Country:'),3,0,1,1,2)
|
|
|
|
self.postal = make_label(table,_('ZIP/Postal code:'),3,2,3,3,4)
|
|
|
|
self.phone = make_label(table,_('Phone:'),4,0,1,1,4)
|
|
|
|
self.email = make_label(table,_('Email:'),5,0,1,1,4)
|
|
|
|
|
|
|
|
box.add(table)
|
|
|
|
box.show_all()
|
2003-05-13 08:32:58 +05:30
|
|
|
|
2003-06-11 08:31:46 +05:30
|
|
|
name = self.get_string('/apps/gramps/researcher-name')
|
|
|
|
if name.strip() == "":
|
|
|
|
import pwd
|
|
|
|
import os
|
|
|
|
|
|
|
|
try:
|
|
|
|
name = pwd.getpwnam(os.environ['USER'])[4]
|
|
|
|
except:
|
|
|
|
name = ""
|
|
|
|
|
|
|
|
self.name.set_text(name)
|
2003-05-15 05:55:26 +05:30
|
|
|
self.addr.set_text(self.get_string('/apps/gramps/researcher-addr'))
|
|
|
|
self.city.set_text(self.get_string('/apps/gramps/researcher-city'))
|
|
|
|
self.state.set_text(self.get_string('/apps/gramps/researcher-state'))
|
|
|
|
self.postal.set_text(self.get_string('/apps/gramps/researcher-postal'))
|
|
|
|
self.country.set_text(self.get_string('/apps/gramps/researcher-country'))
|
|
|
|
self.phone.set_text(self.get_string('/apps/gramps/researcher-phone'))
|
|
|
|
self.email.set_text(self.get_string('/apps/gramps/researcher-email'))
|
2003-05-13 08:32:58 +05:30
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
return p
|
|
|
|
|
|
|
|
def build_page3(self):
|
|
|
|
p = gnome.ui.DruidPageStandard()
|
|
|
|
p.set_title(_('Numerical date formats'))
|
|
|
|
p.set_title_foreground(self.fg_color)
|
|
|
|
p.set_background(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
|
|
|
|
box = gtk.VBox()
|
|
|
|
box.set_spacing(12)
|
|
|
|
p.append_item("",box,"")
|
|
|
|
|
|
|
|
label = gtk.Label(_('There are three common formats for entering dates in a numerical\n'
|
|
|
|
'format. Without some type of indication, GRAMPS cannot correctly\n'
|
|
|
|
'tell what format you are using. Please indicate your preferred format\n'
|
2003-07-17 08:07:28 +05:30
|
|
|
'for entering numerical dates.'))
|
2003-05-13 01:09:49 +05:30
|
|
|
box.add(label)
|
|
|
|
align = gtk.Alignment(0.5,0)
|
|
|
|
box.add(align)
|
|
|
|
vbox = gtk.VBox()
|
|
|
|
vbox.set_spacing(6)
|
|
|
|
align.add(vbox)
|
|
|
|
|
|
|
|
self.date1 = gtk.RadioButton(label=_("MM/DD/YYYY (United States)"))
|
|
|
|
self.date2 = gtk.RadioButton(label=_("DD/MM/YYYY (European)"),group=self.date1)
|
|
|
|
self.date3 = gtk.RadioButton(label=_("YYYY-MM-DD (ISO)"),group=self.date1)
|
|
|
|
|
2003-05-13 08:32:58 +05:30
|
|
|
val = self.client.get_int("/apps/gramps/dateEntry")
|
|
|
|
if val == None:
|
|
|
|
val = 0
|
|
|
|
|
|
|
|
if val == 0:
|
|
|
|
self.date1.set_active(1)
|
|
|
|
elif val == 1:
|
|
|
|
self.date2.set_active(1)
|
|
|
|
elif val == 2:
|
|
|
|
self.date3.set_active(1)
|
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
vbox.add(self.date1)
|
|
|
|
vbox.add(self.date2)
|
|
|
|
vbox.add(self.date3)
|
|
|
|
|
|
|
|
box.show_all()
|
|
|
|
return p
|
|
|
|
|
|
|
|
def build_page4(self):
|
|
|
|
p = gnome.ui.DruidPageStandard()
|
|
|
|
p.set_title(_('Alternate calendar support'))
|
|
|
|
p.set_title_foreground(self.fg_color)
|
|
|
|
p.set_background(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
|
|
|
|
box = gtk.VBox()
|
|
|
|
box.set_spacing(12)
|
|
|
|
p.append_item("",box,"")
|
|
|
|
|
|
|
|
label = gtk.Label(_('By default, all dates stored by GRAMPS use the Gregorian calendar.\n'
|
|
|
|
'This is normally sufficient for most users. Support may be enabled\n'
|
|
|
|
'for the Julian, French Republican, and Hebrew calendar. If you believe\n'
|
|
|
|
'that you will need one or more of these alternate calendars, enable\n'
|
|
|
|
'alternate calendar support\n'))
|
|
|
|
box.add(label)
|
|
|
|
align = gtk.Alignment(0.5,0)
|
|
|
|
box.add(align)
|
|
|
|
vbox = gtk.VBox()
|
|
|
|
vbox.set_spacing(6)
|
|
|
|
|
|
|
|
self.calendar = gtk.CheckButton(label=_("Enable support for alternate calendars"))
|
2003-05-13 08:32:58 +05:30
|
|
|
|
|
|
|
if self.client.get_int("/apps/gramps/ShowCalendar"):
|
|
|
|
self.calendar.set_active(1)
|
|
|
|
else:
|
|
|
|
self.calendar.set_active(0)
|
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
align.add(self.calendar)
|
|
|
|
|
|
|
|
box.show_all()
|
|
|
|
return p
|
|
|
|
|
|
|
|
def build_page5(self):
|
|
|
|
p = gnome.ui.DruidPageStandard()
|
|
|
|
p.set_title(_('LDS extensions'))
|
|
|
|
p.set_title_foreground(self.fg_color)
|
|
|
|
p.set_background(self.bg_color)
|
|
|
|
p.set_logo(self.logo)
|
|
|
|
|
|
|
|
box = gtk.VBox()
|
|
|
|
box.set_spacing(12)
|
|
|
|
p.append_item("",box,"")
|
|
|
|
|
|
|
|
label = gtk.Label(_('GRAMPS has support for LDS Ordinances, which are special event types\n'
|
|
|
|
'related to the Church of Jesus Christ of Latter Day Saints.\n\n'
|
|
|
|
'You may choose to either enable or disable this support. You may\n'
|
|
|
|
'change this option in the future in the Preferences dialog.'))
|
|
|
|
|
|
|
|
box.add(label)
|
|
|
|
align = gtk.Alignment(0.5,0)
|
|
|
|
box.add(align)
|
|
|
|
vbox = gtk.VBox()
|
|
|
|
vbox.set_spacing(6)
|
|
|
|
|
|
|
|
self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support"))
|
2003-05-13 08:32:58 +05:30
|
|
|
|
|
|
|
if self.client.get_int("/apps/gramps/UseLDS"):
|
|
|
|
self.lds.set_active(1)
|
|
|
|
else:
|
|
|
|
self.lds.set_active(0)
|
|
|
|
|
2003-05-13 01:09:49 +05:30
|
|
|
align.add(self.lds)
|
|
|
|
|
|
|
|
box.show_all()
|
|
|
|
return p
|
|
|
|
|
|
|
|
def make_label(table,val,y,x1,x2,x3,x4):
|
|
|
|
label = gtk.Label(val)
|
|
|
|
label.set_alignment(0,0.5)
|
|
|
|
text = gtk.Entry()
|
|
|
|
table.attach(label,x1,x2,y,y+1,gtk.SHRINK|gtk.FILL)
|
|
|
|
table.attach(text,x3,x4,y,y+1,gtk.EXPAND|gtk.FILL)
|
|
|
|
return text
|