2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-01-09 04:05:04 +05:30
|
|
|
# Copyright (C) 2000-2005 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
|
|
|
|
#
|
|
|
|
|
2003-12-02 09:57:23 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import os
|
2005-12-06 12:08:09 +05:30
|
|
|
import sets
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gobject
|
2002-11-14 11:01:42 +05:30
|
|
|
import gtk
|
2002-10-20 19:55:16 +05:30
|
|
|
import gtk.glade
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-03 05:40:52 +05:30
|
|
|
import Config
|
2003-01-10 10:51:32 +05:30
|
|
|
import RelLib
|
2002-10-20 19:55:16 +05:30
|
|
|
import const
|
|
|
|
import Utils
|
2004-09-17 09:00:04 +05:30
|
|
|
import DateHandler
|
2005-12-06 12:08:09 +05:30
|
|
|
import GrampsDisplay
|
|
|
|
import QuestionDialog
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-15 08:24:04 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
INDEX = "i"
|
|
|
|
OBJECT = "o"
|
|
|
|
DATA = "d"
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
_surname_styles = [
|
|
|
|
_("Father's surname"),
|
|
|
|
_("None"),
|
|
|
|
_("Combination of mother's and father's surname"),
|
|
|
|
_("Icelandic style"),
|
|
|
|
]
|
|
|
|
|
|
|
|
panellist = [
|
|
|
|
(_("Display"),
|
2004-05-12 09:28:14 +05:30
|
|
|
[( _("General"), 3),
|
2005-01-08 09:19:43 +05:30
|
|
|
( _("Dates"), 4),
|
2004-05-12 09:28:14 +05:30
|
|
|
( _("Toolbar and Statusbar"), 2)]),
|
2004-10-19 22:12:15 +05:30
|
|
|
(_("Database"),
|
|
|
|
[( _("General"), 1),
|
|
|
|
( _("GRAMPS IDs"), 6),
|
|
|
|
( _("Researcher Information"), 5)]),
|
2002-10-20 19:55:16 +05:30
|
|
|
]
|
|
|
|
|
2004-07-15 08:24:04 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
# Not exactly gconf keys, but the functions directly dependent on them
|
2004-07-15 08:24:04 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
def set_calendar_date_format():
|
2004-09-25 10:42:15 +05:30
|
|
|
format_list = DateHandler.get_date_formats()
|
2006-03-03 05:40:52 +05:30
|
|
|
DateHandler.set_format(Config.get_date_format(format_list))
|
2004-07-20 07:57:55 +05:30
|
|
|
|
2005-01-13 02:53:31 +05:30
|
|
|
def _update_calendar_date_format(active,dlist):
|
2006-03-03 05:40:52 +05:30
|
|
|
Config.save_date_format(active,dlist)
|
2005-01-13 02:53:31 +05:30
|
|
|
DateHandler.set_format(active)
|
|
|
|
|
2004-07-15 08:24:04 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# make_path -
|
|
|
|
# Creates a directory if it does not already exist. Assumes that the
|
|
|
|
# parent directory already exits
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def make_path(path):
|
|
|
|
if not os.path.isdir(path):
|
|
|
|
os.mkdir(path)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-15 08:24:04 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def loadConfig():
|
|
|
|
"""
|
|
|
|
Load preferences on startup. Not much to do, since all the prefs
|
|
|
|
are in gconf and can be retrieved any time.
|
|
|
|
"""
|
2006-03-29 09:54:39 +05:30
|
|
|
make_path(const.home_dir)
|
|
|
|
make_path(os.path.join(const.home_dir,"filters"))
|
|
|
|
make_path(os.path.join(const.home_dir,"plugins"))
|
|
|
|
make_path(os.path.join(const.home_dir,"templates"))
|
|
|
|
make_path(os.path.join(const.home_dir,"thumb"))
|
2004-07-15 08:24:04 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def get_researcher():
|
2006-03-03 05:40:52 +05:30
|
|
|
n = Config.get_researcher_name()
|
|
|
|
a = Config.get_researcher_addr()
|
|
|
|
c = Config.get_researcher_city()
|
|
|
|
s = Config.get_researcher_state()
|
|
|
|
ct = Config.get_researcher_country()
|
|
|
|
p = Config.get_researcher_postal()
|
|
|
|
ph = Config.get_researcher_phone()
|
|
|
|
e = Config.get_researcher_email()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
owner = RelLib.Researcher()
|
2002-10-20 19:55:16 +05:30
|
|
|
owner.set(n,a,c,s,ct,p,ph,e)
|
|
|
|
return owner
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class GrampsPreferences:
|
|
|
|
def __init__(self,db):
|
2003-10-16 22:13:07 +05:30
|
|
|
self.built = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
self.db = db
|
2006-01-17 10:33:30 +05:30
|
|
|
self.top = gtk.glade.XML(const.gladeFile,"preferences","gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-03-06 05:09:20 +05:30
|
|
|
self.top.get_widget('button6').connect('clicked',self.on_close_clicked)
|
|
|
|
self.top.get_widget('button7').connect('clicked',self.help_clicked)
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.window = self.top.get_widget("preferences")
|
2005-12-06 12:08:09 +05:30
|
|
|
self.window.connect('delete_event',self.on_close_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.tree = self.top.get_widget("tree")
|
2006-03-06 05:09:20 +05:30
|
|
|
self.image = self.top.get_widget('image')
|
|
|
|
self.image.set_from_file(os.path.join(const.image_dir,'splash.jpg'))
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.store = gtk.TreeStore(gobject.TYPE_STRING)
|
|
|
|
self.selection = self.tree.get_selection()
|
|
|
|
self.selection.connect('changed',self.select)
|
|
|
|
col = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
|
|
|
|
self.tree.append_column(col)
|
|
|
|
self.tree.set_model(self.store)
|
|
|
|
self.panel = self.top.get_widget("panel")
|
|
|
|
|
|
|
|
self.imap = {}
|
|
|
|
self.build_tree()
|
|
|
|
self.build()
|
2003-10-16 22:13:07 +05:30
|
|
|
self.built = 1
|
2003-06-14 20:17:41 +05:30
|
|
|
self.window.show()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def build_tree(self):
|
|
|
|
prev = None
|
|
|
|
ilist = []
|
2004-08-20 17:41:56 +05:30
|
|
|
for (name,lst) in panellist:
|
2002-10-20 19:55:16 +05:30
|
|
|
node = self.store.insert_after(None, prev)
|
|
|
|
self.store.set(node,0,name)
|
|
|
|
next = None
|
2004-08-20 17:41:56 +05:30
|
|
|
for (subname,tab) in lst:
|
2002-10-20 19:55:16 +05:30
|
|
|
next = self.store.insert_after(node,next)
|
|
|
|
ilist.append((next,tab))
|
|
|
|
self.store.set(next,0,subname)
|
|
|
|
for next,tab in ilist:
|
|
|
|
path = self.store.get_path(next)
|
|
|
|
self.imap[path] = tab
|
|
|
|
|
|
|
|
def build(self):
|
2004-07-20 07:57:55 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
auto = self.top.get_widget("autoload")
|
2006-03-03 05:40:52 +05:30
|
|
|
auto.set_active(Config.get_autoload())
|
2004-10-08 23:29:34 +05:30
|
|
|
auto.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_autoload(obj.get_active()))
|
2004-07-20 07:57:55 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
spell = self.top.get_widget("spellcheck")
|
2006-03-03 05:40:52 +05:30
|
|
|
spell.set_active(Config.get_spellcheck())
|
2005-12-06 12:08:09 +05:30
|
|
|
spell.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_spellcheck(obj.get_active()))
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
lds = self.top.get_widget("uselds")
|
2006-03-03 05:40:52 +05:30
|
|
|
lds.set_active(Config.get_uselds())
|
2004-10-08 23:29:34 +05:30
|
|
|
lds.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_uselds(obj.get_active()))
|
2004-07-20 07:57:55 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
self.ipr = self.top.get_widget("iprefix")
|
2006-03-03 05:40:52 +05:30
|
|
|
self.ipr.set_text(Config.get_person_id_prefix())
|
2005-12-06 12:08:09 +05:30
|
|
|
self.opr = self.top.get_widget("oprefix")
|
2006-03-03 05:40:52 +05:30
|
|
|
self.opr.set_text(Config.get_object_id_prefix())
|
2005-12-06 12:08:09 +05:30
|
|
|
self.fpr = self.top.get_widget("fprefix")
|
2006-03-03 05:40:52 +05:30
|
|
|
self.fpr.set_text(Config.get_family_id_prefix())
|
2005-12-06 12:08:09 +05:30
|
|
|
self.spr = self.top.get_widget("sprefix")
|
2006-03-03 05:40:52 +05:30
|
|
|
self.spr.set_text(Config.get_source_id_prefix())
|
2005-12-06 12:08:09 +05:30
|
|
|
self.ppr = self.top.get_widget("pprefix")
|
2006-03-03 05:40:52 +05:30
|
|
|
self.ppr.set_text(Config.get_place_id_prefix())
|
2004-07-20 07:57:55 +05:30
|
|
|
|
|
|
|
sb2 = self.top.get_widget("stat2")
|
|
|
|
sb3 = self.top.get_widget("stat3")
|
2006-03-03 05:40:52 +05:30
|
|
|
if Config.get_statusbar() == 0 or Config.get_statusbar() == 1:
|
2004-07-20 07:57:55 +05:30
|
|
|
sb2.set_active(1)
|
2003-03-23 01:56:44 +05:30
|
|
|
else:
|
2004-07-20 07:57:55 +05:30
|
|
|
sb3.set_active(1)
|
|
|
|
sb2.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_statusbar(2-obj.get_active()))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
toolbarmenu = self.top.get_widget("tooloptmenu")
|
2006-03-03 05:40:52 +05:30
|
|
|
toolbarmenu.set_active(Config.get_toolbar()+1)
|
2004-10-08 23:29:34 +05:30
|
|
|
toolbarmenu.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_toolbar(obj.get_active()-1))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
pvbutton = self.top.get_widget('pvbutton')
|
|
|
|
fvbutton = self.top.get_widget('fvbutton')
|
2006-03-03 05:40:52 +05:30
|
|
|
if Config.get_default_view() == 0:
|
2004-07-20 07:57:55 +05:30
|
|
|
pvbutton.set_active(1)
|
2003-08-12 08:31:17 +05:30
|
|
|
else:
|
2004-07-20 07:57:55 +05:30
|
|
|
fvbutton.set_active(1)
|
2004-10-08 23:29:34 +05:30
|
|
|
fvbutton.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_default_view(obj.get_active()))
|
2003-08-12 08:31:17 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
familyview1 = self.top.get_widget('familyview1')
|
|
|
|
familyview2 = self.top.get_widget('familyview2')
|
2006-03-03 05:40:52 +05:30
|
|
|
if Config.get_family_view() == 0:
|
2004-07-20 07:57:55 +05:30
|
|
|
familyview1.set_active(1)
|
2003-08-26 09:15:41 +05:30
|
|
|
else:
|
2004-07-20 07:57:55 +05:30
|
|
|
familyview2.set_active(1)
|
2004-10-08 23:29:34 +05:30
|
|
|
familyview2.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_family_view(obj.get_active()))
|
2003-08-26 09:15:41 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
usetips = self.top.get_widget('usetips')
|
2006-03-03 05:40:52 +05:30
|
|
|
usetips.set_active(Config.get_usetips())
|
2004-10-08 23:29:34 +05:30
|
|
|
usetips.connect('toggled',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_usetips(obj.get_active()))
|
2004-05-18 12:30:34 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
lastnamegen_obj = self.top.get_widget("lastnamegen")
|
2005-01-08 09:19:43 +05:30
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
lastnamegen_obj.pack_start(cell,True)
|
|
|
|
lastnamegen_obj.add_attribute(cell,'text',0)
|
|
|
|
|
|
|
|
store = gtk.ListStore(str)
|
|
|
|
for name in _surname_styles:
|
|
|
|
store.append(row=[name])
|
|
|
|
lastnamegen_obj.set_model(store)
|
2006-03-03 05:40:52 +05:30
|
|
|
lastnamegen_obj.set_active(Config.get_lastnamegen(_surname_styles))
|
2004-07-20 07:57:55 +05:30
|
|
|
lastnamegen_obj.connect("changed",
|
2004-10-08 23:29:34 +05:30
|
|
|
lambda obj:
|
2006-03-03 05:40:52 +05:30
|
|
|
Config.save_lastnamegen(obj.get_active(),_surname_styles)
|
2004-10-08 23:29:34 +05:30
|
|
|
)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
date_option = self.top.get_widget("date_format")
|
2004-09-17 09:00:04 +05:30
|
|
|
dlist = DateHandler.get_date_formats()
|
2005-01-08 09:19:43 +05:30
|
|
|
date_option.pack_start(cell,True)
|
|
|
|
date_option.add_attribute(cell,'text',0)
|
|
|
|
|
|
|
|
store = gtk.ListStore(str)
|
|
|
|
for item in dlist:
|
|
|
|
store.append(row=[item])
|
2004-09-25 10:42:15 +05:30
|
|
|
|
2005-01-08 09:19:43 +05:30
|
|
|
date_option.set_model(store)
|
|
|
|
try:
|
|
|
|
# Technically, a selected format might be out of range
|
|
|
|
# for this locale's format list.
|
2006-03-03 05:40:52 +05:30
|
|
|
date_option.set_active(Config.get_date_format(dlist))
|
2005-01-08 09:19:43 +05:30
|
|
|
except:
|
|
|
|
date_option.set_active(0)
|
|
|
|
|
2005-01-13 02:53:31 +05:30
|
|
|
date_option.connect("changed",
|
|
|
|
lambda obj:
|
|
|
|
_update_calendar_date_format(obj.get_active(),dlist)
|
|
|
|
)
|
2005-01-08 09:19:43 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
resname = self.top.get_widget("resname")
|
2006-03-03 05:40:52 +05:30
|
|
|
resname.set_text(Config.get_researcher_name())
|
2004-10-08 23:29:34 +05:30
|
|
|
resname.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_name(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
resaddr = self.top.get_widget("resaddr")
|
2006-03-03 05:40:52 +05:30
|
|
|
resaddr.set_text(Config.get_researcher_addr())
|
2004-10-08 23:29:34 +05:30
|
|
|
resaddr.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_addr(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
rescity = self.top.get_widget("rescity")
|
2006-03-03 05:40:52 +05:30
|
|
|
rescity.set_text(Config.get_researcher_city())
|
2004-10-08 23:29:34 +05:30
|
|
|
rescity.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_city(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
resstate = self.top.get_widget("resstate")
|
2006-03-03 05:40:52 +05:30
|
|
|
resstate.set_text(Config.get_researcher_state())
|
2004-10-08 23:29:34 +05:30
|
|
|
resstate.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_state(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
rescountry = self.top.get_widget("rescountry")
|
2006-03-03 05:40:52 +05:30
|
|
|
rescountry.set_text(Config.get_researcher_country())
|
2004-10-08 23:29:34 +05:30
|
|
|
rescountry.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_country(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
respostal = self.top.get_widget("respostal")
|
2006-03-03 05:40:52 +05:30
|
|
|
respostal.set_text(Config.get_researcher_postal())
|
2004-10-08 23:29:34 +05:30
|
|
|
respostal.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_postal(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
resphone = self.top.get_widget("resphone")
|
2006-03-03 05:40:52 +05:30
|
|
|
resphone.set_text(Config.get_researcher_phone())
|
2004-10-08 23:29:34 +05:30
|
|
|
resphone.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_phone(obj.get_text()))
|
2004-07-20 07:57:55 +05:30
|
|
|
resemail = self.top.get_widget("resemail")
|
2006-03-03 05:40:52 +05:30
|
|
|
resemail.set_text(Config.get_researcher_email())
|
2004-10-08 23:29:34 +05:30
|
|
|
resemail.connect('changed',
|
2006-03-03 05:40:52 +05:30
|
|
|
lambda obj: Config.save_researcher_email(obj.get_text()))
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
def save_prefix(self):
|
|
|
|
""" Validate the GRAMPS ID definitions to be usable"""
|
|
|
|
ip = self.ipr.get_text()
|
|
|
|
op = self.opr.get_text()
|
|
|
|
fp = self.fpr.get_text()
|
|
|
|
sp = self.spr.get_text()
|
|
|
|
pp = self.ppr.get_text()
|
|
|
|
|
|
|
|
# Do validation to the GRAMPS-ID format strings
|
|
|
|
invalid_chars = sets.Set("# \t\n\r")
|
|
|
|
prefixes = [ip,op,fp,sp,pp]
|
|
|
|
testnums = [1,234,567890]
|
|
|
|
testresult = {} # used to test that IDs for different objects will be different
|
|
|
|
formaterror = False # true if formatstring is invalid
|
|
|
|
incompatible = False # true if ID string is possibly not GEDCOM compatible
|
|
|
|
for p in prefixes:
|
|
|
|
if invalid_chars & sets.Set(p):
|
|
|
|
incompatible = True
|
|
|
|
for n in testnums:
|
|
|
|
try:
|
|
|
|
testresult[p % n] = 1
|
|
|
|
except:
|
|
|
|
formaterror = True
|
|
|
|
|
|
|
|
idexampletext = _('Example for valid IDs are:\n'+
|
|
|
|
'I%d which will be displayed as I123 or\n'+
|
|
|
|
'S%06d which will be displayed as S000123.')
|
|
|
|
if formaterror:
|
|
|
|
QuestionDialog.ErrorDialog( _("Invalid GRAMPS ID prefix"),
|
|
|
|
_("The GRAMPS ID prefix is invalid.\n")+
|
|
|
|
idexampletext,
|
|
|
|
self.window)
|
|
|
|
return False
|
|
|
|
elif incompatible:
|
|
|
|
QuestionDialog.OkDialog( _("Incompatible GRAMPS ID prefix"),
|
|
|
|
_("The GRAMPS ID prefix is in an unusual format and may"+
|
|
|
|
" cause problems when exporting the database to GEDCOM format.\n")+
|
|
|
|
idexampletext,
|
|
|
|
self.window)
|
|
|
|
elif len(testresult) != len(prefixes)*len(testnums):
|
|
|
|
QuestionDialog.ErrorDialog( _("Unsuited GRAMPS ID prefix"),
|
|
|
|
_("The GRAMPS ID prefix is unsuited because it does not"+
|
|
|
|
" distinguish between different objects.\n")+
|
|
|
|
idexampletext,
|
|
|
|
self.window)
|
|
|
|
return False
|
|
|
|
|
2006-03-03 05:40:52 +05:30
|
|
|
Config.save_iprefix(ip)
|
|
|
|
Config.save_oprefix(op)
|
|
|
|
Config.save_fprefix(fp)
|
|
|
|
Config.save_sprefix(sp)
|
|
|
|
Config.save_pprefix(pp)
|
2005-12-06 12:08:09 +05:30
|
|
|
return True
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def select(self,obj):
|
2004-08-20 17:41:56 +05:30
|
|
|
store,node = self.selection.get_selected()
|
|
|
|
if node:
|
|
|
|
path = store.get_path(node)
|
|
|
|
if node and self.imap.has_key(path):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.panel.set_current_page(self.imap[path])
|
|
|
|
|
2006-03-06 05:09:20 +05:30
|
|
|
def help_clicked(self,obj):
|
2005-12-06 12:08:09 +05:30
|
|
|
GrampsDisplay.help('gramps-prefs')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
def on_close_clicked(self,obj=None,dummy=None):
|
|
|
|
if not self.save_prefix():
|
|
|
|
return False
|
|
|
|
self.window.destroy()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Create the property box, and set the elements off the current values
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def display_preferences_box(db):
|
|
|
|
GrampsPreferences(db)
|