From bb26dd5aa78bcf5b2662558bf1c1a3aede19ad5f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 12 May 2003 19:39:49 +0000 Subject: [PATCH] Fixed marriage problem and startup dialog svn: r1515 --- gramps2/src/AUTHORS | 1 + gramps2/src/GrampsParser.py | 3 + gramps2/src/Marriage.py | 4 +- gramps2/src/PedView.py | 8 +- gramps2/src/ReadXML.py | 2 + gramps2/src/StartupDialog.py | 242 +++++++++++++++++++++++++++++------ gramps2/src/const.py | 2 +- gramps2/src/gramps_main.py | 3 +- 8 files changed, 219 insertions(+), 46 deletions(-) diff --git a/gramps2/src/AUTHORS b/gramps2/src/AUTHORS index afc5ea57a..77996e9ce 100644 --- a/gramps2/src/AUTHORS +++ b/gramps2/src/AUTHORS @@ -1,2 +1,3 @@ Don Allingham Don Peterson +Alex Roitman diff --git a/gramps2/src/GrampsParser.py b/gramps2/src/GrampsParser.py index 55822b883..ebb80704a 100644 --- a/gramps2/src/GrampsParser.py +++ b/gramps2/src/GrampsParser.py @@ -181,6 +181,7 @@ class GrampsParser: "url" : (self.start_url, None) } + def parse(self,file): p = xml.parsers.expat.ParserCreate() p.StartElementHandler = self.startElement @@ -194,6 +195,8 @@ class GrampsParser: if self.db.personMap.has_key(id) and self.db.getDefaultPerson() == None: person = self.db.personMap[id] self.db.setDefaultPerson(person) + for key in self.func_map.keys(): + del self.func_map[key] def start_lds_ord(self,attrs): type = attrs['type'] diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index da24c1058..76a41c4a0 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modiy # it under the terms of the GNU General Public License as published by @@ -147,7 +147,7 @@ class Marriage: self.etree = ListModel.ListModel(self.event_list, etitles, self.on_select_row, - self.on_update_clicked) + self.on_event_update_clicked) self.atree = ListModel.ListModel(self.attr_list, atitles, self.on_attr_list_select_row, self.on_update_attr_clicked) diff --git a/gramps2/src/PedView.py b/gramps2/src/PedView.py index dfdb5a394..c368a2115 100644 --- a/gramps2/src/PedView.py +++ b/gramps2/src/PedView.py @@ -87,10 +87,10 @@ class DispBox: self.group.set_data('p',person) def cleanup(self): - self.shadow.destroy() - self.bkgnd.destroy() - self.textbox.destroy() - self.group.destroy() + self.shadow.destroy() + self.bkgnd.destroy() + self.textbox.destroy() + self.group.destroy() def group_event(self,obj,event): """Handle events over a drawn box. Doubleclick would edit, diff --git a/gramps2/src/ReadXML.py b/gramps2/src/ReadXML.py index e36001dc1..a7a95ee18 100644 --- a/gramps2/src/ReadXML.py +++ b/gramps2/src/ReadXML.py @@ -113,6 +113,7 @@ def importData(database, filename, callback): return 0 xml_file.close() + del parser # Rename media files if they were conflicting with existing ones ObjectMap = database.getObjectMap() @@ -218,6 +219,7 @@ def loadData(database, filename, callback=None): return 0 xml_file.close() + del parser return 1 #------------------------------------------------------------------------- diff --git a/gramps2/src/StartupDialog.py b/gramps2/src/StartupDialog.py index d9b6abd12..f585e03e8 100644 --- a/gramps2/src/StartupDialog.py +++ b/gramps2/src/StartupDialog.py @@ -20,13 +20,16 @@ import const import gtk.glade +import gnome +import gnome.ui import gconf import Utils +from intl import gettext as _ + _StartupEntry = "/apps/gramps/startup" def need_to_run(): - return 0 client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) val = client.get_int(_StartupEntry) @@ -36,55 +39,218 @@ def need_to_run(): return 1 return 0 - class StartupDialog: def __init__(self,task,arg): + self.task = task self.arg = arg - self.druid = gtk.glade.XML(const.configFile,"initDruid") - self.druid.signal_autoconnect({ - "on_cancel_clicked" : self.on_cancel_clicked, - "destroy_event": self.destroy, - "on_finish" : self.on_finish - }) - - self.rlist = ['name','addr','city','state','country', - 'postal', 'phone', 'email'] + self.w = gtk.Window() + self.fg_color = gtk.gdk.color_parse('#7d684a') + self.bg_color = gtk.gdk.color_parse('#e1dbc5') + self.logo = gtk.gdk.pixbuf_new_from_file("/home/dona/Projects/gramps2/src/gramps.png") + self.splash = gtk.gdk.pixbuf_new_from_file("/home/dona/Projects/gramps2/src/splash.jpg") + 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()) + d.connect('cancel',self.close) + self.w.connect("destroy_event", self.close) + self.client = gconf.client_get_default() - for tag in self.rlist: - val = self.client.get_string("/apps/gramps/researcher-%s" % tag) - if val != None: - self.druid.get_widget(tag).set_text(val) - + self.w.show_all() - def destroy(self,obj): + def close(self,obj): self.task(self.arg) - - def on_finish(self,obj,b): - for tag in self.rlist: - val = self.druid.get_widget(tag).get_text() - self.client.set_string("/apps/gramps/researcher-%s" % tag,val) - if self.druid.get_widget("num_us").get_active(): - dateFormat = 0 - elif self.druid.get_widget("num_eu").get_active(): - dateFormat = 1 - else: - dateFormat = 2 - self.client.set_int("/apps/gramps/dateEntry",dateFormat) + 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 - showcal = self.druid.get_widget("altcal").get_active() - self.client.set_int("/apps/gramps/ShowCalendar",showcal) + 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) - lds = self.druid.get_widget("enable_lds").get_active() - self.client.set_int("/apps/gramps/UseLDS",lds) + 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, ' + 'suggest improvements, and see how you can ' + 'contribute.\n\nPlease enjoy using GRAMPS.')) + return p + + 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()) self.client.set_int(_StartupEntry,const.startup) - Utils.destroy_passed_object(obj) + self.w.destroy() + self.task(self.arg) + + 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 ' + 'needs to be entered. If you do not plan to generated GEDCOM files, ' + '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() + return p - def on_cancel_clicked(self,obj): - self.client.set_int(_StartupEntry,const.startup) - self.client.sync() - Utils.destroy_passed_object(obj) + 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' + 'for entering numerical dates')) + 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) + + 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")) + 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")) + 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 diff --git a/gramps2/src/const.py b/gramps2/src/const.py index 68a64b5ce..0bab81726 100644 --- a/gramps2/src/const.py +++ b/gramps2/src/const.py @@ -95,7 +95,7 @@ gtkrcFile = "%s/gtkrc" % rootDir template_dir = "%s/templates" % dataDir fdl = "%s/fdl.txt" % dataDir -startup = 1 +startup = 2 #------------------------------------------------------------------------- # diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 5c3d46d41..dd553002e 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -677,7 +677,8 @@ class Gramps: def tool_callback(self,val): if val: Utils.modified() - self.complete_rebuild() + self.clear_person_tabs() + self.full_update() def full_update(self): """Brute force display update, updating all the pages"""