diff --git a/src/Config/gen_schema_keys.py b/src/Config/gen_schema_keys.py
index c8af8ec4d..d1edb5826 100644
--- a/src/Config/gen_schema_keys.py
+++ b/src/Config/gen_schema_keys.py
@@ -24,26 +24,40 @@ from xml.parsers.expat import ExpatError, ParserCreate
class SchemaHandler:
def __init__(self):
+ self.list = []
+ self.clean()
+
+ def clean(self):
self.tlist = []
self.type = ""
self.default = ""
self.key = ""
+ self.include = False
self.short = ""
- self.list = []
+ self.long = ""
def startElement(self,tag,attrs):
- self.tlist = []
+ pass
def endElement(self,tag):
- data = ''.join(self.tlist)
+ data = ''.join(self.tlist).strip()
if tag == "type":
self.type = data
elif tag == "default":
self.default = data
+ elif tag == "include":
+ self.include = int(data)
+ elif tag == "short":
+ self.short = data
+ elif tag == "long":
+ self.long = data.replace('\n','')
elif tag == "applyto":
self.key = data
elif tag == "schema":
- self.list.append((self.key, self.type, self.default))
+ self.list.append((self.key, self.type, self.default,
+ self.long, self.short, self.include))
+ self.clean()
+ self.tlist = []
def characters(self, data):
self.tlist.append(data)
@@ -66,35 +80,70 @@ if __name__ == "__main__":
type_map = { 'bool' : 0, 'int' : 1 , 'string' : 2 }
- print copy
-
parser = SchemaHandler()
parser.parse(sys.argv[1])
- for (key, key_type, default) in parser.list:
+
+ f = open("_GrampsConfigKeys","w")
+
+ for (key, key_type, default, long, short, include) in parser.list:
data = key.split('/')
category = data[3]
token = data[4]
+ tkey = token.upper().replace('-','_')
+ tmap = type_map[key_type]
- print "%-20s = ('%s','%s', %d)" % (token.upper().replace('-','_'),
- category,
- token,
- type_map[key_type])
+ f.write("%-20s = ('%s','%s', %d)\n" % (tkey,
+ category,
+ token,
+ tmap))
- print '\n\ndefault_value = {'
- for (key, key_type, default) in parser.list:
+ f.write('\n\ndefault_value = {\n')
+ for (key, key_type, default, long, short, include) in parser.list:
data = key.split('/')
category = data[3]
token = data[4]
tkey = token.upper().replace('-','_')
if key_type == 'bool':
if default == "1":
- print " %-20s : True," % tkey
+ f.write(" %-20s : True,\n" % tkey)
else:
- print " %-20s : False," % tkey
+ f.write(" %-20s : False,\n" % tkey)
elif key_type == "int":
- print " %-20s : %s," % (tkey,default)
+ f.write(" %-20s : %s,\n" % (tkey,default))
else:
- print " %-20s : '%s'," % (tkey,default)
+ f.write(" %-20s : '%s',\n" % (tkey,default))
- print '}'
-
+ f.write('}\n')
+ f.close()
+
+ f = open("schema.xml.in","w")
+
+ f.write('\n')
+ f.write(' \n')
+ for (key, key_type, default, long, short, include) in parser.list:
+ f.write(' \n')
+ f.write(' /schemas%s\n' % key)
+ f.write(' /schemas%s\n' % key)
+ f.write(' gramps\n')
+ f.write(' %s\n' % type)
+ f.write(' %s\n' % default)
+ f.write(' \n')
+ f.write(' %s\n' % short)
+ f.write(' %s\n' % long)
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write('\n')
+ f.close()
+
+ f = open("ConfigInterface.py","w")
+ for (key, key_type, default, long, short, include) in parser.list:
+ if not include:
+ continue
+ data = key.split('/')
+ category = data[3]
+ token = data[4]
+ tkey = token.upper().replace('-','_')
+ if key_type == "bool":
+ f.write("GrampsConfigCheckBox(_('%s'),Config.%s)\n" % (short,tkey))
+ f.close()
diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py
index 7e533cd44..73a5c7272 100644
--- a/src/GrampsCfg.py
+++ b/src/GrampsCfg.py
@@ -25,7 +25,6 @@
# Standard python modules
#
#-------------------------------------------------------------------------
-import os
import sets
from gettext import gettext as _
@@ -34,7 +33,6 @@ from gettext import gettext as _
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
-import gobject
import gtk
import gtk.glade
@@ -44,20 +42,16 @@ import gtk.glade
#
#-------------------------------------------------------------------------
import Config
-import RelLib
-import const
import DateHandler
import GrampsDisplay
-import QuestionDialog
+import ManagedWindow
+from GrampsWidgets import *
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
-INDEX = "i"
-OBJECT = "o"
-DATA = "d"
_surname_styles = [
_("Father's surname"),
@@ -65,62 +59,15 @@ _surname_styles = [
_("Combination of mother's and father's surname"),
_("Icelandic style"),
]
-
-panellist = [
- (_("Display"),
- [( _("General"), 3),
- ( _("Dates"), 4),
- ( _("Toolbar and Statusbar"), 2)]),
- (_("Database"),
- [( _("General"), 1),
- ( _("GRAMPS IDs"), 6),
- ( _("Researcher Information"), 5)]),
- ]
-
-
-# Not exactly gconf keys, but the functions directly dependent on them
+
def set_calendar_date_format():
format_list = DateHandler.get_date_formats()
DateHandler.set_format(Config.get_date_format(format_list))
-def _update_calendar_date_format(active,dlist):
- Config.save_date_format(active,dlist)
- DateHandler.set_format(active)
-
-#-------------------------------------------------------------------------
-#
-# 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)
-
-#-------------------------------------------------------------------------
-#
-#
-#
-#-------------------------------------------------------------------------
-def loadConfig():
- """
- Load preferences on startup. Not much to do, since all the prefs
- are in gconf and can be retrieved any time.
- """
- 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"))
-
-#-------------------------------------------------------------------------
-#
-#
-#
-#-------------------------------------------------------------------------
def get_researcher():
+ import RelLib
+
n = Config.get(Config.RESEARCHER_NAME)
a = Config.get(Config.RESEARCHER_ADDR)
c = Config.get(Config.RESEARCHER_CITY)
@@ -133,259 +80,186 @@ def get_researcher():
owner = RelLib.Researcher()
owner.set(n,a,c,s,ct,p,ph,e)
return owner
-
+
+
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
-class GrampsPreferences:
- def __init__(self,db):
- self.built = 0
- self.db = db
- self.top = gtk.glade.XML(const.gladeFile,"preferences","gramps")
+class GrampsPreferences(ManagedWindow.ManagedWindow):
+ def __init__(self, uistate):
- self.top.get_widget('button6').connect('clicked',self.on_close_clicked)
- self.top.get_widget('button7').connect('clicked',self.help_clicked)
+ ManagedWindow.ManagedWindow.__init__(self, uistate, [], GrampsPreferences)
+
+ tlabel = gtk.Label()
+ self.set_window(gtk.Dialog(_('Preferences'),
+ flags=gtk.DIALOG_NO_SEPARATOR,
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)),
+ tlabel, _('Preferences'), None)
+
+ panel = gtk.Notebook()
+ self.window.vbox.pack_start(tlabel, padding=12)
+ self.window.vbox.add(panel)
+ self.window.connect('response',self.done)
+ panel.append_page(self.add_researcher_panel(),
+ MarkupLabel("%s" % _('Researcher')))
+ panel.append_page(self.add_formats_panel(),
+ MarkupLabel("%s" % _('Formats')))
+ panel.append_page(self.add_behavior_panel(),
+ MarkupLabel("%s" % _('Behavior')))
+ panel.append_page(self.add_prefix_panel(),
+ MarkupLabel("%s" % _('ID Prefixes')))
+ panel.append_page(self.add_advanced_panel(),
+ MarkupLabel("%s" % _('Advanced')))
+
+ self.window.show_all()
+ self.show()
+
+ def done(self, obj, value):
+ self.close()
+
+ def add_researcher_panel(self):
+ table = gtk.Table(3,8)
+ table.set_border_width(12)
+ table.set_col_spacings(6)
+ table.set_row_spacings(6)
+ self.add_entry(table, _('Name'), 0, Config.RESEARCHER_NAME)
+ self.add_entry(table, _('Address'), 1, Config.RESEARCHER_ADDR)
+ self.add_entry(table, _('City'), 2, Config.RESEARCHER_CITY)
+ self.add_entry(table, _('State/Province'), 3, Config.RESEARCHER_STATE)
+ self.add_entry(table, _('Country'), 4, Config.RESEARCHER_COUNTRY)
+ self.add_entry(table, _('ZIP/Postal Code'), 5, Config.RESEARCHER_POSTAL)
+ self.add_entry(table, _('Phone'), 6, Config.RESEARCHER_PHONE)
+ self.add_entry(table, _('Email'), 7, Config.RESEARCHER_EMAIL)
+ return table
+
+ def add_prefix_panel(self):
+ table = gtk.Table(3,8)
+ table.set_border_width(12)
+ table.set_col_spacings(6)
+ table.set_row_spacings(6)
+ self.add_entry(table, _('Person'), 0, Config.IPREFIX)
+ self.add_entry(table, _('Family'), 1, Config.FPREFIX)
+ self.add_entry(table, _('Place'), 2, Config.PPREFIX)
+ self.add_entry(table, _('Source'), 3, Config.SPREFIX)
+ self.add_entry(table, _('Media Object'), 4, Config.OPREFIX)
+ self.add_entry(table, _('Event'), 5, Config.EPREFIX)
+ self.add_entry(table, _('Repository'), 6, Config.RPREFIX)
+ return table
+
+ def add_advanced_panel(self):
+ table = gtk.Table(3,8)
+ table.set_border_width(12)
+ table.set_col_spacings(6)
+ table.set_row_spacings(6)
+ self.add_checkbox(table, _('Warn when adding parents to a child'),
+ 0, Config.FAMILY_WARN)
- self.window = self.top.get_widget("preferences")
- self.window.connect('delete_event',self.on_close_clicked)
- self.tree = self.top.get_widget("tree")
- self.image = self.top.get_widget('image')
- self.image.set_from_file(os.path.join(const.image_dir,'splash.jpg'))
+ self.add_checkbox(table, _('Suppress warning when cancelling with changed data'),
+ 1, Config.DONT_ASK)
- 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()
- self.built = 1
- self.window.show()
-
- def build_tree(self):
- prev = None
- ilist = []
- for (name,lst) in panellist:
- node = self.store.insert_after(None, prev)
- self.store.set(node,0,name)
- next = None
- for (subname,tab) in lst:
- 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
+ self.add_checkbox(table, _('Show plugin status dialog on plugin load error'),
+ 2, Config.POP_PLUGIN_STATUS)
- def build(self):
+ return table
- auto = self.top.get_widget("autoload")
- auto.set_active(Config.get(Config.AUTOLOAD))
- auto.connect('toggled',
- lambda obj: Config.set(Config.AUTOLOAD,obj.get_active()))
+ def add_formats_panel(self):
+ table = gtk.Table(3,8)
+ table.set_border_width(12)
+ table.set_col_spacings(6)
+ table.set_row_spacings(6)
- spell = self.top.get_widget("spellcheck")
- spell.set_active(Config.get(Config.SPELLCHECK))
- spell.connect('toggled',
- lambda obj: Config.set(Config.SPELLCHECK))
+ obox = gtk.combo_box_new_text()
+ formats = DateHandler.get_date_formats()
+ for item in formats:
+ obox.append_text(item)
- lds = self.top.get_widget("uselds")
- lds.set_active(Config.get(Config.USE_LDS))
- lds.connect('toggled',
- lambda obj: Config.set(Config.USE_LDS,obj.get_active()))
+ active = Config.get(Config.DATE_FORMAT)
+ if active >= len(formats):
+ active = 0
+ obox.set_active(active)
+ obox.connect('changed',
+ lambda obj: Config.set(Config.DATE_FORMAT, obj.get_active()))
- self.ipr = self.top.get_widget("iprefix")
- self.ipr.set_text(Config.get(Config.IPREFIX))
- self.opr = self.top.get_widget("oprefix")
- self.opr.set_text(Config.get(Config.OPREFIX))
- self.fpr = self.top.get_widget("fprefix")
- self.fpr.set_text(Config.get(Config.FPREFIX))
- self.spr = self.top.get_widget("sprefix")
- self.spr.set_text(Config.get(Config.SPREFIX))
- self.ppr = self.top.get_widget("pprefix")
- self.ppr.set_text(Config.get(Config.PPREFIX))
+ lwidget = BasicLabel("%s: " % _('Date format'))
+ table.attach(lwidget, 0, 1, 0, 1, yoptions=0)
+ table.attach(obox, 1, 3, 0, 1, yoptions=0)
- sb2 = self.top.get_widget("stat2")
- sb3 = self.top.get_widget("stat3")
- if Config.get(Config.STATUSBAR) == 0 or Config.get(Config.STATUSBAR) == 1:
- sb2.set_active(1)
+ obox = gtk.combo_box_new_text()
+ formats = _surname_styles
+ for item in formats:
+ obox.append_text(item)
+ obox.set_active(Config.get(Config.SURNAME_GUESSING))
+ obox.connect('changed',
+ lambda obj: Config.set(Config.SURNAME_GUESSING, obj.get_active()))
+
+ lwidget = BasicLabel("%s: " % _('Surname Guessing'))
+ table.attach(lwidget, 0, 1, 1, 2, yoptions=0)
+ table.attach(obox, 1, 3, 1, 2, yoptions=0)
+
+ obox = gtk.combo_box_new_text()
+ formats = [_("Active person's name and ID"),
+ _("Relationship to home person")]
+
+ for item in formats:
+ obox.append_text(item)
+ active = Config.get(Config.STATUSBAR)
+ if active < 2:
+ obox.set_active(0)
else:
- sb3.set_active(1)
- sb2.connect('toggled',
- lambda obj: Config.set(Config.STATUSBAR,(2-obj.get_active())))
+ obox.set_active(1)
+ obox.connect('changed',
+ lambda obj: Config.set(Config.STATUSBAR, 2*obj.get_active()))
- toolbarmenu = self.top.get_widget("tooloptmenu")
- toolbarmenu.set_active(Config.get(Config.TOOLBAR)+1)
- toolbarmenu.connect('changed',
- lambda obj: Config.set(Config.TOOLBAR,obj.get_active()-1))
+ lwidget = BasicLabel("%s: " % _('Status bar'))
+ table.attach(lwidget, 0, 1, 2, 3, yoptions=0)
+ table.attach(obox, 1, 3, 2, 3, yoptions=0)
+
+ return table
- pvbutton = self.top.get_widget('pvbutton')
- fvbutton = self.top.get_widget('fvbutton')
- if Config.get(Config.DEFAULT_VIEW) == 0:
- pvbutton.set_active(1)
- else:
- fvbutton.set_active(1)
- fvbutton.connect('toggled',
- lambda obj: Config.set(Config.DEFAULT_VIEW,(obj.get_active())))
+ # status bar
- usetips = self.top.get_widget('usetips')
- usetips.set_active(Config.get(Config.USE_TIPS))
- usetips.connect('toggled',
- lambda obj: Config.set(Config.USE_TIPS,obj.get_active()))
+ def add_behavior_panel(self):
+ table = gtk.Table(3,8)
+ table.set_border_width(12)
+ table.set_col_spacings(6)
+ table.set_row_spacings(6)
- lastnamegen_obj = self.top.get_widget("lastnamegen")
- cell = gtk.CellRendererText()
- lastnamegen_obj.pack_start(cell,True)
- lastnamegen_obj.add_attribute(cell,'text',0)
+ self.add_checkbox(table, _('Automatically load last database'), 0, Config.AUTOLOAD)
+ self.add_checkbox(table, _('Enable spelling checker'), 1, Config.SPELLCHECK)
+ self.add_checkbox(table, _('Display Tip of the Day'), 2, Config.USE_TIPS)
- store = gtk.ListStore(str)
- for name in _surname_styles:
- store.append(row=[name])
- lastnamegen_obj.set_model(store)
- guess = Config.get(Config.SURNAME_GUESSING)
- if guess not in _surname_styles:
- guess = Config.default_value[Config.SURNAME_GUESSING]
-
- lastnamegen_obj.set_active(guess)
- lastnamegen_obj.connect("changed",
- lambda obj:
- Config.set(Config.SURNAME_GUESSING,obj.get_active())
- )
+ return table
- date_option = self.top.get_widget("date_format")
- dlist = DateHandler.get_date_formats()
- 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])
-
- date_option.set_model(store)
- try:
- # Technically, a selected format might be out of range
- # for this locale's format list.
- date_option.set_active(Config.get_date_format(dlist))
- except:
- date_option.set_active(0)
-
- date_option.connect("changed",
- lambda obj:
- _update_calendar_date_format(obj.get_active(),dlist)
- )
-
- resname = self.top.get_widget("resname")
- resname.set_text(Config.get(Config.RESEARCHER_NAME))
- resname.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_NAME,obj.get_text()))
- resaddr = self.top.get_widget("resaddr")
- resaddr.set_text(Config.get(Config.RESEARCHER_ADDR))
- resaddr.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_ADDR,obj.get_text()))
- rescity = self.top.get_widget("rescity")
- rescity.set_text(Config.get(Config.RESEARCHER_CITY))
- rescity.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_CITY,obj.get_text()))
- resstate = self.top.get_widget("resstate")
- resstate.set_text(Config.get(Config.RESEARCHER_STATE))
- resstate.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_STATE,obj.get_text()))
- rescountry = self.top.get_widget("rescountry")
- rescountry.set_text(Config.get(Config.RESEARCHER_COUNTRY))
- rescountry.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_COUNTRY,obj.get_text()))
- respostal = self.top.get_widget("respostal")
- respostal.set_text(Config.get(Config.RESEARCHER_POSTAL))
- respostal.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_POSTAL,obj.get_text()))
- resphone = self.top.get_widget("resphone")
- resphone.set_text(Config.get(Config.RESEARCHER_PHONE))
- resphone.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_PHONE,obj.get_text()))
- resemail = self.top.get_widget("resemail")
- resemail.set_text(Config.get(Config.RESEARCHER_EMAIL))
- resemail.connect('changed',
- lambda obj: Config.set(Config.RESEARCHER_EMAIL,obj.get_text()))
-
- 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()
+ def add_checkbox(self, table, label, index, constant):
+ checkbox = gtk.CheckButton(label)
+ checkbox.set_active(Config.get(constant))
+ checkbox.connect('toggled',self.update_checkbox, constant)
+ table.attach(checkbox, 1, 3, index, index+1, yoptions=0)
- # 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
+ def add_entry(self, table, label, index, constant):
+ lwidget = BasicLabel("%s: " % label)
+ entry = gtk.Entry()
+ entry.set_text(Config.get(constant))
+ entry.connect('changed', self.update_entry, constant)
+ table.attach(lwidget, 0, 1, index, index+1, yoptions=0)
+ table.attach(entry, 1, 3, index, index+1, yoptions=0)
- Config.set(Config.IPREFIX,ip)
- Config.set(Config.OPREFIX,op)
- Config.set(Config.FPREFIX,fp)
- Config.set(Config.SPREFIX,sp)
- Config.set(Config.PPREFIX,pp)
- return True
-
- def select(self,obj):
- store,node = self.selection.get_selected()
- if node:
- path = store.get_path(node)
- if node and self.imap.has_key(path):
- self.panel.set_current_page(self.imap[path])
-
- def help_clicked(self,obj):
- GrampsDisplay.help('gramps-prefs')
+ def update_entry(self, obj, constant):
+ Config.set(constant, unicode(obj.get_text()))
+
+ def update_checkbox(self, obj, constant):
+ Config.set(constant, obj.get_active())
+
+ def build_menu_names(self,obj):
+ return (_('Preferences'),None)
+
+ def build_window_key(self,obj):
+ return id(GrampsPreferences)
+
+
+if __name__ == "__main__":
+ GrampsPreferences(None,None)
+ gtk.main()
- def on_close_clicked(self,obj=None,dummy=None):
- if not self.save_prefix():
- return False
- self.window.destroy()
-
-#-------------------------------------------------------------------------
-#
-# Create the property box, and set the elements off the current values
-#
-#-------------------------------------------------------------------------
-def display_preferences_box(db):
- GrampsPreferences(db)
diff --git a/src/GrampsDb/_ReadXML.py b/src/GrampsDb/_ReadXML.py
index 9b1ada7a0..fccc9b044 100644
--- a/src/GrampsDb/_ReadXML.py
+++ b/src/GrampsDb/_ReadXML.py
@@ -1423,20 +1423,23 @@ class GrampsParser:
else:
self.person.add_event_ref(ref)
-## # FIXME: re-enable when event types are fixed.
-## if self.event.get_description() == "" and \
-## self.event.get_type()[0] != RelLib.Event.CUSTOM:
-## if self.family:
-## text = _event_family_str % {
-## 'event_name' : Utils.family_events[self.event.get_type()[0]],
-## 'family' : Utils.family_name(self.family,self.db),
-## }
-## else:
-## text = _event_person_str % {
-## 'event_name' : Utils.personal_events[self.event.get_type()[0]],
-## 'person' : NameDisplay.displayer.display(self.person),
-## }
-## self.event.set_description(text)
+ # FIXME: re-enable when event types are fixed.
+
+ if self.event.get_description() == "" and \
+ self.event.get_type() != RelLib.EventType.CUSTOM:
+ if self.family:
+ text = _event_family_str % {
+ 'event_name' : str(self.event.get_type()),
+ 'family' : Utils.family_name(self.family,self.db),
+ }
+ elif self.person:
+ text = _event_person_str % {
+ 'event_name' : str(self.event.get_type()),
+ 'person' : NameDisplay.displayer.display(self.person),
+ }
+ else:
+ text = u''
+ self.event.set_description(text)
self.db.commit_event(self.event,self.trans,self.change)
self.event = None
diff --git a/src/ViewManager.py b/src/ViewManager.py
index 1f4722a7c..fbe80b415 100644
--- a/src/ViewManager.py
+++ b/src/ViewManager.py
@@ -424,7 +424,7 @@ class ViewManager:
GrampsDisplay.url( const.url_mailinglist)
def preferences_activate(self, obj):
- GrampsCfg.display_preferences_box(self.state.db)
+ GrampsCfg.GrampsPreferences(self.uistate)
def report_bug_activate(self, obj):
import GrampsDisplay
diff --git a/src/gramps_main.py b/src/gramps_main.py
index a9de25175..39dd82cb1 100644
--- a/src/gramps_main.py
+++ b/src/gramps_main.py
@@ -27,6 +27,7 @@
#-------------------------------------------------------------------------
import gtk
import logging
+import os
log = logging.getLogger(".")
@@ -101,6 +102,19 @@ def register_stock_icons ():
icon_set = gtk.IconSet (pixbuf)
factory.add (data[0], icon_set)
+
+def build_user_paths():
+ user_paths = [const.home_dir,
+ os.path.join(const.home_dir,"filters"),
+ os.path.join(const.home_dir,"plugins"),
+ os.path.join(const.home_dir,"templates"),
+ os.path.join(const.home_dir,"thumb")]
+
+ for path in user_paths:
+ if not os.path.isdir(path):
+ os.mkdir(path)
+
+
class Gramps:
"""
Main class corresponding to a running gramps process.
@@ -111,7 +125,7 @@ class Gramps:
def __init__(self,args):
try:
- GrampsCfg.loadConfig()
+ build_user_paths()
self.welcome()
except OSError, msg:
ErrorDialog(_("Configuration error"),str(msg))