From 09328f505b3baca7e8e81cb11c715373479b779b Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 6 Jan 2005 17:28:31 +0000 Subject: [PATCH] * src/GrampsIniKeys.py: provide support for the default schema * src/GrampsKeys.py: select appropriate backend * various: switch from GrampsGconfKeys to GrampsKeys for normal usage * src/GrampsIniKeys.py: Alternate backend using .ini files instead of gconf svn: r3873 --- ChangeLog | 10 ++++ src/ArgHandler.py | 6 +-- src/DateHandler.py | 4 +- src/DbPrompter.py | 24 ++++----- src/EditPerson.py | 8 +-- src/Exporter.py | 8 +-- src/FamilyView.py | 6 +-- src/GrampsCfg.py | 114 ++++++++++++++++++++--------------------- src/GrampsDbBase.py | 14 ++--- src/ImageSelect.py | 10 ++-- src/Marriage.py | 4 +- src/MediaView.py | 8 +-- src/PluginMgr.py | 6 +-- src/Plugins.py | 16 +++--- src/QuestionDialog.py | 4 +- src/Report.py | 6 +-- src/ReportOptions.py | 4 +- src/StartupDialog.py | 45 ++++++++-------- src/TipOfDay.py | 6 +-- src/Utils.py | 4 +- src/const.py.in | 8 +++ src/gramps_main.py | 81 ++++++++++++++--------------- src/plugins/WebPage.py | 6 +-- 23 files changed, 211 insertions(+), 191 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bf160d73..33e59ad74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-01-06 Don Allingham + * const.py.in: add support for overriding gconf usage + * src/GrampsIniKeys.py: provide support for the default schema + * src/GrampsKeys.py: select appropriate backend + * various: switch from GrampsGconfKeys to GrampsKeys for normal usage + +2005-01-05 Douglas S. Blank + * src/GrampsIniKeys.py: Alternate backend using .ini files instead + of gconf + 2005-01-05 Don Allingham * src/gramps_main.py: detect pygtk_version before passing False for markup on MenuItem diff --git a/src/ArgHandler.py b/src/ArgHandler.py index b1d05a919..72653264a 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -46,7 +46,7 @@ import ReadXML import GrampsMime import DbPrompter import QuestionDialog -import GrampsGconfKeys +import GrampsKeys import RecentFiles import PluginMgr import Report @@ -324,8 +324,8 @@ class ArgHandler: if self.imports: self.parent.import_tool_callback() - elif GrampsGconfKeys.get_lastfile() and GrampsGconfKeys.get_autoload(): - if self.auto_save_load(GrampsGconfKeys.get_lastfile()) == 0: + elif GrampsKeys.get_lastfile() and GrampsKeys.get_autoload(): + if self.auto_save_load(GrampsKeys.get_lastfile()) == 0: DbPrompter.DbPrompter(self.parent,0) else: DbPrompter.DbPrompter(self.parent,0) diff --git a/src/DateHandler.py b/src/DateHandler.py index 518247c52..3a6e47965 100644 --- a/src/DateHandler.py +++ b/src/DateHandler.py @@ -123,8 +123,8 @@ except: parser = DateParser.DateParser() try: - import GrampsGconfKeys - val = GrampsGconfKeys.get_date_format(_lang_to_display[_lang].formats) + import GrampsKeys + val = GrampsKeys.get_date_format(_lang_to_display[_lang].formats) except: val = 0 diff --git a/src/DbPrompter.py b/src/DbPrompter.py index fc4367332..b0cc1ef41 100644 --- a/src/DbPrompter.py +++ b/src/DbPrompter.py @@ -50,7 +50,7 @@ import PluginMgr import GrampsBSDDB import GrampsXMLDB import GrampsGEDDB -import GrampsGconfKeys +import GrampsKeys import RecentFiles #------------------------------------------------------------------------- @@ -162,11 +162,11 @@ class ExistingDbPrompter: # Suggested folder: try last open file, last import, last export, # then home. - default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_import_dir() + default_dir = GrampsKeys.get_last_import_dir() if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_export_dir() + default_dir = GrampsKeys.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -257,11 +257,11 @@ class ImportDbPrompter: # Suggested folder: try last open file, import, then last export, # then home. - default_dir = GrampsGconfKeys.get_last_import_dir() + default_dir = GrampsKeys.get_last_import_dir() if len(default_dir)<=1: - default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_export_dir() + default_dir = GrampsKeys.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -278,7 +278,7 @@ class ImportDbPrompter: # return True (the_path,the_file) = os.path.split(filename) - GrampsGconfKeys.save_last_import_dir(the_path) + GrampsKeys.save_last_import_dir(the_path) for (importData,mime_filter,mime_type,native_format) in PluginMgr.import_list: if filetype == mime_type or the_file == mime_type: choose.destroy() @@ -335,11 +335,11 @@ class NewNativeDbPrompter: # Suggested folder: try last open file, import, then last export, # then home. - default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_import_dir() + default_dir = GrampsKeys.get_last_import_dir() if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_export_dir() + default_dir = GrampsKeys.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -379,7 +379,7 @@ def open_native(parent,filename,filetype): """ (the_path,the_file) = os.path.split(filename) - GrampsGconfKeys.save_last_import_dir(the_path) + GrampsKeys.save_last_import_dir(the_path) success = False if filetype == const.app_gramps: diff --git a/src/EditPerson.py b/src/EditPerson.py index b4ac1a848..4a938de5b 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -48,7 +48,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_ #------------------------------------------------------------------------- import const import Utils -import GrampsGconfKeys +import GrampsKeys import GrampsCfg import GrampsMime import ImageSelect @@ -331,7 +331,7 @@ class EditPerson: self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment()) self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing()) - if GrampsGconfKeys.get_uselds() \ + if GrampsKeys.get_uselds() \ or (not self.lds_baptism.is_empty()) \ or (not self.lds_endowment.is_empty()) \ or (not self.lds_sealing.is_empty()): @@ -1146,7 +1146,7 @@ class EditPerson: """If the data has changed, give the user a chance to cancel the close window""" - if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): + if self.did_data_change() and not GrampsKeys.get_dont_ask(): n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save changes to %s?') % n, _('If you close without saving, the changes you ' @@ -1162,7 +1162,7 @@ class EditPerson: def on_delete_event(self,obj,b): """If the data has changed, give the user a chance to cancel the close window""" - if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): + if self.did_data_change() and not GrampsKeys.get_dont_ask(): n = "%s" % self.person.get_primary_name().get_regular_name() SaveDialog(_('Save Changes to %s?') % n, _('If you close without saving, the changes you ' diff --git a/src/Exporter.py b/src/Exporter.py index e636a453b..048d0d82a 100644 --- a/src/Exporter.py +++ b/src/Exporter.py @@ -51,7 +51,7 @@ import const import Utils import Plugins import QuestionDialog -import GrampsGconfKeys +import GrampsKeys #------------------------------------------------------------------------- # @@ -205,7 +205,7 @@ class Exporter: Depending on the success status, set the text for the final page. """ filename = self.chooser.get_filename() - GrampsGconfKeys.save_last_export_dir(os.path.split(filename)[0]) + GrampsKeys.save_last_export_dir(os.path.split(filename)[0]) ix = self.get_selected_format_index() if self.exports[ix][3]: success = self.exports[ix][0](self.parent.db,filename,self.person, @@ -334,9 +334,9 @@ class Exporter: ext = self.exports[ix][4] # Suggested folder: try last export, then last import, then home. - default_dir = GrampsGconfKeys.get_last_export_dir() + default_dir = GrampsKeys.get_last_export_dir() if len(default_dir)<=1: - default_dir = GrampsGconfKeys.get_last_import_dir() + default_dir = GrampsKeys.get_last_import_dir() if len(default_dir)<=1: default_dir = '~/' diff --git a/src/FamilyView.py b/src/FamilyView.py index a6917e70b..dea011f8a 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -36,7 +36,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK #------------------------------------------------------------------------- import const import Utils -import GrampsGconfKeys +import GrampsKeys import GrampsCfg import AddSpouse import SelectChild @@ -183,7 +183,7 @@ class FamilyView: self.sp_drag_data_received) def init_interface(self): - fv = GrampsGconfKeys.get_family_view() + fv = GrampsKeys.get_family_view() self.set_widgets(fv) already_init = self.cadded[fv] @@ -710,7 +710,7 @@ class FamilyView: return person = RelLib.Person() - autoname = GrampsGconfKeys.get_lastnamegen() + autoname = GrampsKeys.get_lastnamegen() if autoname == 0: name = self.north_american(0) diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index e6ef63454..f8f7f53a9 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -43,7 +43,7 @@ import gnome # gramps modules # #------------------------------------------------------------------------- -import GrampsGconfKeys +import GrampsKeys import RelLib import const import Utils @@ -82,12 +82,12 @@ panellist = [ # Not exactly gconf keys, but the functions directly dependent on them def get_toolbar_style(): - saved_toolbar = GrampsGconfKeys.get_toolbar() + saved_toolbar = GrampsKeys.get_toolbar() if saved_toolbar in range(4): return saved_toolbar else: try: - gnome_toolbar_str = GrampsGconfKeys.client.get_string("/desktop/gnome/interface/toolbar_style") + gnome_toolbar_str = GrampsKeys.client.get_string("/desktop/gnome/interface/toolbar_style") gnome_toolbar = eval("gtk.TOOLBAR_%s" % gnome_toolbar_str.replace('-','_').upper()) except: @@ -96,7 +96,7 @@ def get_toolbar_style(): def set_calendar_date_format(): format_list = DateHandler.get_date_formats() - DateHandler.set_format(GrampsGconfKeys.get_date_format(format_list)) + DateHandler.set_format(GrampsKeys.get_date_format(format_list)) #------------------------------------------------------------------------- # @@ -131,14 +131,14 @@ def loadConfig(): # #------------------------------------------------------------------------- def get_researcher(): - n = GrampsGconfKeys.get_researcher_name() - a = GrampsGconfKeys.get_researcher_addr() - c = GrampsGconfKeys.get_researcher_city() - s = GrampsGconfKeys.get_researcher_state() - ct = GrampsGconfKeys.get_researcher_country() - p = GrampsGconfKeys.get_researcher_postal() - ph = GrampsGconfKeys.get_researcher_phone() - e = GrampsGconfKeys.get_researcher_email() + n = GrampsKeys.get_researcher_name() + a = GrampsKeys.get_researcher_addr() + c = GrampsKeys.get_researcher_city() + s = GrampsKeys.get_researcher_state() + ct = GrampsKeys.get_researcher_country() + p = GrampsKeys.get_researcher_postal() + ph = GrampsKeys.get_researcher_phone() + e = GrampsKeys.get_researcher_email() owner = RelLib.Researcher() owner.set(n,a,c,s,ct,p,ph,e) @@ -194,73 +194,73 @@ class GrampsPreferences: def build(self): auto = self.top.get_widget("autoload") - auto.set_active(GrampsGconfKeys.get_autoload()) + auto.set_active(GrampsKeys.get_autoload()) auto.connect('toggled', - lambda obj: GrampsGconfKeys.save_autoload(obj.get_active())) + lambda obj: GrampsKeys.save_autoload(obj.get_active())) lds = self.top.get_widget("uselds") - lds.set_active(GrampsGconfKeys.get_uselds()) + lds.set_active(GrampsKeys.get_uselds()) lds.connect('toggled', - lambda obj: GrampsGconfKeys.save_uselds(obj.get_active())) + lambda obj: GrampsKeys.save_uselds(obj.get_active())) ipr = self.top.get_widget("iprefix") - ipr.set_text(GrampsGconfKeys.get_person_id_prefix()) + ipr.set_text(GrampsKeys.get_person_id_prefix()) ipr.connect('changed', - lambda obj: GrampsGconfKeys.save_iprefix(obj.get_text())) + lambda obj: GrampsKeys.save_iprefix(obj.get_text())) opr = self.top.get_widget("oprefix") - opr.set_text(GrampsGconfKeys.get_object_id_prefix()) + opr.set_text(GrampsKeys.get_object_id_prefix()) opr.connect('changed', - lambda obj: GrampsGconfKeys.save_oprefix(obj.get_text())) + lambda obj: GrampsKeys.save_oprefix(obj.get_text())) fpr = self.top.get_widget("fprefix") - fpr.set_text(GrampsGconfKeys.get_family_id_prefix()) + fpr.set_text(GrampsKeys.get_family_id_prefix()) fpr.connect('changed', - lambda obj: GrampsGconfKeys.save_fprefix(obj.get_text())) + lambda obj: GrampsKeys.save_fprefix(obj.get_text())) spr = self.top.get_widget("sprefix") - spr.set_text(GrampsGconfKeys.get_source_id_prefix()) + spr.set_text(GrampsKeys.get_source_id_prefix()) spr.connect('changed', - lambda obj: GrampsGconfKeys.save_sprefix(obj.get_text())) + lambda obj: GrampsKeys.save_sprefix(obj.get_text())) ppr = self.top.get_widget("pprefix") - ppr.set_text(GrampsGconfKeys.get_place_id_prefix()) + ppr.set_text(GrampsKeys.get_place_id_prefix()) ppr.connect('changed', - lambda obj: GrampsGconfKeys.save_pprefix(obj.get_text())) + lambda obj: GrampsKeys.save_pprefix(obj.get_text())) sb2 = self.top.get_widget("stat2") sb3 = self.top.get_widget("stat3") - if GrampsGconfKeys.get_statusbar() == 0 or GrampsGconfKeys.get_statusbar() == 1: + if GrampsKeys.get_statusbar() == 0 or GrampsKeys.get_statusbar() == 1: sb2.set_active(1) else: sb3.set_active(1) sb2.connect('toggled', - lambda obj: GrampsGconfKeys.save_statusbar(2-obj.get_active())) + lambda obj: GrampsKeys.save_statusbar(2-obj.get_active())) toolbarmenu = self.top.get_widget("tooloptmenu") - toolbarmenu.set_active(GrampsGconfKeys.get_toolbar()-1) - print GrampsGconfKeys.get_toolbar() + toolbarmenu.set_active(GrampsKeys.get_toolbar()-1) + print GrampsKeys.get_toolbar() toolbarmenu.connect('changed', - lambda obj: GrampsGconfKeys.save_toolbar(obj.get_active()+1)) + lambda obj: GrampsKeys.save_toolbar(obj.get_active()+1)) pvbutton = self.top.get_widget('pvbutton') fvbutton = self.top.get_widget('fvbutton') - if GrampsGconfKeys.get_default_view() == 0: + if GrampsKeys.get_default_view() == 0: pvbutton.set_active(1) else: fvbutton.set_active(1) fvbutton.connect('toggled', - lambda obj: GrampsGconfKeys.save_default_view(obj.get_active())) + lambda obj: GrampsKeys.save_default_view(obj.get_active())) familyview1 = self.top.get_widget('familyview1') familyview2 = self.top.get_widget('familyview2') - if GrampsGconfKeys.get_family_view() == 0: + if GrampsKeys.get_family_view() == 0: familyview1.set_active(1) else: familyview2.set_active(1) familyview2.connect('toggled', - lambda obj: GrampsGconfKeys.save_family_view(obj.get_active())) + lambda obj: GrampsKeys.save_family_view(obj.get_active())) usetips = self.top.get_widget('usetips') - usetips.set_active(GrampsGconfKeys.get_usetips()) + usetips.set_active(GrampsKeys.get_usetips()) usetips.connect('toggled', - lambda obj: GrampsGconfKeys.save_usetips(obj.get_active())) + lambda obj: GrampsKeys.save_usetips(obj.get_active())) lastnamegen_obj = self.top.get_widget("lastnamegen") menu = gtk.Menu() @@ -270,11 +270,11 @@ class GrampsPreferences: item.set_data(DATA,index) item.show() menu.append(item) - menu.set_active(GrampsGconfKeys.get_lastnamegen(_surname_styles)) + menu.set_active(GrampsKeys.get_lastnamegen(_surname_styles)) lastnamegen_obj.set_menu(menu) lastnamegen_obj.connect("changed", lambda obj: - GrampsGconfKeys.save_lastnamegen(obj.get_menu().get_active().get_data(DATA),_surname_styles) + GrampsKeys.save_lastnamegen(obj.get_menu().get_active().get_data(DATA),_surname_styles) ) date_option = self.top.get_widget("date_format") @@ -288,48 +288,48 @@ class GrampsPreferences: try: # Technically, a selected format might be out of range # for this locale's format list. - date_menu.set_active(GrampsGconfKeys.get_date_format(dlist)) + date_menu.set_active(GrampsKeys.get_date_format(dlist)) except: pass date_option.set_menu(date_menu) date_option.connect("changed", lambda obj: - GrampsGconfKeys.save_date_format(obj.get_menu().get_active().get_data(INDEX),dlist) + GrampsKeys.save_date_format(obj.get_menu().get_active().get_data(INDEX),dlist) ) resname = self.top.get_widget("resname") - resname.set_text(GrampsGconfKeys.get_researcher_name()) + resname.set_text(GrampsKeys.get_researcher_name()) resname.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_name(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_name(obj.get_text())) resaddr = self.top.get_widget("resaddr") - resaddr.set_text(GrampsGconfKeys.get_researcher_addr()) + resaddr.set_text(GrampsKeys.get_researcher_addr()) resaddr.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_addr(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_addr(obj.get_text())) rescity = self.top.get_widget("rescity") - rescity.set_text(GrampsGconfKeys.get_researcher_city()) + rescity.set_text(GrampsKeys.get_researcher_city()) rescity.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_city(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_city(obj.get_text())) resstate = self.top.get_widget("resstate") - resstate.set_text(GrampsGconfKeys.get_researcher_state()) + resstate.set_text(GrampsKeys.get_researcher_state()) resstate.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_state(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_state(obj.get_text())) rescountry = self.top.get_widget("rescountry") - rescountry.set_text(GrampsGconfKeys.get_researcher_country()) + rescountry.set_text(GrampsKeys.get_researcher_country()) rescountry.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_country(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_country(obj.get_text())) respostal = self.top.get_widget("respostal") - respostal.set_text(GrampsGconfKeys.get_researcher_postal()) + respostal.set_text(GrampsKeys.get_researcher_postal()) respostal.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_postal(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_postal(obj.get_text())) resphone = self.top.get_widget("resphone") - resphone.set_text(GrampsGconfKeys.get_researcher_phone()) + resphone.set_text(GrampsKeys.get_researcher_phone()) resphone.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_phone(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_phone(obj.get_text())) resemail = self.top.get_widget("resemail") - resemail.set_text(GrampsGconfKeys.get_researcher_email()) + resemail.set_text(GrampsKeys.get_researcher_email()) resemail.connect('changed', - lambda obj: GrampsGconfKeys.save_researcher_email(obj.get_text())) + lambda obj: GrampsKeys.save_researcher_email(obj.get_text())) def select(self,obj): store,node = self.selection.get_selected() diff --git a/src/GrampsDbBase.py b/src/GrampsDbBase.py index e18969073..0ff78a3b3 100644 --- a/src/GrampsDbBase.py +++ b/src/GrampsDbBase.py @@ -41,7 +41,7 @@ import os import md5 import gtk -import GrampsGconfKeys +import GrampsKeys import Utils #------------------------------------------------------------------------- @@ -123,12 +123,12 @@ class GrampsDbBase: self.lmap_index = 0 self.omap_index = 0 - self.set_person_id_prefix(GrampsGconfKeys.get_person_id_prefix()) - self.set_object_id_prefix(GrampsGconfKeys.get_object_id_prefix()) - self.set_family_id_prefix(GrampsGconfKeys.get_family_id_prefix()) - self.set_source_id_prefix(GrampsGconfKeys.get_source_id_prefix()) - self.set_place_id_prefix(GrampsGconfKeys.get_place_id_prefix()) - self.set_event_id_prefix(GrampsGconfKeys.get_event_id_prefix()) + self.set_person_id_prefix(GrampsKeys.get_person_id_prefix()) + self.set_object_id_prefix(GrampsKeys.get_object_id_prefix()) + self.set_family_id_prefix(GrampsKeys.get_family_id_prefix()) + self.set_source_id_prefix(GrampsKeys.get_source_id_prefix()) + self.set_place_id_prefix(GrampsKeys.get_place_id_prefix()) + self.set_event_id_prefix(GrampsKeys.get_event_id_prefix()) self.open = 0 self.genderStats = GenderStats() diff --git a/src/ImageSelect.py b/src/ImageSelect.py index a552b64c3..b9b904c87 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -48,7 +48,7 @@ import gtk.glade #------------------------------------------------------------------------- import const import Utils -import GrampsGconfKeys +import GrampsKeys import NameDisplay import Plugins import RelLib @@ -470,12 +470,12 @@ class Gallery(ImageSelect): (root,ext) = os.path.splitext(basename) photo.set_description(root) self.savephoto(photo) - if GrampsGconfKeys.get_media_reference() == 0: + if GrampsKeys.get_media_reference() == 0: self.db.set_thumbnail_image(photo.get_handle(), self.path) photo.set_path(name) self.parent.lists_changed = 1 - if GrampsGconfKeys.get_media_global(): + if GrampsKeys.get_media_global(): GlobalMediaProperties(self.db,photo,None, self,self.parent_window) elif protocol != "": @@ -505,7 +505,7 @@ class Gallery(ImageSelect): return self.add_thumbnail(oref) self.parent.lists_changed = 1 - if GrampsGconfKeys.get_media_global(): + if GrampsKeys.get_media_global(): GlobalMediaProperties(self.db,photo,None, self,self.parent_window) else: @@ -535,7 +535,7 @@ class Gallery(ImageSelect): self.dataobj.add_media_reference(oref) self.add_thumbnail(oref) self.parent.lists_changed = 1 - if GrampsGconfKeys.get_media_global(): + if GrampsKeys.get_media_global(): LocalMediaProperties(oref,self.path,self,self.parent_window) def on_photolist_drag_data_get(self,w, context, selection_data, info, time): diff --git a/src/Marriage.py b/src/Marriage.py index 538670abe..bce07727b 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -47,7 +47,7 @@ import RelLib import ImageSelect import DateHandler import Sources -import GrampsGconfKeys +import GrampsKeys import NameDisplay from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog @@ -556,7 +556,7 @@ class Marriage: self.close(0) def on_cancel_edit(self,obj): - if self.did_data_change() and not GrampsGconfKeys.get_dont_ask(): + if self.did_data_change() and not GrampsKeys.get_dont_ask(): global quit self.quit = obj SaveDialog(_('Save Changes?'), diff --git a/src/MediaView.py b/src/MediaView.py index 0e4f2cefe..50fb12a48 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -43,7 +43,7 @@ import gtk.gdk #------------------------------------------------------------------------- import RelLib import Utils -import GrampsGconfKeys +import GrampsKeys import const import ImageSelect import RelImage @@ -389,13 +389,13 @@ class MediaView: photo.set_description(description) trans = self.db.transaction_begin() self.db.add_object(photo,trans) - if GrampsGconfKeys.get_media_reference() == 0: + if GrampsKeys.get_media_reference() == 0: self.db.set_thumbnail_image(photo.get_handle(),name) self.db.commit_media_object(photo,trans) self.db.transaction_commit(trans,_("Add Media Object")) self.build_tree() - if GrampsGconfKeys.get_media_global(): + if GrampsKeys.get_media_global(): ImageSelect.GlobalMediaProperties(self.db,photo, self.update_display, self,self.topWindow) @@ -427,7 +427,7 @@ class MediaView: self.db.commit_media_object(photo,trans) self.db.transaction_commit(trans,_("Add Media Object")) - if GrampsGconfKeys.get_media_global(): + if GrampsKeys.get_media_global(): ImageSelect.GlobalMediaProperties(self.db,photo,None, self,self.topWindow) diff --git a/src/PluginMgr.py b/src/PluginMgr.py index 435de28fb..ac7083e5e 100644 --- a/src/PluginMgr.py +++ b/src/PluginMgr.py @@ -45,7 +45,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import const -import GrampsGconfKeys +import GrampsKeys import Errors #------------------------------------------------------------------------- @@ -133,7 +133,7 @@ def load_plugins(direct): except: failmsg_list.append((filename,sys.exc_info())) - if GrampsGconfKeys.get_pop_plugin_status() and len(expect_list)+len(failmsg_list): + if GrampsKeys.get_pop_plugin_status() and len(expect_list)+len(failmsg_list): PluginStatus() #------------------------------------------------------------------------- @@ -199,7 +199,7 @@ def reload_plugins(obj=None,junk1=None,junk2=None,junk3=None): except: failmsg_list.append((filename,sys.exc_info())) - if GrampsGconfKeys.get_pop_plugin_status(): + if GrampsKeys.get_pop_plugin_status(): global status_up if len(failmsg_list): PluginStatus() diff --git a/src/Plugins.py b/src/Plugins.py index c9d9dc06a..3f4eb2533 100644 --- a/src/Plugins.py +++ b/src/Plugins.py @@ -57,7 +57,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- import const import Utils -import GrampsGconfKeys +import GrampsKeys import Errors import Report import PluginMgr @@ -361,13 +361,13 @@ class PluginStatus: self.top.set_title("%s - GRAMPS" % _('Plugin status')) window = self.glade.get_widget("text") self.pop_button = self.glade.get_widget("pop_button") - if GrampsGconfKeys.get_pop_plugin_status(): + if GrampsKeys.get_pop_plugin_status(): self.pop_button.set_active(1) else: self.pop_button.set_active(0) self.pop_button.connect('toggled', - lambda obj: GrampsGconfKeys.save_pop_plugin_status(self.pop_button.get_active())) - GrampsGconfKeys.client.notify_add("/apps/gramps/behavior/pop-plugin-status", + lambda obj: GrampsKeys.save_pop_plugin_status(self.pop_button.get_active())) + GrampsKeys.client.notify_add("/apps/gramps/behavior/pop-plugin-status", self.pop_button_update) self.glade.signal_autoconnect({ 'on_close_clicked' : self.close, @@ -408,7 +408,7 @@ class PluginStatus: gnome.help_display('gramps-manual','gramps-getting-started') def pop_button_update(self, client,cnxn_id,entry,data): - self.pop_button.set_active(GrampsGconfKeys.get_pop_plugin_status()) + self.pop_button.set_active(GrampsKeys.get_pop_plugin_status()) #------------------------------------------------------------------------- # @@ -509,7 +509,7 @@ class GrampsTextFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsGconfKeys.get_output_preference() + out_pref = GrampsKeys.get_output_preference() index = 0 _textdoc.sort() active_index = 0 @@ -554,7 +554,7 @@ class GrampsDrawFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsGconfKeys.get_output_preference() + out_pref = GrampsKeys.get_output_preference() index = 0 _drawdoc.sort() active_index = 0 @@ -599,7 +599,7 @@ class GrampsBookFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsGconfKeys.get_output_preference() + out_pref = GrampsKeys.get_output_preference() index = 0 _drawdoc.sort() active_index = 0 diff --git a/src/QuestionDialog.py b/src/QuestionDialog.py index 55f43eec7..3cb12a792 100644 --- a/src/QuestionDialog.py +++ b/src/QuestionDialog.py @@ -21,7 +21,7 @@ import gtk import gtk.glade import const -import GrampsGconfKeys +import GrampsKeys from gettext import gettext as _ @@ -50,7 +50,7 @@ class SaveDialog: elif response == gtk.RESPONSE_YES: self.task2() - GrampsGconfKeys.save_dont_ask(self.dontask.get_active()) + GrampsKeys.save_dont_ask(self.dontask.get_active()) self.top.destroy() class QuestionDialog: diff --git a/src/Report.py b/src/Report.py index a1bcf5b4f..0787b0a27 100644 --- a/src/Report.py +++ b/src/Report.py @@ -52,7 +52,7 @@ import Utils import Plugins import BaseDoc import StyleEditor -import GrampsGconfKeys +import GrampsKeys import PaperMenu import Errors import GenericFilter @@ -962,7 +962,7 @@ class ReportDialog(BareReportDialog): """Get the name of the directory to which the target dialog box should default. This value can be set in the preferences panel.""" - return GrampsGconfKeys.get_report_dir() + return GrampsKeys.get_report_dir() def set_default_directory(self, value): """Save the name of the current directory, so that any future @@ -972,7 +972,7 @@ class ReportDialog(BareReportDialog): This means that the last directory used will only be remembered for this session of gramps unless the user saves his/her preferences.""" - GrampsGconfKeys.save_report_dir(value) + GrampsKeys.save_report_dir(value) #------------------------------------------------------------------------ # diff --git a/src/ReportOptions.py b/src/ReportOptions.py index f99cba7fa..b90193b32 100644 --- a/src/ReportOptions.py +++ b/src/ReportOptions.py @@ -49,7 +49,7 @@ except: # #------------------------------------------------------------------------- import const -import GrampsGconfKeys +import GrampsKeys import Utils import BaseDoc @@ -188,7 +188,7 @@ class OptionListCollection: # Default values for common options default_style_name = "default" - default_paper_name = GrampsGconfKeys.get_paper_preference() + default_paper_name = GrampsKeys.get_paper_preference() default_template_name = "" default_orientation = BaseDoc.PAPER_PORTRAIT default_format_name = _('Print...') diff --git a/src/StartupDialog.py b/src/StartupDialog.py index 866f9cc00..dd86d6884 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -26,12 +26,12 @@ import gtk.glade import gnome import gnome.ui -import GrampsGconfKeys +import GrampsKeys from gettext import gettext as _ def need_to_run(): - val = GrampsGconfKeys.get_startup() + val = GrampsKeys.get_startup() if val < const.startup: return 1 return 0 @@ -95,18 +95,19 @@ class StartupDialog: return p def complete(self,obj,obj2): - GrampsGconfKeys.save_researcher_name(unicode(self.name.get_text())) - GrampsGconfKeys.save_researcher_addr(unicode(self.addr.get_text())) - GrampsGconfKeys.save_researcher_city(unicode(self.city.get_text())) - GrampsGconfKeys.save_researcher_state(unicode(self.state.get_text())) - GrampsGconfKeys.save_researcher_postal(unicode(self.postal.get_text())) - GrampsGconfKeys.save_researcher_country(unicode(self.country.get_text())) - GrampsGconfKeys.save_researcher_phone(unicode(self.phone.get_text())) - GrampsGconfKeys.save_researcher_email(unicode(self.email.get_text())) + GrampsKeys.save_researcher_name(unicode(self.name.get_text())) + GrampsKeys.save_researcher_addr(unicode(self.addr.get_text())) + GrampsKeys.save_researcher_city(unicode(self.city.get_text())) + GrampsKeys.save_researcher_state(unicode(self.state.get_text())) + GrampsKeys.save_researcher_postal(unicode(self.postal.get_text())) + GrampsKeys.save_researcher_country(unicode(self.country.get_text())) + GrampsKeys.save_researcher_phone(unicode(self.phone.get_text())) + GrampsKeys.save_researcher_email(unicode(self.email.get_text())) - GrampsGconfKeys.save_uselds(self.lds.get_active()) - GrampsGconfKeys.save_startup(const.startup) - self.w.destroy() + GrampsKeys.save_uselds(self.lds.get_active()) + GrampsKeys.save_startup(const.startup) + self.w.destroy() + GrampsKeys.sync() self.task(self.args) def build_page2(self): @@ -143,7 +144,7 @@ class StartupDialog: box.add(table) box.show_all() - name = GrampsGconfKeys.get_researcher_name() + name = GrampsKeys.get_researcher_name() if not name or name.strip() == "": import pwd import os @@ -154,13 +155,13 @@ class StartupDialog: name = "" self.name.set_text(name) - self.addr.set_text(GrampsGconfKeys.get_researcher_addr()) - self.city.set_text(GrampsGconfKeys.get_researcher_city()) - self.state.set_text(GrampsGconfKeys.get_researcher_state()) - self.postal.set_text(GrampsGconfKeys.get_researcher_postal()) - self.country.set_text(GrampsGconfKeys.get_researcher_country()) - self.phone.set_text(GrampsGconfKeys.get_researcher_phone()) - self.email.set_text(GrampsGconfKeys.get_researcher_email()) + self.addr.set_text(GrampsKeys.get_researcher_addr()) + self.city.set_text(GrampsKeys.get_researcher_city()) + self.state.set_text(GrampsKeys.get_researcher_state()) + self.postal.set_text(GrampsKeys.get_researcher_postal()) + self.country.set_text(GrampsKeys.get_researcher_country()) + self.phone.set_text(GrampsKeys.get_researcher_phone()) + self.email.set_text(GrampsKeys.get_researcher_email()) return p @@ -188,7 +189,7 @@ class StartupDialog: self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support")) - self.lds.set_active(GrampsGconfKeys.get_uselds()) + self.lds.set_active(GrampsKeys.get_uselds()) align.add(self.lds) diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 711dce6ee..9bd6cd757 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -42,7 +42,7 @@ import gtk.glade # #------------------------------------------------------------------------- import const -import GrampsGconfKeys +import GrampsKeys #------------------------------------------------------------------------- # @@ -58,7 +58,7 @@ class TipOfDay: tp = TipParser() tip_list = tp.get() - use.set_active(GrampsGconfKeys.get_usetips()) + use.set_active(GrampsKeys.get_usetips()) new_index = range(len(tip_list)) Random().shuffle(new_index) @@ -74,7 +74,7 @@ class TipOfDay: else: index += 1 - GrampsGconfKeys.save_usetips(use.get_active()) + GrampsKeys.save_usetips(use.get_active()) top.destroy() #------------------------------------------------------------------------- diff --git a/src/Utils.py b/src/Utils.py index 8748b031e..ab0f5c5a3 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -224,9 +224,9 @@ def view_photo(photo): os.execvp(args[0],args) def nautilus_icon(icon,mime_type): - import GrampsGconfKeys + import GrampsKeys - theme = GrampsGconfKeys.client.get_string("/desktop/gnome/file_views/icon_theme") + theme = GrampsKeys.client.get_string("/desktop/gnome/file_views/icon_theme") if icon : newicon = "%s/%s/%s.png" % (const.nautdir,theme,icon) diff --git a/src/const.py.in b/src/const.py.in index fa3a532f0..61ae74bc8 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -60,6 +60,14 @@ nautdir = "/usr/share/pixmaps/nautilus" prefixdir = "@GPREFIX@" +#------------------------------------------------------------------------- +# +# Configuration database options - True means drop down to .INI files +# +#------------------------------------------------------------------------- + +no_gconf = False + #------------------------------------------------------------------------- # # Paths to files - assumes that files reside in the same directory as diff --git a/src/gramps_main.py b/src/gramps_main.py index f38bf43d9..0b2531e2d 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -66,7 +66,7 @@ import Plugins import PluginMgr import Utils import Bookmarks -import GrampsGconfKeys +import GrampsKeys import GrampsCfg import EditPerson import DbPrompter @@ -133,13 +133,14 @@ class Gramps: GrampsCfg.loadConfig() - if GrampsGconfKeys.get_betawarn() == 0: + if GrampsKeys.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.")) - GrampsGconfKeys.save_betawarn(1) + GrampsKeys.save_betawarn(1) + GrampsKeys.sync() self.RelClass = PluginMgr.relationship_class self.relationship = self.RelClass(self.db) @@ -151,27 +152,27 @@ 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. - GrampsGconfKeys.client.notify_add("/apps/gramps/researcher", + GrampsKeys.client.notify_add("/apps/gramps/researcher", self.researcher_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/statusbar", + GrampsKeys.client.notify_add("/apps/gramps/interface/statusbar", self.statusbar_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/toolbar", + GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar", self.toolbar_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/toolbar-on", + GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar-on", self.toolbar_on_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/filter", + GrampsKeys.client.notify_add("/apps/gramps/interface/filter", self.filter_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/view", + GrampsKeys.client.notify_add("/apps/gramps/interface/view", self.sidebar_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/interface/familyview", + GrampsKeys.client.notify_add("/apps/gramps/interface/familyview", self.familyview_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/preferences/name-format", + GrampsKeys.client.notify_add("/apps/gramps/preferences/name-format", self.familyview_key_update) - GrampsGconfKeys.client.notify_add("/apps/gramps/preferences/date-format", + GrampsKeys.client.notify_add("/apps/gramps/preferences/date-format", self.date_format_key_update) self.topWindow.show() - if GrampsGconfKeys.get_usetips(): + if GrampsKeys.get_usetips(): TipOfDay.TipOfDay() self.db.set_researcher(GrampsCfg.get_researcher()) @@ -181,12 +182,12 @@ class Gramps: self.familyview_key_update(client,cnxn_id,entry,data) def researcher_key_update(self,client,cnxn_id,entry,data): - self.db.set_person_id_prefix(GrampsGconfKeys.get_person_id_prefix()) - self.db.set_family_id_prefix(GrampsGconfKeys.get_family_id_prefix()) - self.db.set_source_id_prefix(GrampsGconfKeys.get_source_id_prefix()) - self.db.set_object_id_prefix(GrampsGconfKeys.get_object_id_prefix()) - self.db.set_place_id_prefix(GrampsGconfKeys.get_place_id_prefix()) - self.db.set_event_id_prefix(GrampsGconfKeys.get_event_id_prefix()) + self.db.set_person_id_prefix(GrampsKeys.get_person_id_prefix()) + self.db.set_family_id_prefix(GrampsKeys.get_family_id_prefix()) + self.db.set_source_id_prefix(GrampsKeys.get_source_id_prefix()) + self.db.set_object_id_prefix(GrampsKeys.get_object_id_prefix()) + self.db.set_place_id_prefix(GrampsKeys.get_place_id_prefix()) + self.db.set_event_id_prefix(GrampsKeys.get_event_id_prefix()) def statusbar_key_update(self,client,cnxn_id,entry,data): self.modify_statusbar() @@ -195,17 +196,17 @@ class Gramps: self.toolbar.set_style(GrampsCfg.get_toolbar_style()) def toolbar_on_key_update(self,client,cnxn_id,entry,data): - is_on = GrampsGconfKeys.get_toolbar_on() + is_on = GrampsKeys.get_toolbar_on() self.toolbar_btn.set_active(is_on) self.enable_toolbar(is_on) def filter_key_update(self,client,cnxn_id,entry,data): - is_on = GrampsGconfKeys.get_filter() + is_on = GrampsKeys.get_filter() self.filter_btn.set_active(is_on) self.enable_filter(is_on) def sidebar_key_update(self,client,cnxn_id,entry,data): - is_on = GrampsGconfKeys.get_view() + is_on = GrampsKeys.get_view() self.sidebar_btn.set_active(is_on) self.enable_sidebar(is_on) @@ -387,25 +388,25 @@ class Gramps: "on_open_example" : self.open_example, }) - self.filter_btn.set_active(GrampsGconfKeys.get_filter()) - self.enable_filter(GrampsGconfKeys.get_filter()) - self.toolbar_btn.set_active(GrampsGconfKeys.get_toolbar_on()) - self.enable_toolbar(GrampsGconfKeys.get_toolbar_on()) + self.filter_btn.set_active(GrampsKeys.get_filter()) + self.enable_filter(GrampsKeys.get_filter()) + self.toolbar_btn.set_active(GrampsKeys.get_toolbar_on()) + self.enable_toolbar(GrampsKeys.get_toolbar_on()) - if not GrampsGconfKeys.get_screen_size_checked(): - GrampsGconfKeys.save_screen_size_checked(1) + if not GrampsKeys.get_screen_size_checked(): + GrampsKeys.save_screen_size_checked(1) if gtk.gdk.screen_width() <= 900: - GrampsGconfKeys.save_view(0) - self.sidebar_btn.set_active(GrampsGconfKeys.get_view()) - self.enable_sidebar(GrampsGconfKeys.get_view()) + GrampsKeys.save_view(0) + self.sidebar_btn.set_active(GrampsKeys.get_view()) + self.enable_sidebar(GrampsKeys.get_view()) self.find_place = None self.find_source = None self.find_media = None - if GrampsGconfKeys.get_default_view() == 0: + if GrampsKeys.get_default_view() == 0: self.views.set_current_page(PERSON_VIEW) - elif GrampsGconfKeys.get_family_view() == 0: + elif GrampsKeys.get_family_view() == 0: self.views.set_current_page(FAMILY_VIEW1) else: self.views.set_current_page(FAMILY_VIEW2) @@ -789,7 +790,7 @@ class Gramps: def on_sidebar_activate(self,obj): self.enable_sidebar(obj.get_active()) - GrampsGconfKeys.save_view(obj.get_active()) + GrampsKeys.save_view(obj.get_active()) def enable_sidebar(self,val): if val: @@ -806,10 +807,10 @@ class Gramps: self.filterbar.hide() def on_filter_activate(self,obj): - GrampsGconfKeys.save_filter(obj.get_active()) + GrampsKeys.save_filter(obj.get_active()) def on_toolbar_activate(self,obj): - GrampsGconfKeys.save_toolbar_on(obj.get_active()) + GrampsKeys.save_toolbar_on(obj.get_active()) def enable_toolbar(self,val): if val: @@ -1102,7 +1103,7 @@ class Gramps: name = os.path.basename(filename) self.topWindow.set_title("%s - GRAMPS" % name) else: - GrampsGconfKeys.save_last_file("") + GrampsKeys.save_last_file("") ErrorDialog(_('Cannot open database'), _('The database file specified could not be opened file.')) return 0 @@ -1376,7 +1377,7 @@ class Gramps: if self.active_person == None: self.status_text("") else: - if GrampsGconfKeys.get_statusbar() <= 1: + if GrampsKeys.get_statusbar() <= 1: pname = NameDisplay.displayer.display(self.active_person) name = "[%s] %s" % (self.active_person.get_gramps_id(),pname) else: @@ -1425,7 +1426,7 @@ class Gramps: def on_family_activate(self,obj): """Switches to the family view""" - if GrampsGconfKeys.get_family_view() == 0: + if GrampsKeys.get_family_view() == 0: self.on_family1_activate(obj) else: self.on_family2_activate(obj) @@ -1563,7 +1564,7 @@ class Gramps: callback(_('Setting up bookmarks...')) self.setup_bookmarks() - GrampsGconfKeys.save_last_file(name) + GrampsKeys.save_last_file(name) self.gtop.get_widget("filter").set_text("") if callback: diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index a03e4df8b..80dbeee97 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -50,7 +50,7 @@ import RelLib import HtmlDoc import BaseDoc import const -import GrampsGconfKeys +import GrampsKeys import GenericFilter import DateHandler import Sort @@ -1327,7 +1327,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 GrampsGconfKeys.get_web_dir() + return GrampsKeys.get_web_dir() def set_default_directory(self, value): """Save the name of the current directory, so that any future @@ -1337,7 +1337,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.""" - GrampsGconfKeys.save_web_dir(value) + GrampsKeys.save_web_dir(value) def make_default_style(self): """Make the default output style for the Web Pages Report."""