From e776ef23bff6a86bfaa8533b0d1e779307e631a1 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 15 Jul 2004 02:54:04 +0000 Subject: [PATCH] * src/data/gramps.schemas: Cleanup. * src/data/Makefile.am: Clen up install rule. Add uninstall rule. * src/StartupDialog.py: Correct use of keys. * src/GrampsCfg.py: Correct usage of gconf. * src/DbPrompter.py: Remove unused module. * src/SelectChild.py: Remove unused module. * src/SelectObject.py: Remove unused module. * src/WriteXML.py: Remove unused module. * src/gramps_main.py: Convert to new gconf usage. * src/FamilyView.py: Convert to new gconf usage. * src/AddSpouse.py: Convert to new gconf usage. * src/ChooseParents.py: Convert to new gconf usage. * src/EditPerson.py: Convert to new gconf usage. * src/EditPlace.py: Convert to new gconf usage. * src/EditSource.py: Convert to new gconf usage. * src/EventEdit.py: Convert to new gconf usage. * src/ImageSelect.py: Convert to new gconf usage. * src/Marriage.py: Convert to new gconf usage. * src/MediaView.py: Convert to new gconf usage. * src/MergeData.py: Convert to new gconf usage. * src/PedView.py: Convert to new gconf usage. * src/Plugins.py: Convert to new gconf usage. * src/RelLib.py: Convert to new gconf usage. * src/TipOfDay.py: Convert to new gconf usage. * src/plugins/AncestorChart2.py: Remove unused module. * src/plugins/AncestorChart.py: Remove unused module. * src/plugins/BookReport.py: Remove unused module. * src/plugins/FanChart.py: Remove unused module. * src/plugins/Partition.py: Remove unused module. * src/plugins/Desbrowser.py: Convert to new gconf usage. * src/plugins/Merge.py: Convert to new gconf usage. * src/plugins/RelCalc.py: Convert to new gconf usage. * src/plugins/WebPage.py: Convert to new gconf usage. svn: r3274 --- ChangeLog | 35 ++ src/AddSpouse.py | 2 +- src/ChooseParents.py | 4 +- src/DbPrompter.py | 1 - src/EditPerson.py | 16 +- src/EditPlace.py | 10 +- src/EditSource.py | 10 +- src/EventEdit.py | 2 +- src/FamilyView.py | 24 +- src/GrampsCfg.py | 598 ++++++++++++++-------------------- src/ImageSelect.py | 10 +- src/Marriage.py | 6 +- src/MediaView.py | 6 +- src/MergeData.py | 26 +- src/PedView.py | 20 +- src/Plugins.py | 6 +- src/RelLib.py | 6 +- src/SelectChild.py | 1 - src/SelectObject.py | 1 - src/StartupDialog.py | 30 +- src/TipOfDay.py | 4 +- src/WriteXML.py | 1 - src/data/Makefile.am | 6 +- src/data/gramps.schemas | 24 +- src/gramps_main.py | 49 +-- src/plugins/AncestorChart.py | 1 - src/plugins/AncestorChart2.py | 1 - src/plugins/BookReport.py | 1 - src/plugins/Desbrowser.py | 2 +- src/plugins/FanChart.py | 1 - src/plugins/Merge.py | 2 +- src/plugins/RelCalc.py | 4 +- src/plugins/WebPage.py | 4 +- 33 files changed, 423 insertions(+), 491 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f437eb3e..af8d0acd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2004-07-14 Alex Roitman + * src/data/gramps.schemas: Cleanup. + * src/data/Makefile.am: Clen up install rule. Add uninstall rule. + * src/StartupDialog.py: Correct use of keys. + * src/GrampsCfg.py: Correct usage of gconf. + * src/DbPrompter.py: Remove unused module. + * src/SelectChild.py: Remove unused module. + * src/SelectObject.py: Remove unused module. + * src/WriteXML.py: Remove unused module. + * src/gramps_main.py: Convert to new gconf usage. + * src/FamilyView.py: Convert to new gconf usage. + * src/AddSpouse.py: Convert to new gconf usage. + * src/ChooseParents.py: Convert to new gconf usage. + * src/EditPerson.py: Convert to new gconf usage. + * src/EditPlace.py: Convert to new gconf usage. + * src/EditSource.py: Convert to new gconf usage. + * src/EventEdit.py: Convert to new gconf usage. + * src/ImageSelect.py: Convert to new gconf usage. + * src/Marriage.py: Convert to new gconf usage. + * src/MediaView.py: Convert to new gconf usage. + * src/MergeData.py: Convert to new gconf usage. + * src/PedView.py: Convert to new gconf usage. + * src/Plugins.py: Convert to new gconf usage. + * src/RelLib.py: Convert to new gconf usage. + * src/TipOfDay.py: Convert to new gconf usage. + * src/plugins/AncestorChart2.py: Remove unused module. + * src/plugins/AncestorChart.py: Remove unused module. + * src/plugins/BookReport.py: Remove unused module. + * src/plugins/FanChart.py: Remove unused module. + * src/plugins/Partition.py: Remove unused module. + * src/plugins/Desbrowser.py: Convert to new gconf usage. + * src/plugins/Merge.py: Convert to new gconf usage. + * src/plugins/RelCalc.py: Convert to new gconf usage. + * src/plugins/WebPage.py: Convert to new gconf usage. + 2004-07-13 Alex Roitman * src/Exporter.py: Fix EXPAND/FILL state of the chooser widget. * src/DbPrompter.py (SaveAsDbPrompter): Remove class. diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 645e15bb6..7ce4a6562 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -127,7 +127,7 @@ class AddSpouse: self.ok.set_sensitive(0) self.rel_combo.set_popdown_strings(const.familyRelations) - title = _("Choose Spouse/Partner of %s") % GrampsCfg.nameof(person) + title = _("Choose Spouse/Partner of %s") % GrampsCfg.get_nameof()(person) Utils.set_titles(self.glade.get_widget('spouseDialog'), self.glade.get_widget('title'),title, diff --git a/src/ChooseParents.py b/src/ChooseParents.py index f55ee4ce5..03399ed00 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -119,7 +119,7 @@ class ChooseParents: self.top = self.glade.get_widget("familyDialog") self.title_text = _("Choose the Parents of %s") % \ - GrampsCfg.nameof(self.person) + GrampsCfg.get_nameof()(self.person) Utils.set_titles(self.top,self.glade.get_widget('title'), self.title_text,_('Choose Parents')) @@ -665,7 +665,7 @@ class ModifyParents: self.top = self.glade.get_widget("modparents") self.title = self.glade.get_widget("title") - title = _("Modify the Parents of %s") % GrampsCfg.nameof(self.person) + title = _("Modify the Parents of %s") % GrampsCfg.get_nameof()(self.person) Utils.set_titles(self.top, self.title, title, _("Modify Parents")) self.mother_rel = self.glade.get_widget("mrel") diff --git a/src/DbPrompter.py b/src/DbPrompter.py index bddd32493..00456a12d 100644 --- a/src/DbPrompter.py +++ b/src/DbPrompter.py @@ -46,7 +46,6 @@ import gnome #------------------------------------------------------------------------- import Utils import const -import GrampsCfg import QuestionDialog import Plugins diff --git a/src/EditPerson.py b/src/EditPerson.py index eb08229ba..3ab63e9e8 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -295,7 +295,7 @@ class EditPerson: self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment()) self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing()) - if GrampsCfg.uselds \ + if GrampsCfg.get_uselds() \ or (not self.lds_baptism.is_empty()) \ or (not self.lds_endowment.is_empty()) \ or (not self.lds_sealing.is_empty()): @@ -448,7 +448,7 @@ class EditPerson: def add_itself_to_winsmenu(self): self.parent.child_windows[self.orig_id] = self - win_menu_label = GrampsCfg.nameof(self.person) + win_menu_label = GrampsCfg.get_nameof()(self.person) if not win_menu_label.strip(): win_menu_label = _("New Person") self.win_menu_item = gtk.MenuItem(win_menu_label) @@ -563,12 +563,12 @@ class EditPerson: m = self.db.try_to_find_person_from_id(m_id) if f and m: name = _("%(father)s and %(mother)s") % { - 'father' : GrampsCfg.nameof(f), - 'mother' : GrampsCfg.nameof(m) } + 'father' : GrampsCfg.get_nameof()(f), + 'mother' : GrampsCfg.get_nameof()(m) } elif f: - name = GrampsCfg.nameof(f) + name = GrampsCfg.get_nameof()(f) elif m: - name = GrampsCfg.nameof(m) + name = GrampsCfg.get_nameof()(m) else: name = _("unknown") item = gtk.MenuItem(name) @@ -1454,7 +1454,7 @@ class EditPerson: if not person: self.person.set_gramps_id(idval) else: - n = GrampsCfg.nameof(person) + n = GrampsCfg.get_nameof()(person) msg1 = _("GRAMPS ID value was not changed.") msg2 = _("You have attempted to change the GRAMPS ID to a value " "of %(grampsid)s. This value is already used by %(person)s.") % { @@ -1738,7 +1738,7 @@ class EditPerson: def write_primary_name(self): # initial values - name = '%s' % GrampsCfg.nameof(self.person) + name = '%s' % GrampsCfg.get_nameof()(self.person) self.get_widget("activepersonTitle").set_text(name) self.get_widget("activepersonTitle").set_use_markup(gtk.TRUE) self.suffix.set_text(self.pname.get_suffix()) diff --git a/src/EditPlace.py b/src/EditPlace.py index d4d69d429..273b409af 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -500,7 +500,7 @@ class EditPlace: t = _("%s [%s]: event %s\n") for e in pevent: - msg = msg + ( t % (GrampsCfg.nameof(e[0]),e[0].get_id(),_(e[1].get_name()))) + msg = msg + ( t % (GrampsCfg.get_nameof()(e[0]),e[0].get_id(),_(e[1].get_name()))) if len(fevent) > 0: any = 1 @@ -513,12 +513,12 @@ class EditPlace: mother = e[0].get_mother_id() if father and mother: fname = _("%(father)s and %(mother)s") % { - "father" : GrampsCfg.nameof(father), - "mother" : GrampsCfg.nameof(mother) } + "father" : GrampsCfg.get_nameof()(father), + "mother" : GrampsCfg.get_nameof()(mother) } elif father: - fname = "%s" % GrampsCfg.nameof(father) + fname = "%s" % GrampsCfg.get_nameof()(father) else: - fname = "%s" % GrampsCfg.nameof(mother) + fname = "%s" % GrampsCfg.get_nameof()(mother) msg = msg + ( t % (fname,e[0].get_id(),_(e[1].get_name()))) diff --git a/src/EditSource.py b/src/EditSource.py index 67af073d0..6a2a13c8c 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -198,7 +198,7 @@ class EditSource: p_list.append(name) for key in self.db.get_person_keys(): p = self.db.get_person(key) - name = GrampsCfg.nameof(p) + name = GrampsCfg.get_nameof()(p) for event_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: if event_id: event = self.db.find_event_from_id(event_id) @@ -233,12 +233,12 @@ class EditSource: m = self.db.try_to_find_person_from_id(m_id) if f_id and m_id: name = _("%(father)s and %(mother)s") % { - "father" : GrampsCfg.nameof(f), - "mother" : GrampsCfg.nameof(m)} + "father" : GrampsCfg.get_nameof()(f), + "mother" : GrampsCfg.get_nameof()(m)} elif f_id: - name = GrampsCfg.nameof(f) + name = GrampsCfg.get_nameof()(f) else: - name = GrampsCfg.nameof(m) + name = GrampsCfg.get_nameof()(m) for v_id in p.get_event_list(): v = self.db.find_event_from_id(v_id) if not v: diff --git a/src/EventEdit.py b/src/EventEdit.py index f8e801430..5f8a3452a 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -141,7 +141,7 @@ class EventEditor: self.gallery_label = self.top.get_widget("galleryEvent") self.witnesses_label = self.top.get_widget("witnessesEvent") - if GrampsCfg.calendar: + if GrampsCfg.get_calendar(): self.calendar.show() else: self.calendar.hide() diff --git a/src/FamilyView.py b/src/FamilyView.py index 6859ca755..0a4266483 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -153,7 +153,7 @@ class FamilyView: self.parent.views.get_nth_page(2).hide() def init_interface(self): - fv = GrampsCfg.familyview + fv = GrampsCfg.get_family_view() self.set_widgets(fv) already_init = self.cadded[fv] @@ -665,7 +665,7 @@ class FamilyView: return person = RelLib.Person() - autoname = GrampsCfg.lastnamegen + autoname = GrampsCfg.get_lastnamegen() if autoname == 0: name = self.north_american(0) @@ -762,8 +762,8 @@ class FamilyView: def remove_spouse(self,obj): if self.selected_spouse: - nap = GrampsCfg.nameof(self.person) - nsp = GrampsCfg.nameof(self.selected_spouse) + nap = GrampsCfg.get_nameof()(self.person) + nsp = GrampsCfg.get_nameof()(self.selected_spouse) QuestionDialog(_('Remove %s as a spouse of %s?') % (nsp,nap), _('Removing a spouse removes the relationship between ' 'the spouse and the active person. It does not ' @@ -868,20 +868,20 @@ class FamilyView: dd = self.parent.db.find_event_from_id(self.person.get_death_id()) if bd and dd: - n = "%s [%s]\n\t%s %s\n\t%s %s " % (GrampsCfg.nameof(self.person), + n = "%s [%s]\n\t%s %s\n\t%s %s " % (GrampsCfg.get_nameof()(self.person), self.person.get_gramps_id(), _BORN,bd.get_date(), _DIED,dd.get_date()) elif bd: - n = "%s [%s]\n\t%s %s" % (GrampsCfg.nameof(self.person), + n = "%s [%s]\n\t%s %s" % (GrampsCfg.get_nameof()(self.person), self.person.get_gramps_id(), _BORN,bd.get_date()) elif dd: - n = "%s [%s]\n\t%s %s" % (GrampsCfg.nameof(self.person), + n = "%s [%s]\n\t%s %s" % (GrampsCfg.get_nameof()(self.person), self.person.get_gramps_id(), _DIED,dd.get_date()) else: - n = "%s [%s]" % (GrampsCfg.nameof(self.person), + n = "%s [%s]" % (GrampsCfg.get_nameof()(self.person), self.person.get_gramps_id()) self.ap_model.clear() @@ -923,7 +923,7 @@ class FamilyView: mdate = " - %s" % event.get_date() else: mdate = "" - v = "%s [%s]\n\t%s%s" % (GrampsCfg.nameof(sp), + v = "%s [%s]\n\t%s%s" % (GrampsCfg.get_nameof()(sp), sp.get_gramps_id(), const.display_frel(fm.get_relationship()), mdate) @@ -982,7 +982,7 @@ class FamilyView: def nameof(self,l,p,mode): if p: - n = GrampsCfg.nameof(p) + n = GrampsCfg.get_nameof()(p) pid = p.get_gramps_id() return _("%s: %s [%s]\n\tRelationship: %s") % (l,n,pid,_(mode)) else: @@ -1189,7 +1189,7 @@ class FamilyView: def del_parents_clicked(self,obj): if len(self.person.get_parent_family_id_list()) == 0: return - n = GrampsCfg.nameof(self.person) + n = GrampsCfg.get_nameof()(self.person) QuestionDialog(_('Remove Parents of %s') % n, _('Removing the parents of a person removes the person as a ' 'child of the parents. The parents are not removed from the ' @@ -1204,7 +1204,7 @@ class FamilyView: def del_sp_parents(self,obj): if not self.selected_spouse or len(self.selected_spouse.get_parent_family_id_list()) == 0: return - n = GrampsCfg.nameof(self.selected_spouse) + n = GrampsCfg.get_nameof()(self.selected_spouse) QuestionDialog(_('Remove Parents of %s') % n, _('Removing the parents of a person removes the person as a ' 'child of the parents. The parents are not removed from the ' diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 38367bb67..2bc04fbc7 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -20,7 +20,6 @@ # $Id$ - #------------------------------------------------------------------------- # # Standard python modules @@ -28,10 +27,7 @@ #------------------------------------------------------------------------- import os import string - -import PaperMenu -import Plugins -import Calendar +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -59,15 +55,24 @@ except ImportError: # #------------------------------------------------------------------------- import RelLib - import const import Utils - -from gettext import gettext as _ +import PaperMenu +import Plugins +import Calendar client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- +INDEX = "i" +OBJECT = "o" +DATA = "d" + _surname_styles = [ _("Father's surname"), _("None"), @@ -119,59 +124,146 @@ panellist = [ ( _("Data Guessing"), 9)]), ] - #------------------------------------------------------------------------- # -# Visible globals +# Obtain values from gconf keys # #------------------------------------------------------------------------- -iprefix = "I%04d" -oprefix = "O%04d" -sprefix = "S%04d" -pprefix = "P%04d" -fprefix = "F%04d" -autoload = 0 -uselds = 0 -lastfile = None -nameof = Utils.normal_name -display_name = Utils.normal_name -display_surname = lambda x : x.get_surname() -status_bar = 1 -toolbar = gtk.TOOLBAR_BOTH -save_toolbar = gtk.TOOLBAR_BOTH -calendar = 0 -paper_preference = "" -output_preference = "" -goutput_preference = "" -lastnamegen = None -report_dir = "./" -web_dir = "./" -id_edit = 0 -index_visible = 0 -mediaref = 1 -globalprop = 1 -localprop = 1 -defaultview = 0 -familyview = 0 -usetips = 1 +def get_usetips(): + return client.get_bool("/apps/gramps/use-tips") -#------------------------------------------------------------------------- -# -# Globals -# -#------------------------------------------------------------------------- -_name_format = 0 -_callback = None +def get_betawarn(): + return client.get_bool("/apps/gramps/betawarn") -#------------------------------------------------------------------------- -# -# Constants -# -#------------------------------------------------------------------------- -INDEX = "i" -OBJECT = "o" -DATA = "d" +def get_iprefix(): + return client.get_string("/apps/gramps/iprefix") + +def get_oprefix(): + return client.get_string("/apps/gramps/oprefix") + +def get_sprefix(): + return client.get_string("/apps/gramps/sprefix") + +def get_pprefix(): + return client.get_string("/apps/gramps/pprefix") + +def get_fprefix(): + return client.get_string("/apps/gramps/fprefix") + +def get_autoload(): + return client.get_bool("/apps/gramps/autoload") + +def get_uselds(): + return client.get_bool("/apps/gramps/use-lds") + +def get_lastfile(): + return client.get_string("/apps/gramps/recent-file") + +def get_statusbar(): + return client.get_int("/apps/gramps/statusbar") + +def get_toolbar(): + save_toolbar = client.get_int("/apps/gramps/toolbar") + gnome_toolbar_str = client.get_string("/desktop/gnome/interface/toolbar_style") + try: + gnome_toolbar = eval("gtk.TOOLBAR_%s" % + gnome_toolbar_str.replace('-','_').upper()) + except: + gnome_toolbar = 2 + if save_toolbar == 5: + return gnome_toolbar + else: + return save_toolbar + +def get_calendar(): + return client.get_bool("/apps/gramps/show-calendar") + +def get_paper_preference(): + return client.get_string("/apps/gramps/paper-preference") + +def get_output_preference(): + return client.get_string("/apps/gramps/output-preference") + +def get_goutput_preference(): + return client.get_string("/apps/gramps/goutput-preference") + +def get_lastnamegen(): + return client.get_int("/apps/gramps/surname-guessing") + +def get_report_dir(): + report_dir = client.get_string("/apps/gramps/report-directory") + return os.path.normpath(report_dir) + os.sep + +def get_web_dir(): + web_dir = client.get_string("/apps/gramps/website-directory") + return os.path.normpath(web_dir) + os.sep + +def get_id_edit(): + return client.get_bool("/apps/gramps/id-edit") + +def get_index_visible(): + return client.get_bool("/apps/gramps/index-visible") + +def get_media_reference(): + return client.get_bool("/apps/gramps/make-reference") + +def get_media_global(): + return client.get_bool("/apps/gramps/media-global") + +def get_media_local(): + return client.get_bool("/apps/gramps/media-local") + +def get_default_view(): + return client.get_int("/apps/gramps/defaultview") + +def get_family_view(): + return client.get_int("/apps/gramps/familyview") + +def get_use_tips(): + return client.get_bool("/apps/gramps/use-tips") + +def get_date_entry(): + return client.get_int("/apps/gramps/date-entry") + +def get_date_format(): + return client.get_int("/apps/gramps/date-format") + +def get_name_format(): + return client.get_int("/apps/gramps/name-format") + +def get_researcher_name(): + return client.get_string("/apps/gramps/researcher-name") + +def get_researcher_addr(): + return client.get_string("/apps/gramps/researcher-addr") + +def get_researcher_city(): + return client.get_string("/apps/gramps/researcher-city") + +def get_researcher_state(): + return client.get_string("/apps/gramps/researcher-state") + +def get_researcher_country(): + return client.get_string("/apps/gramps/researcher-country") + +def get_researcher_postal(): + return client.get_string("/apps/gramps/researcher-postal") + +def get_researcher_phone(): + return client.get_string("/apps/gramps/researcher-phone") + +def get_researcher_email(): + return client.get_string("/apps/gramps/researcher-email") + +def get_nameof(): + return _name_format_list[get_name_format()][1] + +def get_display_name(): + return _name_format_list[get_name_format()][2] + +def get_display_surname(): + return _name_format_list[get_name_format()][3] #------------------------------------------------------------------------- # @@ -189,156 +281,16 @@ def make_path(path): # # #------------------------------------------------------------------------- -def loadConfig(call): - global autoload - global uselds - global calendar - global iprefix - global fprefix - global pprefix - global oprefix - global sprefix - global id_edit - global index_visible - global lastfile - global nameof - global display_name - global display_surname - global _name_format - global _callback - global paper_preference - global output_preference - global goutput_preference - global lastnamegen - global report_dir - global web_dir - global status_bar - global toolbar - global save_toolbar - global mediaref - global globalprop - global localprop - global defaultview - global familyview - global usetips - - _callback = call - lastfile = get_string("/apps/gramps/recent-file") - uselds = get_bool("/apps/gramps/use-lds") - mediaref = get_bool("/apps/gramps/make-reference",1) - globalprop = get_bool("/apps/gramps/media-global",1) - localprop = get_bool("/apps/gramps/media-local",1) - calendar = get_bool("/apps/gramps/show-calendar") - id_edit = get_bool("/apps/gramps/id-edit") - index_visible = get_bool("/apps/gramps/index-visible") - usetips = get_bool("/apps/gramps/use-tips",1) - familyview = get_int("/apps/gramps/familyview") - status_bar = get_int("/apps/gramps/statusbar") - gnome_toolbar_str = get_string("/desktop/gnome/interface/toolbar_style","BOTH") - - try: - gnome_toolbar = eval("gtk.TOOLBAR_%s" % - gnome_toolbar_str.replace('-','_').upper()) - except: - gnome_toolbar = 2 - - save_toolbar = get_int("/apps/gramps/toolbar",5) - if save_toolbar == 5: - toolbar = gnome_toolbar - else: - toolbar = save_toolbar - defaultview = get_int("/apps/gramps/defaultview") - - autoload = get_bool("/apps/gramps/autoload",0) - dateFormat = get_int("/apps/gramps/date-format") - dateEntry = get_int("/apps/gramps/date-entry") - paper_preference = get_string("/apps/gramps/paper-preference") - output_preference = get_string("/apps/gramps/output-preference") - goutput_preference = get_string("/apps/gramps/goutput-preference") - lastnamegen = get_int("/apps/gramps/surname-guessing") - _name_format = get_int("/apps/gramps/nameFormat") - - iprefix = get_string("/apps/gramps/iprefix") - fprefix = get_string("/apps/gramps/fprefix") - sprefix = get_string("/apps/gramps/sprefix") - oprefix = get_string("/apps/gramps/oprefix") - pprefix = get_string("/apps/gramps/pprefix") - - report_dir = get_string("/apps/gramps/report-directory") - web_dir = get_string("/apps/gramps/website-directory") - - if report_dir == None: - report_dir = "./" - else: - report_dir = os.path.normpath(report_dir) + os.sep - - if web_dir == None: - web_dir = "./" - else: - web_dir = os.path.normpath(web_dir) + os.sep - - if paper_preference == None: - paper_preference = "Letter" - - if output_preference == None: - output_preference = "" - - if goutput_preference == None: - goutput_preference = "" - - if iprefix == None: - iprefix = "I" - if fprefix == None: - fprefix = "F" - if sprefix == None: - sprefix = "S" - if pprefix == None: - pprefix = "P" - if oprefix == None: - oprefix = "O" - - Calendar.set_format_code(dateFormat) - Calendar.Calendar.ENTRYCODE = dateEntry - - nameof = _name_format_list[_name_format][1] - display_name = _name_format_list[_name_format][2] - display_surname = _name_format_list[_name_format][3] - +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(os.path.expanduser("~/.gramps")) make_path(os.path.expanduser("~/.gramps/filters")) make_path(os.path.expanduser("~/.gramps/plugins")) make_path(os.path.expanduser("~/.gramps/templates")) - -def get_string(value,defval=""): - v = client.get_string(value) - if client.get(value): - return v - else: - return defval - -def get_bool(key,defval=0): - v = client.get_bool(key) - if client.get(key): - return v - else: - return defval - -def get_int(key,defval=0): - v = client.get_int(key) - if client.get(key): - return v - else: - return defval - -def set_int(key,value): - client.set_int(key,value) - -def set_bool(key,value): - client.set_bool(key,value) - -def set_string(key,value): - client.set_string(key,value) - + def sync(): client.suggest_sync() @@ -348,7 +300,7 @@ def sync(): # #------------------------------------------------------------------------- def save_last_file(file): - set_string("/apps/gramps/recent-file",file) + client.set_string("/apps/gramps/recent-file",file) sync() #------------------------------------------------------------------------- @@ -357,40 +309,26 @@ def save_last_file(file): # #------------------------------------------------------------------------- def get_researcher(): - n = get_string("/apps/gramps/researcher-name") - a = get_string("/apps/gramps/researcher-addr") - c = get_string("/apps/gramps/researcher-city") - s = get_string("/apps/gramps/researcher-state") - ct = get_string("/apps/gramps/researcher-country") - p = get_string("/apps/gramps/researcher-postal") - ph = get_string("/apps/gramps/researcher-phone") - e = get_string("/apps/gramps/researcher-email") + n = get_researcher_name() + a = get_researcher_addr() + c = get_researcher_city() + s = get_researcher_state() + ct = get_researcher_country() + p = get_researcher_postal() + ph = get_researcher_phone() + e = get_researcher_email() owner = RelLib.Researcher() owner.set(n,a,c,s,ct,p,ph,e) return owner -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- - -def get_config_text(panel,key): - val = get_string("/apps/gramps/%s/%s" % (panel,key)) - if val: - return val - else: - return "" - -def get_config_bool(panel,key): - return get_bool("/apps/gramps/%s/%s" % (panel,key)) - -def get_config_int(panel,key): - return get_int("/apps/gramps/%s/%s" % (panel,key)) - ext_items = [] +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- class ConfigWidget: def __init__(self,panel,key,label,default): self.p = panel @@ -420,7 +358,7 @@ class ConfigEntry(ConfigWidget): def set(self): val = unicode(self.w.get_text()) - set_string(self.tag,val) + client.set_string(self.tag,val) class ConfigInt(ConfigWidget): @@ -447,7 +385,7 @@ class ConfigInt(ConfigWidget): def set(self): val = self.w.get_value_as_int() - set_int(self.tag,val) + client.set_int(self.tag,val) class ConfigCheckbox(ConfigWidget): @@ -463,7 +401,7 @@ class ConfigCheckbox(ConfigWidget): def set(self): val = self.w.get_active() - set_bool(self.tag,val) + client.set_bool(self.tag,val) class ConfigFile(ConfigWidget): @@ -483,7 +421,7 @@ class ConfigFile(ConfigWidget): def set(self): val = self.w.get_full_path(0) - set_string(self.tag,val) + client.set_string(self.tag,val) def add_text(category,panel,frame,config_tag,label,default): @@ -563,50 +501,50 @@ class GrampsPreferences: dl = self.top.get_widget("localprop") cal = self.top.get_widget("calendar") - auto.set_active(autoload) - lds.set_active(uselds) - if mediaref: + auto.set_active(get_autoload()) + lds.set_active(get_uselds()) + if get_media_reference(): mr.set_active(1) else: mc.set_active(1) - dg.set_active(globalprop) - dl.set_active(localprop) - cal.set_active(calendar) - idedit.set_active(id_edit) + dg.set_active(get_media_global()) + dl.set_active(get_media_local()) + cal.set_active(get_calendar()) + idedit.set_active(get_id_edit()) # cap.set_active(capitalize) - index_vis.set_active(index_visible) + index_vis.set_active(get_index_visible()) - self.top.get_widget("iprefix").set_text(iprefix) - self.top.get_widget("oprefix").set_text(oprefix) - self.top.get_widget("fprefix").set_text(fprefix) - self.top.get_widget("sprefix").set_text(sprefix) - self.top.get_widget("pprefix").set_text(pprefix) + self.top.get_widget("iprefix").set_text(get_iprefix()) + self.top.get_widget("oprefix").set_text(get_oprefix()) + self.top.get_widget("fprefix").set_text(get_fprefix()) + self.top.get_widget("sprefix").set_text(get_sprefix()) + self.top.get_widget("pprefix").set_text(get_pprefix()) - if status_bar == 0 or status_bar == 1: + if get_statusbar() == 0 or get_statusbar() == 1: self.top.get_widget("stat2").set_active(1) else: self.top.get_widget("stat3").set_active(1) - self.top.get_widget("tooloptmenu").set_history(save_toolbar) + self.top.get_widget("tooloptmenu").set_history(get_toolbar()) - if defaultview == 0: + if get_default_view() == 0: self.top.get_widget('pvbutton').set_active(1) else: self.top.get_widget('fvbutton').set_active(1) - if familyview == 0: + if get_family_view() == 0: self.top.get_widget('familyview1').set_active(1) else: self.top.get_widget('familyview2').set_active(1) - self.top.get_widget('usetips').set_active(usetips) + self.top.get_widget('usetips').set_active(get_usetips()) paper_obj = self.top.get_widget("paper_size") menu = gtk.Menu() choice = 0 for index in range(0,len(PaperMenu.paper_sizes)): name = PaperMenu.paper_sizes[index].get_name() - if name == paper_preference: + if name == get_paper_preference(): choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) @@ -626,14 +564,14 @@ class GrampsPreferences: item.connect("activate", self.on_format_toggled) item.show() menu.append(item) - menu.set_active(lastnamegen) + menu.set_active(get_lastnamegen()) lastnamegen_obj.set_menu(menu) self.osubmenu = gtk.Menu() choice = 0 index = 0 for name in [ _("No default format") ] + Plugins.get_text_doc_list(): - if name == output_preference: + if name == get_output_preference(): choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) @@ -648,7 +586,7 @@ class GrampsPreferences: choice = 0 index = 0 for name in [ _("No default format") ] + Plugins.get_draw_doc_list(): - if name == goutput_preference: + if name == get_goutput_preference(): choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) @@ -690,29 +628,20 @@ class GrampsPreferences: item.connect("activate", self.on_format_toggled) item.show() name_menu.append(item) - name_menu.set_active(_name_format) + name_menu.set_active(get_name_format()) name_option.set_menu(name_menu) - cname = get_string("/apps/gramps/researcher-name") - caddr = get_string("/apps/gramps/researcher-addr") - ccity = get_string("/apps/gramps/researcher-city") - cstate = get_string("/apps/gramps/researcher-state") - ccountry = get_string("/apps/gramps/researcher-country") - cpostal = get_string("/apps/gramps/researcher-postal") - cphone = get_string("/apps/gramps/researcher-phone") - cemail = get_string("/apps/gramps/researcher-email") + self.top.get_widget("resname").set_text(get_researcher_name()) + self.top.get_widget("resaddr").set_text(get_researcher_addr()) + self.top.get_widget("rescity").set_text(get_researcher_city()) + self.top.get_widget("resstate").set_text(get_researcher_state()) + self.top.get_widget("rescountry").set_text(get_researcher_country()) + self.top.get_widget("respostal").set_text(get_researcher_postal()) + self.top.get_widget("resphone").set_text(get_researcher_phone()) + self.top.get_widget("resemail").set_text(get_researcher_email()) - self.top.get_widget("resname").set_text(cname) - self.top.get_widget("resaddr").set_text(caddr) - self.top.get_widget("rescity").set_text(ccity) - self.top.get_widget("resstate").set_text(cstate) - self.top.get_widget("rescountry").set_text(ccountry) - self.top.get_widget("respostal").set_text(cpostal) - self.top.get_widget("resphone").set_text(cphone) - self.top.get_widget("resemail").set_text(cemail) - - self.top.get_widget("repdir").gtk_entry().set_text(report_dir) - self.top.get_widget("htmldir").gtk_entry().set_text(web_dir) + self.top.get_widget("repdir").gtk_entry().set_text(get_report_dir()) + self.top.get_widget("htmldir").gtk_entry().set_text(get_web_dir()) def build_ext(self): self.c = {} @@ -780,37 +709,8 @@ class GrampsPreferences: def on_propertybox_apply(self,obj): self.save_data() - _callback(1) def save_data(self): - global nameof - global display_name - global display_surname - global uselds - global mediaref - global globalprop - global localprop - global calendar - global iprefix - global fprefix - global pprefix - global sprefix - global oprefix - global id_edit - global index_visible - global status_bar - global toolbar - global save_toolbar - global defaultview - global familyview - global usetips - global paper_preference - global output_preference - global goutput_preference - global report_dir - global web_dir - global lastnamegen - global autoload autoload = self.top.get_widget("autoload").get_active() uselds = self.top.get_widget("uselds").get_active() @@ -832,7 +732,7 @@ class GrampsPreferences: status_bar = 2 save_toolbar = self.top.get_widget("tooloptmenu").get_history() - gnome_toolbar_str = get_string("/desktop/gnome/interface/toolbar_style",'BOTH') + gnome_toolbar_str = client.get_string("/desktop/gnome/interface/toolbar_style") try: gnome_toolbar = eval("gtk.TOOLBAR_%s" % gnome_toolbar_str.replace('-','_').upper()) @@ -876,43 +776,43 @@ class GrampsPreferences: output_preference = output_obj.get_data(DATA) goutput_preference = goutput_obj.get_data(DATA) - set_bool("/apps/gramps/use-lds",uselds) - set_bool("/apps/gramps/make-reference",mediaref) - set_bool("/apps/gramps/media-global",globalprop) - set_bool("/apps/gramps/media-local",localprop) - set_bool("/apps/gramps/show-calendar",calendar) - set_bool("/apps/gramps/id-edit",id_edit) - set_bool("/apps/gramps/index-visible",index_visible) - set_int("/apps/gramps/statusbar",status_bar) - set_int("/apps/gramps/toolbar",save_toolbar) - set_int("/apps/gramps/defaultview",defaultview) - set_int("/apps/gramps/familyview",familyview) - set_bool("/apps/gramps/use-tips",usetips) - set_string("/apps/gramps/paper-preference",paper_preference) - set_string("/apps/gramps/output-preference",output_preference) - set_string("/apps/gramps/goutput-preference",goutput_preference) - set_bool("/apps/gramps/autoload",autoload) + client.set_bool("/apps/gramps/use-lds",uselds) + client.set_bool("/apps/gramps/make-reference",mediaref) + client.set_bool("/apps/gramps/media-global",globalprop) + client.set_bool("/apps/gramps/media-local",localprop) + client.set_bool("/apps/gramps/show-calendar",calendar) + client.set_bool("/apps/gramps/id-edit",id_edit) + client.set_bool("/apps/gramps/index-visible",index_visible) + client.set_int("/apps/gramps/statusbar",status_bar) + client.set_int("/apps/gramps/toolbar",save_toolbar) + client.set_int("/apps/gramps/defaultview",defaultview) + client.set_int("/apps/gramps/familyview",familyview) + client.set_bool("/apps/gramps/use-tips",usetips) + client.set_string("/apps/gramps/paper-preference",paper_preference) + client.set_string("/apps/gramps/output-preference",output_preference) + client.set_string("/apps/gramps/goutput-preference",goutput_preference) + client.set_bool("/apps/gramps/autoload",autoload) - set_string("/apps/gramps/report-directory",report_dir) - set_string("/apps/gramps/website-directory",web_dir) - set_string("/apps/gramps/iprefix",iprefix) - set_string("/apps/gramps/fprefix",fprefix) - set_string("/apps/gramps/pprefix",pprefix) - set_string("/apps/gramps/oprefix",oprefix) - set_string("/apps/gramps/sprefix",sprefix) + client.set_string("/apps/gramps/report-directory",report_dir) + client.set_string("/apps/gramps/website-directory",web_dir) + client.set_string("/apps/gramps/iprefix",iprefix) + client.set_string("/apps/gramps/fprefix",fprefix) + client.set_string("/apps/gramps/pprefix",pprefix) + client.set_string("/apps/gramps/oprefix",oprefix) + client.set_string("/apps/gramps/sprefix",sprefix) # search for the active date format selection format_menu = self.top.get_widget("date_format").get_menu() active = format_menu.get_active().get_data(INDEX) Calendar.set_format_code(active) - set_int("/apps/gramps/date-format",active) + client.set_int("/apps/gramps/date-format",active) format_menu = self.top.get_widget("date_entry_format").get_menu() entry_active = format_menu.get_active().get_data(INDEX) Calendar.Calendar.ENTRYCODE = entry_active - set_int("/apps/gramps/date-entry",entry_active) + client.set_int("/apps/gramps/date-entry",entry_active) # get the name format @@ -922,11 +822,11 @@ class GrampsPreferences: nameof = _name_format_list[active_name][1] display_name = _name_format_list[active_name][2] display_surname = _name_format_list[active_name][3] - set_int("/apps/gramps/nameFormat",active_name) + client.set_int("/apps/gramps/nameFormat",active_name) format_menu = self.top.get_widget("lastnamegen").get_menu() lastnamegen = format_menu.get_active().get_data(DATA) - set_int("/apps/gramps/surname-guessing",lastnamegen) + client.set_int("/apps/gramps/surname-guessing",lastnamegen) name = unicode(self.top.get_widget("resname").get_text()) addr = unicode(self.top.get_widget("resaddr").get_text()) @@ -937,20 +837,14 @@ class GrampsPreferences: phone = unicode(self.top.get_widget("resphone").get_text()) email = unicode(self.top.get_widget("resemail").get_text()) - set_string("/apps/gramps/researcher-name",name) - set_string("/apps/gramps/researcher-addr",addr) - set_string("/apps/gramps/researcher-city",city) - set_string("/apps/gramps/researcher-state",state) - set_string("/apps/gramps/researcher-country",country) - set_string("/apps/gramps/researcher-postal",postal) - set_string("/apps/gramps/researcher-phone",phone) - set_string("/apps/gramps/researcher-email",email) - - self.db.set_iprefix(iprefix) - self.db.set_fprefix(fprefix) - self.db.set_sprefix(sprefix) - self.db.set_oprefix(oprefix) - self.db.set_pprefix(pprefix) + client.set_string("/apps/gramps/researcher-name",name) + client.set_string("/apps/gramps/researcher-addr",addr) + client.set_string("/apps/gramps/researcher-city",city) + client.set_string("/apps/gramps/researcher-state",state) + client.set_string("/apps/gramps/researcher-country",country) + client.set_string("/apps/gramps/researcher-postal",postal) + client.set_string("/apps/gramps/researcher-phone",phone) + client.set_string("/apps/gramps/researcher-email",email) for o in self.ext_list: o.set() @@ -983,21 +877,27 @@ _view_str = "/apps/gramps/view" _toolbar_str = "/apps/gramps/toolbar-on" def save_view(val): - set_bool(_view_str, not val) + client.set_bool(_view_str, not val) sync() def get_view(): return not client.get_bool(_view_str) def save_filter(val): - set_bool("/apps/gramps/filter",val) + client.set_bool("/apps/gramps/filter",val) def get_filter(): - return get_bool("/apps/gramps/filter") + return client.get_bool("/apps/gramps/filter") def save_toolbar_on(val): - set_bool(_toolbar_str, not val) + client.set_bool(_toolbar_str, not val) sync() def get_toolbar_on(): return not client.get_bool(_toolbar_str) + +def save_report_dir(val): + client.set_string("apps/gramps/report-directory",val) + +def save_web_dir(val): + client.set_string("apps/gramps/web-directory",val) diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 4845055e0..981d8e92c 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -480,11 +480,11 @@ class Gallery(ImageSelect): (root,ext) = os.path.splitext(basename) photo.set_description(root) self.savephoto(photo) - if GrampsCfg.mediaref == 0: + if GrampsCfg.get_media_reference() == 0: name = RelImage.import_media_object(name,self.path,photo.get_id()) photo.set_path(name) self.parent.lists_changed = 1 - if GrampsCfg.globalprop: + if GrampsCfg.get_media_global(): GlobalMediaProperties(self.db,photo,None, self,self.parent_window) elif protocol != "": @@ -514,7 +514,7 @@ class Gallery(ImageSelect): return self.add_thumbnail(oref) self.parent.lists_changed = 1 - if GrampsCfg.globalprop: + if GrampsCfg.get_media_global(): GlobalMediaProperties(self.db,photo,None, self,self.parent_window) else: @@ -544,7 +544,7 @@ class Gallery(ImageSelect): self.dataobj.add_media_reference(oref) self.add_thumbnail(oref) self.parent.lists_changed = 1 - if GrampsCfg.globalprop: + if GrampsCfg.get_media_global(): LocalMediaProperties(oref,self.path,self,self.parent_window) def on_photolist_drag_data_get(self,w, context, selection_data, info, time): @@ -1068,7 +1068,7 @@ class GlobalMediaProperties: p = self.db.get_person(key) for o in p.get_media_list(): if o.get_reference_id() == self.object.get_id(): - self.refmodel.add([_("Person"),p.get_id(),GrampsCfg.nameof(p)]) + self.refmodel.add([_("Person"),p.get_id(),GrampsCfg.get_nameof()(p)]) any = 1 for key in self.db.get_family_keys(): p = self.db.find_family_from_id(key) diff --git a/src/Marriage.py b/src/Marriage.py index cae8c5cac..4e363433e 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -141,8 +141,8 @@ class Marriage: else: mother = None - self.title = _("%s and %s") % (GrampsCfg.nameof(father), - GrampsCfg.nameof(mother)) + self.title = _("%s and %s") % (GrampsCfg.get_nameof()(father), + GrampsCfg.get_nameof()(mother)) Utils.set_title_label(self.top,self.title) @@ -202,7 +202,7 @@ class Marriage: frel = const.display_frel(family.get_relationship()) self.type_field.entry.set_text(frel) self.gid.set_text(family.get_id()) - self.gid.set_editable(GrampsCfg.id_edit) + self.gid.set_editable(GrampsCfg.get_id_edit()) self.lds_temple.set_popdown_strings(_temple_names) diff --git a/src/MediaView.py b/src/MediaView.py index 898899202..a2e26f890 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -379,7 +379,7 @@ class MediaView: trans = self.db.start_transaction() self.db.add_object(photo,trans) self.load_media() - if GrampsCfg.mediaref == 0: + if GrampsCfg.get_media_reference() == 0: name = RelImage.import_media_object(name, self.db.get_save_path(), photo.get_id()) @@ -389,7 +389,7 @@ class MediaView: self.db.commit_media_object(photo,trans) self.db.add_transaction(trans,_("Add Media Object")) - if GrampsCfg.globalprop: + if GrampsCfg.get_media_global(): ImageSelect.GlobalMediaProperties(self.db,photo,self.load_media, self,self.topWindow) elif protocol != "": @@ -422,7 +422,7 @@ class MediaView: self.db.commit_media_object(photo,trans) self.db.add_transaction(trans,_("Add Media Object")) - if GrampsCfg.globalprop: + if GrampsCfg.get_media_global(): ImageSelect.GlobalMediaProperties(self.db,photo,None, self,self.topWindow) diff --git a/src/MergeData.py b/src/MergeData.py index b994c675a..054b018c0 100644 --- a/src/MergeData.py +++ b/src/MergeData.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 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 @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + #------------------------------------------------------------------------- # # Standard python modules @@ -75,8 +77,8 @@ class MergePeople: "destroy_passed_object" : Utils.destroy_passed_object, }) - fname = GrampsCfg.nameof(person1) - mname = GrampsCfg.nameof(person2) + fname = GrampsCfg.get_nameof()(person1) + mname = GrampsCfg.get_nameof()(person2) Utils.set_titles(self.top, self.glade.get_widget('title'), _("Merge %s and %s") % (fname,mname), @@ -85,13 +87,13 @@ class MergePeople: f1 = person1.get_main_parents_family_id() f2 = person2.get_main_parents_family_id() - name1 = GrampsCfg.nameof(person1) + name1 = GrampsCfg.get_nameof()(person1) death1 = person1.get_death().get_date() dplace1 = self.place_name(person1.get_death()) birth1 = person1.get_birth().get_date() bplace1 = self.place_name(person1.get_birth()) - name2 = GrampsCfg.nameof(person2) + name2 = GrampsCfg.get_nameof()(person2) death2 = person2.get_death().get_date() dplace2 = self.place_name(person2.get_death()) birth2 = person2.get_birth().get_date() @@ -191,7 +193,7 @@ class MergePeople: if spouse == None: name = "unknown" else: - sname = GrampsCfg.nameof(spouse) + sname = GrampsCfg.get_nameof()(spouse) name = "%s [%s]" % (sname,spouse.get_id()) widget.add([name]) @@ -347,7 +349,7 @@ class MergePeople: self.db.remove_person_id(self.p2.get_id()) self.db.personMap[self.p1.get_id()] = self.p1 except: - print "%s is not in the person map!" % (GrampsCfg.nameof(self.p2)) + print "%s is not in the person map!" % (GrampsCfg.get_nameof()(self.p2)) self.update(self.p1,self.p2,old_id) Utils.destroy_passed_object(self.top) @@ -579,8 +581,8 @@ def compare_people(p1,p2): if father1 == father2: chance = chance + 1.0 else: - fname1 = GrampsCfg.nameof(father1) - fname2 = GrampsCfg.nameof(father2) + fname1 = GrampsCfg.get_nameof()(father1) + fname2 = GrampsCfg.get_nameof()(father2) value = name_match(fname1,fname2) if value != -1.0: chance = chance + value @@ -591,8 +593,8 @@ def compare_people(p1,p2): if mother1 == mother2: chance = chance + 1.0 else: - mname1 = GrampsCfg.nameof(mother1) - mname2 = GrampsCfg.nameof(mother2) + mname1 = GrampsCfg.get_nameof()(mother1) + mname2 = GrampsCfg.get_nameof()(mother2) value = name_match(mname1,mname2) if value != -1.0: chance = chance + value @@ -799,7 +801,7 @@ def ancestors_of(p1,list): def name_of(p): if not p: return "" - return "%s (%s)" % (GrampsCfg.nameof(p),p.get_id()) + return "%s (%s)" % (GrampsCfg.get_nameof()(p),p.get_id()) #------------------------------------------------------------------------- # diff --git a/src/PedView.py b/src/PedView.py index ba2081d33..553df3bf7 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -70,7 +70,7 @@ class DispBox: self.person = person self.root = root - self.name = GrampsCfg.nameof(person) + self.name = GrampsCfg.get_nameof()(person) birth_id = self.person.get_birth_id() death_id = self.person.get_death_id() if birth_id: @@ -230,7 +230,7 @@ class PedigreeView: else: death = u"" - for n in [GrampsCfg.nameof(t[0]), u'%s %s' % (_BORN,birth), + for n in [GrampsCfg.get_nameof()(t[0]), u'%s %s' % (_BORN,birth), u'%s %s' % (_DIED,death)]: try: a.set_text(n,len(n)) @@ -380,7 +380,7 @@ class PedigreeView: myMenu = gtk.Menu() for child_id in childlist: child = self.parent.db.try_to_find_person_from_id(child_id) - cname = GrampsCfg.nameof(child) + cname = GrampsCfg.get_nameof()(child) menuitem = gtk.MenuItem(None) if find_children(self.parent.db,child): label = gtk.Label('%s' % cname) @@ -472,7 +472,7 @@ class PedigreeView: elif event.type == gtk.gdk.ENTER_NOTIFY: obj.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED], width_pixels=4) - name = GrampsCfg.nameof(person) + name = GrampsCfg.get_nameof()(person) msg = _("Double clicking will make %s the active person") % name self.sb.set_status(msg) elif event.type == gtk.gdk.LEAVE_NOTIFY: @@ -587,7 +587,7 @@ class PedigreeView: item.set_submenu(gtk.Menu()) sp_menu = item.get_submenu() - sp_item = gtk.MenuItem(GrampsCfg.nameof(spouse)) + sp_item = gtk.MenuItem(GrampsCfg.get_nameof()(spouse)) sp_item.set_data(_PERSON,sp_id) sp_item.connect("activate",self.on_childmenu_changed) sp_item.show() @@ -618,7 +618,7 @@ class PedigreeView: item.set_submenu(gtk.Menu()) sib_menu = item.get_submenu() - sib_item = gtk.MenuItem(GrampsCfg.nameof(sib)) + sib_item = gtk.MenuItem(GrampsCfg.get_nameof()(sib)) sib_item.set_data(_PERSON,sib_id) sib_item.connect("activate",self.on_childmenu_changed) sib_item.show() @@ -644,9 +644,9 @@ class PedigreeView: child_menu = item.get_submenu() if find_children(self.parent.db,child): - label = gtk.Label('%s' % GrampsCfg.nameof(child)) + label = gtk.Label('%s' % GrampsCfg.get_nameof()(child)) else: - label = gtk.Label(GrampsCfg.nameof(child)) + label = gtk.Label(GrampsCfg.get_nameof()(child)) child_item = gtk.MenuItem(None) label.set_use_markup(gtk.TRUE) @@ -678,9 +678,9 @@ class PedigreeView: par_menu = item.get_submenu() if find_parents(self.parent.db,par): - label = gtk.Label('%s' % GrampsCfg.nameof(par)) + label = gtk.Label('%s' % GrampsCfg.get_nameof()(par)) else: - label = gtk.Label(GrampsCfg.nameof(par)) + label = gtk.Label(GrampsCfg.get_nameof()(par)) par_item = gtk.MenuItem(None) label.set_use_markup(gtk.TRUE) diff --git a/src/Plugins.py b/src/Plugins.py index 10f446872..00ac13f1a 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -665,7 +665,7 @@ def get_text_doc_menu(main_menu,tables,callback,obj=None): menuitem.connect("activate",callback) menuitem.show() myMenu.append(menuitem) - if name == GrampsCfg.output_preference: + if name == GrampsCfg.get_output_preference(): myMenu.set_active(index) callback(menuitem) index = index + 1 @@ -695,7 +695,7 @@ def get_book_menu(main_menu,tables,callback,obj=None): menuitem.connect("activate",callback) menuitem.show() myMenu.append(menuitem) - if name == GrampsCfg.output_preference: + if name == GrampsCfg.get_output_preference(): myMenu.set_active(index) callback(menuitem) index = index + 1 @@ -759,7 +759,7 @@ def get_draw_doc_menu(main_menu,callback=None,obj=None): menuitem.connect("activate",callback) menuitem.show() myMenu.append(menuitem) - if name == GrampsCfg.goutput_preference: + if name == GrampsCfg.get_goutput_preference(): myMenu.set_active(index) if callback: callback(menuitem) diff --git a/src/RelLib.py b/src/RelLib.py index add2a712e..c313f2375 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -1215,14 +1215,14 @@ class Person(SourceNote): gender = const.unknown bday = self.birth_id dday = self.death_id - return [ GrampsCfg.display_name(self), + return [ GrampsCfg.get_display_name()(self), self.gid, gender, bday, dday, self.get_primary_name().get_sort_name(), bday, dday, - GrampsCfg.display_surname(self.primary_name)] + GrampsCfg.get_display_surname()(self.primary_name)] def set_primary_name(self,name): """sets the primary name of the Person to the specified @@ -2576,7 +2576,7 @@ class GrampsDB: data[3].get_sort_name(), data[7], data[6], - GrampsCfg.display_surname(data[3])] + GrampsCfg.get_display_surname()(data[3])] def commit_person(self,person,transaction): gid = str(person.get_id()) diff --git a/src/SelectChild.py b/src/SelectChild.py index 5f1c98950..1e1d8ac0b 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -45,7 +45,6 @@ import RelLib import const import Utils import PeopleModel -import GrampsCfg from RelLib import Person from QuestionDialog import ErrorDialog diff --git a/src/SelectObject.py b/src/SelectObject.py index da1ba48fd..f90f9038f 100644 --- a/src/SelectObject.py +++ b/src/SelectObject.py @@ -59,7 +59,6 @@ import RelLib import const import Utils import ListModel -import GrampsCfg #------------------------------------------------------------------------- # diff --git a/src/StartupDialog.py b/src/StartupDialog.py index a2aec045e..61dfd0533 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 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 @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + import const import gtk.glade import gnome @@ -37,8 +39,6 @@ def need_to_run(): client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) val = client.get_int(_StartupEntry) - if val == None: - return 1 if val < const.startup: return 1 return 0 @@ -124,14 +124,14 @@ class StartupDialog: self.client.set_string('/apps/gramps/researcher-email',unicode(self.email.get_text())) if self.date1.get_active(): - self.client.set_int("/apps/gramps/dateEntry",0) + self.client.set_int("/apps/gramps/date-entry",0) elif self.date2.get_active(): - self.client.set_int("/apps/gramps/dateEntry",1) + self.client.set_int("/apps/gramps/date-entry",1) elif self.date3.get_active(): - self.client.set_int("/apps/gramps/dateEntry",2) + self.client.set_int("/apps/gramps/date-entry",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_bool("/apps/gramps/show-calendar",self.calendar.get_active()) + self.client.set_bool("/apps/gramps/use-lds",self.lds.get_active()) self.client.set_int(_StartupEntry,const.startup) self.w.destroy() self.task(self.args) @@ -217,9 +217,7 @@ class StartupDialog: self.date2 = gtk.RadioButton(label=_("DD/MM/YYYY (European)"),group=self.date1) self.date3 = gtk.RadioButton(label=_("YYYY-MM-DD (ISO)"),group=self.date1) - val = self.client.get_int("/apps/gramps/dateEntry") - if val == None: - val = 0 + val = self.client.get_int("/apps/gramps/date-entry") if val == 0: self.date1.set_active(1) @@ -259,10 +257,7 @@ class StartupDialog: self.calendar = gtk.CheckButton(label=_("Enable support for alternate calendars")) - if self.client.get_int("/apps/gramps/ShowCalendar"): - self.calendar.set_active(1) - else: - self.calendar.set_active(0) + self.calendar.set_active(self.client.get_bool("/apps/gramps/show-calendar")) align.add(self.calendar) @@ -293,10 +288,7 @@ class StartupDialog: self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support")) - if self.client.get_int("/apps/gramps/UseLDS"): - self.lds.set_active(1) - else: - self.lds.set_active(0) + self.lds.set_active(self.client.get_bool("/apps/gramps/use-lds")) align.add(self.lds) diff --git a/src/TipOfDay.py b/src/TipOfDay.py index db70fa857..96420861f 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -34,7 +34,7 @@ class TipOfDay: tp = TipParser() tip_list = tp.get() - use.set_active(GrampsCfg.usetips) + use.set_active(GrampsCfg.get_usetips()) index = 0 rval = 0 @@ -46,7 +46,7 @@ class TipOfDay: else: index += 1 - GrampsCfg.set_bool("/apps/gramps/use-tips",use.get_active()) + GrampsCfg.client.set_bool("/apps/gramps/use-tips",use.get_active()) top.destroy() class TipParser: diff --git a/src/WriteXML.py b/src/WriteXML.py index 27cf71189..a4d26f557 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -49,7 +49,6 @@ import gtk # #------------------------------------------------------------------------- import const -import GrampsCfg import Calendar import Gregorian import RelLib diff --git a/src/data/Makefile.am b/src/data/Makefile.am index 5f6cf44c8..4f47929a1 100644 --- a/src/data/Makefile.am +++ b/src/data/Makefile.am @@ -17,8 +17,9 @@ dist_pkgdata_DATA = gedcom.xml \ EXTRA_DIST = $(dist_pkgdata_DATA) install-schemas: + $(INSTALL_DATA) gramps.schemas $(DESTDIR)/etc/gconf/schemas GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ - gconftool --makefile-install-rule gramps.schemas + gconftool --makefile-install-rule gramps.schemas install-data-local: install-schemas $(INSTALL) -d $(DESTDIR)$(prefix)/share/gnome/apps/Applications @@ -39,3 +40,6 @@ uninstall-local: -rm $(DESTDIR)$(prefix)/share/mime-info/gramps.keys -rm $(DESTDIR)$(prefix)/share/mime-info/gramps.mime -rm $(DESTDIR)$(prefix)/share/mime/packages/gramps.xml + -rm $(DESTDIR)/etc/gconf/schemas/gramps.schemas + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ + gconftool --makefile-uninstall-rule gramps.schemas diff --git a/src/data/gramps.schemas b/src/data/gramps.schemas index a5336fe50..602ab6b87 100644 --- a/src/data/gramps.schemas +++ b/src/data/gramps.schemas @@ -220,7 +220,7 @@ /apps/gramps/last-file gramps string - "" + Last XML database GRAMPS has worked with Full pathname of the last XML database GRAMPS has worked with. @@ -232,7 +232,7 @@ /apps/gramps/recent-file gramps string - "" + Last GRDB database GRAMPS has worked with Full pathname of the last GRDB database GRAMPS has worked with. @@ -300,7 +300,7 @@ /apps/gramps/report-directory gramps string - "" + ./ Default report directory Full pathname of the default report directory. @@ -312,7 +312,7 @@ /apps/gramps/researcher-addr gramps string - "" + Researcher street address Researcher stret address. @@ -324,7 +324,7 @@ /apps/gramps/researcher-city gramps string - "" + Researcher city Researcher city. @@ -336,7 +336,7 @@ /apps/gramps/researcher-country gramps string - "" + Researcher country Researcher country. @@ -348,7 +348,7 @@ /apps/gramps/researcher-email gramps string - "" + Researcher email address Researcher email address. @@ -360,7 +360,7 @@ /apps/gramps/researcher-name gramps string - "" + Researcher name Researcher name. @@ -372,7 +372,7 @@ /apps/gramps/researcher-phone gramps string - "" + Researcher phone Researcher phone. @@ -384,7 +384,7 @@ /apps/gramps/researcher-postal gramps string - "" + Researcher postal code Researcher postal code. @@ -396,7 +396,7 @@ /apps/gramps/researcher-state gramps string - "" + Researcher state Researcher state. @@ -527,7 +527,7 @@ /apps/gramps/website-directory gramps string - "" + ./ Default website directory Full pathname of the default website directory. diff --git a/src/gramps_main.py b/src/gramps_main.py index bdbdacdfc..6349f2793 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -129,21 +129,21 @@ class Gramps: self.hindex = -1 self.db = RelLib.GrampsDB() - self.db.set_iprefix(GrampsCfg.iprefix) - self.db.set_oprefix(GrampsCfg.oprefix) - self.db.set_fprefix(GrampsCfg.fprefix) - self.db.set_sprefix(GrampsCfg.sprefix) - self.db.set_pprefix(GrampsCfg.pprefix) + self.db.set_iprefix(GrampsCfg.get_iprefix()) + self.db.set_oprefix(GrampsCfg.get_oprefix()) + self.db.set_fprefix(GrampsCfg.get_fprefix()) + self.db.set_sprefix(GrampsCfg.get_sprefix()) + self.db.set_pprefix(GrampsCfg.get_pprefix()) - GrampsCfg.loadConfig(self.pref_callback) + GrampsCfg.loadConfig() - if GrampsCfg.get_bool('/apps/gramps/betawarn') == 0: + if GrampsCfg.get_betawarn() == 0: WarningDialog(_("Use at your own risk"), _("This is an unstable development version of GRAMPS. " "It is intended as a technology preview. Do not trust your " "family database to this development version. This version may " "contain bugs which could corrupt your database.")) - GrampsCfg.set_bool('/apps/gramps/betawarn',1) + GrampsCfg.client.set_bool('/apps/gramps/betawarn',1) self.RelClass = Plugins.relationship_class @@ -156,19 +156,26 @@ class Gramps: # Don't show main window until ArgHandler is done. # This prevents a window from annoyingly popping up when # the command line args are sufficient to operate without it. + GrampsCfg.client.notify_add("/apps/gramps",self.pref_callback) self.topWindow.show() - if GrampsCfg.usetips: + if GrampsCfg.get_usetips(): TipOfDay.TipOfDay() self.db.set_researcher(GrampsCfg.get_researcher()) - def pref_callback(self,val): + def pref_callback(self,client,cnxn_id,entry,data): + self.db.set_iprefix(GrampsCfg.get_iprefix()) + self.db.set_fprefix(GrampsCfg.get_fprefix()) + self.db.set_sprefix(GrampsCfg.get_sprefix()) + self.db.set_oprefix(GrampsCfg.get_oprefix()) + self.db.set_pprefix(GrampsCfg.get_pprefix()) + self.modify_statusbar() self.family_view.init_interface() self.update_display(1) self.goto_active_person() - self.toolbar.set_style(GrampsCfg.toolbar) + self.toolbar.set_style(GrampsCfg.get_toolbar()) def init_interface(self): """Initializes the GLADE interface, and gets references to the @@ -246,7 +253,7 @@ class Gramps: self.build_plugin_menus() self.init_filters() - self.toolbar.set_style(GrampsCfg.toolbar) + self.toolbar.set_style(GrampsCfg.get_toolbar()) self.views.set_show_tabs(0) self.family_view = FamilyView.FamilyView(self) @@ -350,9 +357,9 @@ class Gramps: self.find_source = None self.find_media = None - if GrampsCfg.defaultview == 0: + if GrampsCfg.get_default_view() == 0: self.views.set_current_page(PERSON_VIEW) - elif GrampsCfg.familyview == 0: + elif GrampsCfg.get_family_view() == 0: self.views.set_current_page(FAMILY_VIEW1) else: self.views.set_current_page(FAMILY_VIEW2) @@ -1212,7 +1219,7 @@ class Gramps: for sel in mlist: p = self.db.get_person(sel) self.active_person = p - name = GrampsCfg.nameof(p) + name = GrampsCfg.get_nameof()(p) QuestionDialog(_('Delete %s?') % name, _('Deleting the person will remove the person ' @@ -1328,8 +1335,8 @@ class Gramps: if self.active_person == None: self.status_text("") else: - if GrampsCfg.status_bar <= 1: - pname = GrampsCfg.nameof(self.active_person) + if GrampsCfg.get_statusbar() <= 1: + pname = GrampsCfg.get_nameof()(self.active_person) name = "[%s] %s" % (self.active_person.get_gramps_id(),pname) else: name = self.display_relationship() @@ -1341,7 +1348,7 @@ class Gramps: if not default_person: return u'' try: - pname = GrampsCfg.nameof(default_person) + pname = GrampsCfg.get_nameof()(default_person) (name,plist) = self.relationship.get_relationship( default_person, self.active_person) @@ -1379,7 +1386,7 @@ class Gramps: def on_family_activate(self,obj): """Switches to the family view""" - if GrampsCfg.familyview == 0: + if GrampsCfg.get_family_view() == 0: self.on_family1_activate(obj) else: self.on_family2_activate(obj) @@ -1501,7 +1508,7 @@ class Gramps: if person == None: return _("Unknown") else: - return GrampsCfg.nameof(person) + return GrampsCfg.get_nameof()(person) def load_progress(self,value): self.statusbar.set_progress_percentage(value) @@ -1587,7 +1594,7 @@ class Gramps: def on_add_bookmark_activate(self,obj): if self.active_person: self.bookmarks.add(self.active_person.get_id()) - name = GrampsCfg.nameof(self.active_person) + name = GrampsCfg.get_nameof()(self.active_person) self.status_text(_("%s has been bookmarked") % name) gtk.timeout_add(5000,self.modify_statusbar) else: diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index dbb058069..ff8066067 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -42,7 +42,6 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------ -import GrampsCfg import BaseDoc import Report import Errors diff --git a/src/plugins/AncestorChart2.py b/src/plugins/AncestorChart2.py index 45519cb2c..4a35b4e32 100644 --- a/src/plugins/AncestorChart2.py +++ b/src/plugins/AncestorChart2.py @@ -39,7 +39,6 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------ -import GrampsCfg import BaseDoc import Report import Errors diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index 1dc3a9f46..b2f38f7e5 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -67,7 +67,6 @@ from RelLib import Person import const import Utils import ListModel -import GrampsCfg import Plugins import Report import BaseDoc diff --git a/src/plugins/Desbrowser.py b/src/plugins/Desbrowser.py index 6cc7c28f1..95180e4d1 100644 --- a/src/plugins/Desbrowser.py +++ b/src/plugins/Desbrowser.py @@ -119,7 +119,7 @@ class DesBrowse: def add_to_tree(self,parent_id,sib_id,person_id): item_id = self.model.insert_after(parent_id,sib_id) person = self.db.try_to_find_person_from_id(person_id) - self.model.set(item_id,0,GrampsCfg.nameof(person)) + self.model.set(item_id,0,GrampsCfg.get_nameof()(person)) self.model.set(item_id,1,person_id) prev_id = None for family_id in person.get_family_id_list(): diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index 0ba117012..6aa479a9e 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -32,7 +32,6 @@ import gtk # gramps modules # #------------------------------------------------------------------------ -import GrampsCfg import BaseDoc import Report import Errors diff --git a/src/plugins/Merge.py b/src/plugins/Merge.py index 3cf47744b..9a9498f43 100644 --- a/src/plugins/Merge.py +++ b/src/plugins/Merge.py @@ -621,7 +621,7 @@ class Merge: def name_of(p): if not p: return "" - return "%s (%s)" % ( GrampsCfg.nameof(p),p.get_id()) + return "%s (%s)" % ( GrampsCfg.get_nameof()(p),p.get_id()) def get_name_obj(person): if person: diff --git a/src/plugins/RelCalc.py b/src/plugins/RelCalc.py index 0ed18e8f7..eef9562ab 100644 --- a/src/plugins/RelCalc.py +++ b/src/plugins/RelCalc.py @@ -167,8 +167,8 @@ class RelCalc: commontext = "" text1 = self.glade.get_widget("text1").get_buffer() - p1 = GrampsCfg.nameof(self.person) - p2 = GrampsCfg.nameof(other_person) + p1 = GrampsCfg.get_nameof()(self.person) + p2 = GrampsCfg.get_nameof()(other_person) if rel_string == "": rstr = _("%(person)s and %(active_person)s are not related.") % { diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index 8049fe30d..1a3144a9a 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -1233,7 +1233,7 @@ class WebReportDialog(Report.ReportDialog): """Get the name of the directory to which the target dialog box should default. This value can be set in the preferences panel.""" - return GrampsCfg.web_dir + return GrampsCfg.get_web_dir() def set_default_directory(self, value): """Save the name of the current directory, so that any future @@ -1243,7 +1243,7 @@ class WebReportDialog(Report.ReportDialog): This means that the last directory used will only be remembered for this session of gramps unless the user saves his/her preferences.""" - GrampsCfg.web_dir = value + GrampsCfg.save_web_dir(value) def make_default_style(self): """Make the default output style for the Web Pages Report."""