diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 1ee0df38a..11423e8a7 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2006-03-02 Alex Roitman + * src/Config/__init__.py: Add new package. + * src/GrampsGconfKeys.py, src/GrampsIniKeys.py, src/GrampsKeys.py: + Remove (placed under Config now). * calendar, filers: Remove directories. * images: Create directory. * src/*png, src/*jpg: move under images directory. diff --git a/gramps2/src/ArgHandler.py b/gramps2/src/ArgHandler.py index cdf4ec6da..f09e350a0 100644 --- a/gramps2/src/ArgHandler.py +++ b/gramps2/src/ArgHandler.py @@ -44,7 +44,7 @@ import const import GrampsDb import GrampsMime import QuestionDialog -import GrampsKeys +import Config import RecentFiles import PluginMgr import Report @@ -392,8 +392,8 @@ class ArgHandler: if self.imports: self.parent.import_tool_callback() - elif GrampsKeys.get_lastfile() and GrampsKeys.get_autoload(): - self.auto_save_load(GrampsKeys.get_lastfile()) + elif Config.get_lastfile() and Config.get_autoload(): + self.auto_save_load(Config.get_lastfile()) #------------------------------------------------------------------------- # @@ -679,11 +679,11 @@ class NewNativeDbPrompter: # Suggested folder: try last open file, import, then last export, # then home. - default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_import_dir() + default_dir = Config.get_last_import_dir() if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_export_dir() + default_dir = Config.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' diff --git a/gramps2/src/GrampsGconfKeys.py b/gramps2/src/Config/_GrampsGconfKeys.py similarity index 100% rename from gramps2/src/GrampsGconfKeys.py rename to gramps2/src/Config/_GrampsGconfKeys.py diff --git a/gramps2/src/GrampsIniKeys.py b/gramps2/src/Config/_GrampsIniKeys.py similarity index 100% rename from gramps2/src/GrampsIniKeys.py rename to gramps2/src/Config/_GrampsIniKeys.py diff --git a/gramps2/src/GrampsKeys.py b/gramps2/src/Config/__init__.py similarity index 72% rename from gramps2/src/GrampsKeys.py rename to gramps2/src/Config/__init__.py index dbb941d7d..e42a9e127 100644 --- a/gramps2/src/GrampsKeys.py +++ b/gramps2/src/Config/__init__.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2004-2006 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,8 +18,14 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id: __init__.py 5872 2006-02-03 15:49:59Z hippy $ + +""" +This package implements access to GRAMPS configuration. +It provides the choice between different storage backends. +""" try: - from GrampsGconfKeys import * + from _GrampsGconfKeys import * except: - from GrampsIniKeys import * + from _GrampsIniKeys import * diff --git a/gramps2/src/DateHandler.py b/gramps2/src/DateHandler.py index be366314d..653a924a0 100644 --- a/gramps2/src/DateHandler.py +++ b/gramps2/src/DateHandler.py @@ -126,11 +126,11 @@ except: parser = _lang_to_parser["C"]() try: - import GrampsKeys - val = GrampsKeys.get_date_format(_lang_to_display[_lang].formats) + import Config + val = Config.get_date_format(_lang_to_display[_lang].formats) except: try: - val = GrampsKeys.get_date_format(_lang_to_display["C"].formats) + val = Config.get_date_format(_lang_to_display["C"].formats) except: val = 0 diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index 24d7b58a7..d72ebaa87 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -41,7 +41,7 @@ import gtk # #------------------------------------------------------------------------- import GrampsDb -import GrampsKeys +import Config import NameDisplay import GrampsMime import const @@ -609,7 +609,7 @@ class DisplayState(GrampsDb.GrampsDBCallback): if self.dbstate.active == None: self.status.push(self.status_id,"") else: - if GrampsKeys.get_statusbar() <= 1: + if Config.get_statusbar() <= 1: pname = NameDisplay.displayer.display(self.dbstate.active) name = "[%s] %s" % (self.dbstate.active.get_gramps_id(),pname) else: diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 613359b8c..4db24ca42 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -46,7 +46,7 @@ import gtk.gdk #------------------------------------------------------------------------- import const import Utils -import GrampsKeys +import Config import GrampsMime import RelLib import DateHandler diff --git a/gramps2/src/EditPrimary.py b/gramps2/src/EditPrimary.py index 8a949c671..6c713ccc3 100644 --- a/gramps2/src/EditPrimary.py +++ b/gramps2/src/EditPrimary.py @@ -25,7 +25,7 @@ from gettext import gettext as _ import DisplayState import DateHandler import NameDisplay -import GrampsKeys +import Config import GrampsDisplay import Utils @@ -119,7 +119,7 @@ class EditPrimary(DisplayState.ManagedWindow): def delete_event(self,*obj): """If the data has changed, give the user a chance to cancel the close window""" - if not GrampsKeys.get_dont_ask() and self.data_has_changed(): + if not Config.get_dont_ask() and self.data_has_changed(): SaveDialog( _('Save Changes?'), _('If you close without saving, the changes you ' diff --git a/gramps2/src/EditSecondary.py b/gramps2/src/EditSecondary.py index 0b18b4d92..6f95b5e06 100644 --- a/gramps2/src/EditSecondary.py +++ b/gramps2/src/EditSecondary.py @@ -23,7 +23,7 @@ from gettext import gettext as _ import DisplayState -import GrampsKeys +import Config import GrampsDisplay import Utils diff --git a/gramps2/src/Exporter.py b/gramps2/src/Exporter.py index 970a3942a..5ecfe3f39 100644 --- a/gramps2/src/Exporter.py +++ b/gramps2/src/Exporter.py @@ -46,7 +46,7 @@ import const import Utils import PluginMgr import QuestionDialog -import GrampsKeys +import Config import GrampsDisplay import Assistant @@ -161,7 +161,7 @@ class Exporter: Depending on the success status, set the text for the final page. """ filename = self.chooser.get_filename() - GrampsKeys.save_last_export_dir(os.path.split(filename)[0]) + Config.save_last_export_dir(os.path.split(filename)[0]) ix = self.get_selected_format_index() self.pre_save() if self.exports[ix][3]: @@ -296,9 +296,9 @@ class Exporter: ext = self.exports[ix][4] # Suggested folder: try last export, then last import, then home. - default_dir = GrampsKeys.get_last_export_dir() + default_dir = Config.get_last_export_dir() if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_import_dir() + default_dir = Config.get_last_import_dir() if len(default_dir)<=1: default_dir = '~/' diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 57e2eec27..dddb5f9ba 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -29,7 +29,7 @@ import Utils import DateHandler import ImgManip import ReportUtils -import GrampsKeys +import Config import GrampsWidgets import Errors @@ -85,10 +85,10 @@ class FamilyView(PageView.PersonNavView): PageView.PersonNavView.__init__(self,'Relationship View',dbstate,uistate) dbstate.connect('database-changed',self.change_db) dbstate.connect('active-changed',self.change_person) - self.show_siblings = GrampsKeys.get_family_siblings() + self.show_siblings = Config.get_family_siblings() if self.show_siblings == None: self.show_siblings = True - self.show_details = GrampsKeys.get_family_details() + self.show_details = Config.get_family_details() if self.show_details == None: self.show_details = True @@ -159,12 +159,12 @@ class FamilyView(PageView.PersonNavView): def siblings_toggle(self,obj): self.show_siblings = obj.get_active() self.change_person(self.dbstate.active.handle) - GrampsKeys.save_family_siblings(self.show_siblings) + Config.save_family_siblings(self.show_siblings) def details_toggle(self,obj): self.show_details = obj.get_active() self.change_person(self.dbstate.active.handle) - GrampsKeys.save_family_details(self.show_details) + Config.save_family_details(self.show_details) def change_db(self,db): if self.child: diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 4ff694637..adf2f6b40 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -43,7 +43,7 @@ import gtk.glade # gramps modules # #------------------------------------------------------------------------- -import GrampsKeys +import Config import RelLib import const import Utils @@ -84,10 +84,10 @@ panellist = [ def set_calendar_date_format(): format_list = DateHandler.get_date_formats() - DateHandler.set_format(GrampsKeys.get_date_format(format_list)) + DateHandler.set_format(Config.get_date_format(format_list)) def _update_calendar_date_format(active,dlist): - GrampsKeys.save_date_format(active,dlist) + Config.save_date_format(active,dlist) DateHandler.set_format(active) #------------------------------------------------------------------------- @@ -123,14 +123,14 @@ def loadConfig(): # #------------------------------------------------------------------------- def get_researcher(): - 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() + n = Config.get_researcher_name() + a = Config.get_researcher_addr() + c = Config.get_researcher_city() + s = Config.get_researcher_state() + ct = Config.get_researcher_country() + p = Config.get_researcher_postal() + ph = Config.get_researcher_phone() + e = Config.get_researcher_email() owner = RelLib.Researcher() owner.set(n,a,c,s,ct,p,ph,e) @@ -186,67 +186,67 @@ class GrampsPreferences: def build(self): auto = self.top.get_widget("autoload") - auto.set_active(GrampsKeys.get_autoload()) + auto.set_active(Config.get_autoload()) auto.connect('toggled', - lambda obj: GrampsKeys.save_autoload(obj.get_active())) + lambda obj: Config.save_autoload(obj.get_active())) spell = self.top.get_widget("spellcheck") - spell.set_active(GrampsKeys.get_spellcheck()) + spell.set_active(Config.get_spellcheck()) spell.connect('toggled', - lambda obj: GrampsKeys.save_spellcheck(obj.get_active())) + lambda obj: Config.save_spellcheck(obj.get_active())) lds = self.top.get_widget("uselds") - lds.set_active(GrampsKeys.get_uselds()) + lds.set_active(Config.get_uselds()) lds.connect('toggled', - lambda obj: GrampsKeys.save_uselds(obj.get_active())) + lambda obj: Config.save_uselds(obj.get_active())) self.ipr = self.top.get_widget("iprefix") - self.ipr.set_text(GrampsKeys.get_person_id_prefix()) + self.ipr.set_text(Config.get_person_id_prefix()) self.opr = self.top.get_widget("oprefix") - self.opr.set_text(GrampsKeys.get_object_id_prefix()) + self.opr.set_text(Config.get_object_id_prefix()) self.fpr = self.top.get_widget("fprefix") - self.fpr.set_text(GrampsKeys.get_family_id_prefix()) + self.fpr.set_text(Config.get_family_id_prefix()) self.spr = self.top.get_widget("sprefix") - self.spr.set_text(GrampsKeys.get_source_id_prefix()) + self.spr.set_text(Config.get_source_id_prefix()) self.ppr = self.top.get_widget("pprefix") - self.ppr.set_text(GrampsKeys.get_place_id_prefix()) + self.ppr.set_text(Config.get_place_id_prefix()) sb2 = self.top.get_widget("stat2") sb3 = self.top.get_widget("stat3") - if GrampsKeys.get_statusbar() == 0 or GrampsKeys.get_statusbar() == 1: + if Config.get_statusbar() == 0 or Config.get_statusbar() == 1: sb2.set_active(1) else: sb3.set_active(1) sb2.connect('toggled', - lambda obj: GrampsKeys.save_statusbar(2-obj.get_active())) + lambda obj: Config.save_statusbar(2-obj.get_active())) toolbarmenu = self.top.get_widget("tooloptmenu") - toolbarmenu.set_active(GrampsKeys.get_toolbar()+1) + toolbarmenu.set_active(Config.get_toolbar()+1) toolbarmenu.connect('changed', - lambda obj: GrampsKeys.save_toolbar(obj.get_active()-1)) + lambda obj: Config.save_toolbar(obj.get_active()-1)) pvbutton = self.top.get_widget('pvbutton') fvbutton = self.top.get_widget('fvbutton') - if GrampsKeys.get_default_view() == 0: + if Config.get_default_view() == 0: pvbutton.set_active(1) else: fvbutton.set_active(1) fvbutton.connect('toggled', - lambda obj: GrampsKeys.save_default_view(obj.get_active())) + lambda obj: Config.save_default_view(obj.get_active())) familyview1 = self.top.get_widget('familyview1') familyview2 = self.top.get_widget('familyview2') - if GrampsKeys.get_family_view() == 0: + if Config.get_family_view() == 0: familyview1.set_active(1) else: familyview2.set_active(1) familyview2.connect('toggled', - lambda obj: GrampsKeys.save_family_view(obj.get_active())) + lambda obj: Config.save_family_view(obj.get_active())) usetips = self.top.get_widget('usetips') - usetips.set_active(GrampsKeys.get_usetips()) + usetips.set_active(Config.get_usetips()) usetips.connect('toggled', - lambda obj: GrampsKeys.save_usetips(obj.get_active())) + lambda obj: Config.save_usetips(obj.get_active())) lastnamegen_obj = self.top.get_widget("lastnamegen") cell = gtk.CellRendererText() @@ -257,10 +257,10 @@ class GrampsPreferences: for name in _surname_styles: store.append(row=[name]) lastnamegen_obj.set_model(store) - lastnamegen_obj.set_active(GrampsKeys.get_lastnamegen(_surname_styles)) + lastnamegen_obj.set_active(Config.get_lastnamegen(_surname_styles)) lastnamegen_obj.connect("changed", lambda obj: - GrampsKeys.save_lastnamegen(obj.get_active(),_surname_styles) + Config.save_lastnamegen(obj.get_active(),_surname_styles) ) date_option = self.top.get_widget("date_format") @@ -276,7 +276,7 @@ class GrampsPreferences: try: # Technically, a selected format might be out of range # for this locale's format list. - date_option.set_active(GrampsKeys.get_date_format(dlist)) + date_option.set_active(Config.get_date_format(dlist)) except: date_option.set_active(0) @@ -286,37 +286,37 @@ class GrampsPreferences: ) resname = self.top.get_widget("resname") - resname.set_text(GrampsKeys.get_researcher_name()) + resname.set_text(Config.get_researcher_name()) resname.connect('changed', - lambda obj: GrampsKeys.save_researcher_name(obj.get_text())) + lambda obj: Config.save_researcher_name(obj.get_text())) resaddr = self.top.get_widget("resaddr") - resaddr.set_text(GrampsKeys.get_researcher_addr()) + resaddr.set_text(Config.get_researcher_addr()) resaddr.connect('changed', - lambda obj: GrampsKeys.save_researcher_addr(obj.get_text())) + lambda obj: Config.save_researcher_addr(obj.get_text())) rescity = self.top.get_widget("rescity") - rescity.set_text(GrampsKeys.get_researcher_city()) + rescity.set_text(Config.get_researcher_city()) rescity.connect('changed', - lambda obj: GrampsKeys.save_researcher_city(obj.get_text())) + lambda obj: Config.save_researcher_city(obj.get_text())) resstate = self.top.get_widget("resstate") - resstate.set_text(GrampsKeys.get_researcher_state()) + resstate.set_text(Config.get_researcher_state()) resstate.connect('changed', - lambda obj: GrampsKeys.save_researcher_state(obj.get_text())) + lambda obj: Config.save_researcher_state(obj.get_text())) rescountry = self.top.get_widget("rescountry") - rescountry.set_text(GrampsKeys.get_researcher_country()) + rescountry.set_text(Config.get_researcher_country()) rescountry.connect('changed', - lambda obj: GrampsKeys.save_researcher_country(obj.get_text())) + lambda obj: Config.save_researcher_country(obj.get_text())) respostal = self.top.get_widget("respostal") - respostal.set_text(GrampsKeys.get_researcher_postal()) + respostal.set_text(Config.get_researcher_postal()) respostal.connect('changed', - lambda obj: GrampsKeys.save_researcher_postal(obj.get_text())) + lambda obj: Config.save_researcher_postal(obj.get_text())) resphone = self.top.get_widget("resphone") - resphone.set_text(GrampsKeys.get_researcher_phone()) + resphone.set_text(Config.get_researcher_phone()) resphone.connect('changed', - lambda obj: GrampsKeys.save_researcher_phone(obj.get_text())) + lambda obj: Config.save_researcher_phone(obj.get_text())) resemail = self.top.get_widget("resemail") - resemail.set_text(GrampsKeys.get_researcher_email()) + resemail.set_text(Config.get_researcher_email()) resemail.connect('changed', - lambda obj: GrampsKeys.save_researcher_email(obj.get_text())) + lambda obj: Config.save_researcher_email(obj.get_text())) def save_prefix(self): """ Validate the GRAMPS ID definitions to be usable""" @@ -365,11 +365,11 @@ class GrampsPreferences: self.window) return False - GrampsKeys.save_iprefix(ip) - GrampsKeys.save_oprefix(op) - GrampsKeys.save_fprefix(fp) - GrampsKeys.save_sprefix(sp) - GrampsKeys.save_pprefix(pp) + Config.save_iprefix(ip) + Config.save_oprefix(op) + Config.save_fprefix(fp) + Config.save_sprefix(sp) + Config.save_pprefix(pp) return True def select(self,obj): diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index 8a4099402..1b1209a27 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -47,7 +47,7 @@ log = logging.getLogger(".GrampsDb") # #------------------------------------------------------------------------- from RelLib import * -import GrampsKeys +import Config from _GrampsDBCallback import GrampsDBCallback #------------------------------------------------------------------------- @@ -216,13 +216,13 @@ class GrampsDbBase(GrampsDBCallback): self.family_attributes = sets.Set() self.marker_names = sets.Set() - 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.set_repository_id_prefix(GrampsKeys.get_repository_id_prefix()) + self.set_person_id_prefix(Config.get_person_id_prefix()) + self.set_object_id_prefix(Config.get_object_id_prefix()) + self.set_family_id_prefix(Config.get_family_id_prefix()) + self.set_source_id_prefix(Config.get_source_id_prefix()) + self.set_place_id_prefix(Config.get_place_id_prefix()) + self.set_event_id_prefix(Config.get_event_id_prefix()) + self.set_repository_id_prefix(Config.get_repository_id_prefix()) self.open = 0 self.genderStats = GenderStats() diff --git a/gramps2/src/ImgManip.py b/gramps2/src/ImgManip.py index 5994d7049..a13091d35 100644 --- a/gramps2/src/ImgManip.py +++ b/gramps2/src/ImgManip.py @@ -26,7 +26,7 @@ import gtk import gobject import GrampsMime -import GrampsKeys +import Config import Utils class ImgManip: @@ -112,8 +112,8 @@ def run_thumbnailer(mtype, frm, to, size=const.thumbScale): } base = '/desktop/gnome/thumbnailers/%s' % mtype.replace('/','@') - cmd = GrampsKeys.client.get_string(base + '/command') - enable = GrampsKeys.client.get_bool(base + '/enable') + cmd = Config.client.get_string(base + '/command') + enable = Config.client.get_bool(base + '/enable') if cmd and enable: cmdlist = map(lambda x: sublist.get(x,x),cmd.split()) diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 37ff36f6f..6a148eebc 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -55,7 +55,7 @@ from gettext import gettext as _ #------------------------------------------------------------------------- import const import Utils -import GrampsKeys +import Config import Errors import Report import Tool @@ -323,10 +323,10 @@ class PluginStatus(DisplayState.ManagedWindow): self.window.set_title("%s - GRAMPS" % _('Plugin status')) window = self.glade.get_widget("text") self.pop_button = self.glade.get_widget("pop_button") - self.pop_button.set_active(GrampsKeys.get_pop_plugin_status()) + self.pop_button.set_active(Config.get_pop_plugin_status()) self.pop_button.connect('toggled', - lambda obj: GrampsKeys.save_pop_plugin_status(self.pop_button.get_active())) - GrampsKeys.client.notify_add("/apps/gramps/behavior/pop-plugin-status", + lambda obj: Config.save_pop_plugin_status(self.pop_button.get_active())) + Config.client.notify_add("/apps/gramps/behavior/pop-plugin-status", self.pop_button_update) self.glade.signal_autoconnect({ 'on_close_clicked' : self.close, @@ -366,7 +366,7 @@ class PluginStatus(DisplayState.ManagedWindow): GrampsDisplay.help('gramps-getting-started') def pop_button_update(self, client,cnxn_id,entry,data): - self.pop_button.set_active(GrampsKeys.get_pop_plugin_status()) + self.pop_button.set_active(Config.get_pop_plugin_status()) #------------------------------------------------------------------------- # @@ -462,7 +462,7 @@ class GrampsTextFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsKeys.get_output_preference() + out_pref = Config.get_output_preference() index = 0 PluginMgr.textdoc_list.sort() active_index = 0 @@ -510,7 +510,7 @@ class GrampsDrawFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsKeys.get_output_preference() + out_pref = Config.get_output_preference() index = 0 PluginMgr.drawdoc_list.sort() active_index = 0 @@ -558,7 +558,7 @@ class GrampsBookFormatComboBox(gtk.ComboBox): self.pack_start(cell,True) self.add_attribute(cell,'text',0) - out_pref = GrampsKeys.get_output_preference() + out_pref = Config.get_output_preference() index = 0 PluginMgr.drawdoc_list.sort() active_index = 0 @@ -683,7 +683,7 @@ class Reload(Tool.Tool): except: PluginMgr.failmsg_list.append((filename,sys.exc_info())) - if GrampsKeys.get_pop_plugin_status() and len(PluginMgr.failmsg_list): + if Config.get_pop_plugin_status() and len(PluginMgr.failmsg_list): PluginStatus() else: global status_up diff --git a/gramps2/src/QuestionDialog.py b/gramps2/src/QuestionDialog.py index bc6415816..cb245ddfe 100644 --- a/gramps2/src/QuestionDialog.py +++ b/gramps2/src/QuestionDialog.py @@ -42,7 +42,7 @@ from gtk.gdk import pixbuf_new_from_file # #------------------------------------------------------------------------- import const -import GrampsKeys +import Config try: ICON = pixbuf_new_from_file(const.icon) @@ -74,7 +74,7 @@ class SaveDialog: elif response == gtk.RESPONSE_YES: self.task2() - GrampsKeys.save_dont_ask(self.dontask.get_active()) + Config.save_dont_ask(self.dontask.get_active()) self.top.destroy() class QuestionDialog: diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index b45153da6..ae4dac1e5 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -56,7 +56,7 @@ import Plugins import PluginMgr import BaseDoc import StyleEditor -import GrampsKeys +import Config import PaperMenu import Errors import GenericFilter @@ -1086,7 +1086,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 GrampsKeys.get_report_dir() + return Config.get_report_dir() def set_default_directory(self, value): """Save the name of the current directory, so that any future @@ -1096,7 +1096,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.""" - GrampsKeys.save_report_dir(value) + Config.save_report_dir(value) #------------------------------------------------------------------------ # diff --git a/gramps2/src/ReportOptions.py b/gramps2/src/ReportOptions.py index 56764ced7..317536d0c 100644 --- a/gramps2/src/ReportOptions.py +++ b/gramps2/src/ReportOptions.py @@ -48,7 +48,7 @@ except: # #------------------------------------------------------------------------- import const -import GrampsKeys +import Config import Utils import BaseDoc import Options @@ -168,7 +168,7 @@ class OptionListCollection(Options.OptionListCollection): def init_common(self): # Default values for common options self.default_style_name = "default" - self.default_paper_name = GrampsKeys.get_paper_preference() + self.default_paper_name = Config.get_paper_preference() self.default_template_name = "" self.default_orientation = BaseDoc.PAPER_PORTRAIT self.default_format_name = 'print' diff --git a/gramps2/src/Spell.py b/gramps2/src/Spell.py index 56a201d9e..9185748d7 100644 --- a/gramps2/src/Spell.py +++ b/gramps2/src/Spell.py @@ -27,7 +27,7 @@ present, we default to no spell checking. """ -import GrampsKeys +import Config from gettext import gettext as _ @@ -66,7 +66,7 @@ except SystemError,msg: class Spell: def __init__(self,obj): - if success and GrampsKeys.get_spellcheck(): + if success and Config.get_spellcheck(): self.spell = gtkspell.Spell(obj) lang = locale.getlocale()[0] self.spell.set_language(lang) diff --git a/gramps2/src/StartupDialog.py b/gramps2/src/StartupDialog.py index d69731ad0..739ada963 100644 --- a/gramps2/src/StartupDialog.py +++ b/gramps2/src/StartupDialog.py @@ -43,7 +43,7 @@ import gtk.glade import Assistant import const -import GrampsKeys +import Config from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- @@ -53,7 +53,7 @@ from QuestionDialog import ErrorDialog #------------------------------------------------------------------------- def need_to_run(): - val = GrampsKeys.get_startup() + val = Config.get_startup() if val < const.startup: return True return False @@ -68,34 +68,34 @@ def upgrade_prefs(): client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) - GrampsKeys.save_fprefix(client.get_string('/apps/gramps/fprefix')) - GrampsKeys.save_sprefix(client.get_string('/apps/gramps/sprefix')) - GrampsKeys.save_pprefix(client.get_string('/apps/gramps/pprefix')) - GrampsKeys.save_oprefix(client.get_string('/apps/gramps/oprefix')) - GrampsKeys.save_iprefix(client.get_string('/apps/gramps/iprefix')) + Config.save_fprefix(client.get_string('/apps/gramps/fprefix')) + Config.save_sprefix(client.get_string('/apps/gramps/sprefix')) + Config.save_pprefix(client.get_string('/apps/gramps/pprefix')) + Config.save_oprefix(client.get_string('/apps/gramps/oprefix')) + Config.save_iprefix(client.get_string('/apps/gramps/iprefix')) - GrampsKeys.save_researcher_country(client.get_string('/apps/gramps/researcher-country')) - GrampsKeys.save_researcher_email(client.get_string('/apps/gramps/researcher-email')) - GrampsKeys.save_researcher_phone(client.get_string('/apps/gramps/researcher-phone')) - GrampsKeys.save_researcher_city(client.get_string('/apps/gramps/researcher-city')) - GrampsKeys.save_researcher_postal(client.get_string('/apps/gramps/researcher-postal')) - GrampsKeys.save_researcher_addr(client.get_string('/apps/gramps/researcher-addr')) - GrampsKeys.save_researcher_state(client.get_string('/apps/gramps/researcher-state')) - GrampsKeys.save_researcher_name(client.get_string('/apps/gramps/researcher-name')) + Config.save_researcher_country(client.get_string('/apps/gramps/researcher-country')) + Config.save_researcher_email(client.get_string('/apps/gramps/researcher-email')) + Config.save_researcher_phone(client.get_string('/apps/gramps/researcher-phone')) + Config.save_researcher_city(client.get_string('/apps/gramps/researcher-city')) + Config.save_researcher_postal(client.get_string('/apps/gramps/researcher-postal')) + Config.save_researcher_addr(client.get_string('/apps/gramps/researcher-addr')) + Config.save_researcher_state(client.get_string('/apps/gramps/researcher-state')) + Config.save_researcher_name(client.get_string('/apps/gramps/researcher-name')) - GrampsKeys.save_family_view(client.get_int('/apps/gramps/familyview')) - GrampsKeys.save_default_view(client.get_int('/apps/gramps/defaultview')) - GrampsKeys.save_autoload(client.get_bool('/apps/gramps/autoload')) - GrampsKeys.save_uselds(client.get_bool('/apps/gramps/use-lds')) - GrampsKeys.save_statusbar(client.get_int('/apps/gramps/statusbar')) - GrampsKeys.save_view(not client.get_bool('/apps/gramps/view')) - GrampsKeys.save_screen_size_checked(client.get_bool('/apps/gramps/screen-size-checked')) - GrampsKeys.save_lastnamegen(client.get_int('/apps/gramps/surname-guessing')) + Config.save_family_view(client.get_int('/apps/gramps/familyview')) + Config.save_default_view(client.get_int('/apps/gramps/defaultview')) + Config.save_autoload(client.get_bool('/apps/gramps/autoload')) + Config.save_uselds(client.get_bool('/apps/gramps/use-lds')) + Config.save_statusbar(client.get_int('/apps/gramps/statusbar')) + Config.save_view(not client.get_bool('/apps/gramps/view')) + Config.save_screen_size_checked(client.get_bool('/apps/gramps/screen-size-checked')) + Config.save_lastnamegen(client.get_int('/apps/gramps/surname-guessing')) toolbar = client.get_int('/apps/gramps/toolbar') if toolbar == 5: toolbar = -1 - GrampsKeys.save_toolbar(toolbar) - GrampsKeys.save_toolbar_on(client.get_bool('/apps/gramps/toolbar-on')) + Config.save_toolbar(toolbar) + Config.save_toolbar_on(client.get_bool('/apps/gramps/toolbar-on')) return True except: return False @@ -113,7 +113,7 @@ class StartupDialog: self.args = args if not const.no_gconf and upgrade_prefs(): - GrampsKeys.save_startup(const.startup) + Config.save_startup(const.startup) self.close(None) return self.w = Assistant.Assistant(self.complete) @@ -149,19 +149,19 @@ class StartupDialog: self.task(self.args) def complete(self): - 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())) + Config.save_researcher_name(unicode(self.name.get_text())) + Config.save_researcher_addr(unicode(self.addr.get_text())) + Config.save_researcher_city(unicode(self.city.get_text())) + Config.save_researcher_state(unicode(self.state.get_text())) + Config.save_researcher_postal(unicode(self.postal.get_text())) + Config.save_researcher_country(unicode(self.country.get_text())) + Config.save_researcher_phone(unicode(self.phone.get_text())) + Config.save_researcher_email(unicode(self.email.get_text())) - GrampsKeys.save_uselds(self.lds.get_active()) - GrampsKeys.save_startup(const.startup) + Config.save_uselds(self.lds.get_active()) + Config.save_startup(const.startup) self.w.destroy() - GrampsKeys.sync() + Config.sync() self.task(self.args) def build_page2(self): @@ -193,7 +193,7 @@ class StartupDialog: box.add(table) box.show_all() - name = GrampsKeys.get_researcher_name() + name = Config.get_researcher_name() if not name or name.strip() == "": try: import pwd @@ -205,13 +205,13 @@ class StartupDialog: self.name.set_text(name) try: - 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()) + self.addr.set_text(Config.get_researcher_addr()) + self.city.set_text(Config.get_researcher_city()) + self.state.set_text(Config.get_researcher_state()) + self.postal.set_text(Config.get_researcher_postal()) + self.country.set_text(Config.get_researcher_country()) + self.phone.set_text(Config.get_researcher_phone()) + self.email.set_text(Config.get_researcher_email()) except: ErrorDialog(_("Configuration/Installation error"), _("The gconf schemas were not found. First, try " @@ -244,7 +244,7 @@ class StartupDialog: self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support")) - self.lds.set_active(GrampsKeys.get_uselds()) + self.lds.set_active(Config.get_uselds()) align.add(self.lds) diff --git a/gramps2/src/TipOfDay.py b/gramps2/src/TipOfDay.py index a5ab4e50e..25efdaf26 100644 --- a/gramps2/src/TipOfDay.py +++ b/gramps2/src/TipOfDay.py @@ -43,7 +43,7 @@ import gtk.glade # #------------------------------------------------------------------------- import const -import GrampsKeys +import Config import Utils #------------------------------------------------------------------------- @@ -64,7 +64,7 @@ class TipOfDay: tp = TipParser() tip_list = tp.get() - use.set_active(GrampsKeys.get_usetips()) + use.set_active(Config.get_usetips()) new_index = range(len(tip_list)) Random().shuffle(new_index) @@ -82,7 +82,7 @@ class TipOfDay: else: index += 1 - GrampsKeys.save_usetips(use.get_active()) + Config.save_usetips(use.get_active()) top.destroy() #------------------------------------------------------------------------- diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index 5833b209c..875a76e6d 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -48,7 +48,7 @@ import DisplayState import const import PluginMgr import Plugins -import GrampsKeys +import Config import GrampsDb import GrampsCfg import Errors @@ -63,7 +63,7 @@ import NameDisplay import Tool import Report import GrampsMime -import GrampsKeys +import Config import GrampsWidgets #------------------------------------------------------------------------- @@ -169,8 +169,8 @@ class ViewManager: self.window.connect('destroy', self.quit) try: - width = GrampsKeys.get_width() - height = GrampsKeys.get_height() + width = Config.get_width() + height = Config.get_height() self.window.set_default_size(width,height) except: self.window.set_default_size(775,500) @@ -188,10 +188,10 @@ class ViewManager: hbox.pack_start(self.ebox,False) hbox.show_all() - self.show_sidebar = GrampsKeys.get_view() + self.show_sidebar = Config.get_view() if self.show_sidebar == None: self.show_sidebar = True - self.show_toolbar = GrampsKeys.get_toolbar() + self.show_toolbar = Config.get_toolbar() if self.show_toolbar == None: self.show_toolbar = True @@ -272,16 +272,16 @@ class ViewManager: self.uistate.status_text(_('Loading plugins...')) error |= PluginMgr.load_plugins(const.pluginsDir) error |= PluginMgr.load_plugins(os.path.expanduser("~/.gramps/plugins")) - if GrampsKeys.get_pop_plugin_status() and error: + if Config.get_pop_plugin_status() and error: Plugins.PluginStatus(self) self.uistate.push_message(_('Ready')) def quit(self,obj=None): self.state.db.close() (width,height) = self.window.get_size() - GrampsKeys.save_width(width) - GrampsKeys.save_height(height) - GrampsKeys.sync() + Config.save_width(width) + Config.save_height(height) + Config.sync() gtk.main_quit() def build_ui_manager(self): @@ -419,21 +419,21 @@ class ViewManager: if obj.get_active(): self.ebox.show() self.notebook.set_show_tabs(False) - GrampsKeys.save_view(True) + Config.save_view(True) else: self.ebox.hide() self.notebook.set_show_tabs(True) - GrampsKeys.save_view(False) - GrampsKeys.sync() + Config.save_view(False) + Config.sync() def toolbar_toggle(self,obj): if obj.get_active(): self.toolbar.show() - GrampsKeys.save_toolbar(True) + Config.save_toolbar(True) else: self.toolbar.hide() - GrampsKeys.save_toolbar(False) - GrampsKeys.sync() + Config.save_toolbar(False) + Config.sync() def register_view(self, view): self.views.append(view) @@ -554,11 +554,11 @@ class ViewManager: # Suggested folder: try last open file, last import, last export, # then home. - default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_import_dir() + default_dir = Config.get_last_import_dir() if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_export_dir() + default_dir = Config.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -627,11 +627,11 @@ class ViewManager: # Suggested folder: try last open file, import, then last export, # then home. - default_dir = os.path.split(GrampsKeys.get_lastfile())[0] + os.path.sep + default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_import_dir() + default_dir = Config.get_last_import_dir() if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_export_dir() + default_dir = Config.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -673,7 +673,7 @@ class ViewManager: """ (the_path,the_file) = os.path.split(filename) - GrampsKeys.save_last_import_dir(the_path) + Config.save_last_import_dir(the_path) success = False if filetype == const.app_gramps: @@ -735,7 +735,7 @@ class ViewManager: msg = "%s - GRAMPS" % name self.uistate.window.set_title(msg) else: - GrampsKeys.save_last_file("") + Config.save_last_file("") QuestionDialog.ErrorDialog(_('Cannot open database'), _('The database file specified could not be opened.')) return False @@ -789,7 +789,7 @@ class ViewManager: self.state.db.request_rebuild() - GrampsKeys.save_last_file(name) + Config.save_last_file(name) self.relationship = self.RelClass(self.state.db) self.state.change_active_person(self.state.db.find_initial_person()) @@ -900,12 +900,12 @@ class ViewManager: # Suggested folder: try last open file, import, then last export, # then home. - default_dir = GrampsKeys.get_last_import_dir() + default_dir = Config.get_last_import_dir() if len(default_dir)<=1: - base_path = os.path.split(GrampsKeys.get_lastfile())[0] + base_path = os.path.split(Config.get_lastfile())[0] default_dir = base_path + os.path.sep if len(default_dir)<=1: - default_dir = GrampsKeys.get_last_export_dir() + default_dir = Config.get_last_export_dir() if len(default_dir)<=1: default_dir = '~/' @@ -934,7 +934,7 @@ class ViewManager: # Then we try all the known plugins (the_path,the_file) = os.path.split(filename) - GrampsKeys.save_last_import_dir(the_path) + Config.save_last_import_dir(the_path) for (importData,mime_filter,mime_type, native_format,format_name) in PluginMgr.import_list: if filetype == mime_type or the_file == mime_type: diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 3264d8231..3dc2c4bdb 100644 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -50,7 +50,7 @@ import EventView import SourceView import MediaView import ArgHandler -import GrampsKeys +import Config import GrampsCfg import const import Errors @@ -174,26 +174,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. - GrampsKeys.client.notify_add("/apps/gramps/researcher", + Config.client.notify_add("/apps/gramps/researcher", self.researcher_key_update) - GrampsKeys.client.notify_add("/apps/gramps/interface/statusbar", + Config.client.notify_add("/apps/gramps/interface/statusbar", self.statusbar_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar", +# Config.client.notify_add("/apps/gramps/interface/toolbar", ## self.toolbar_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar-on", +# Config.client.notify_add("/apps/gramps/interface/toolbar-on", # self.toolbar_on_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/interface/filter", +# Config.client.notify_add("/apps/gramps/interface/filter", # self.filter_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/interface/view", +# Config.client.notify_add("/apps/gramps/interface/view", # self.sidebar_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/interface/familyview", +# Config.client.notify_add("/apps/gramps/interface/familyview", # self.familyview_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/preferences/name-format", +# Config.client.notify_add("/apps/gramps/preferences/name-format", # self.familyview_key_update) -# GrampsKeys.client.notify_add("/apps/gramps/preferences/date-format", +# Config.client.notify_add("/apps/gramps/preferences/date-format", # self.date_format_key_update) - if GrampsKeys.get_usetips(): + if Config.get_usetips(): TipOfDay.TipOfDay(vm.uistate) ## # FIXME: THESE will have to be added (ViewManager?) @@ -203,7 +203,7 @@ class Gramps: ## self.db.connect('person-update',self.on_update_bookmark) def welcome(self): - if GrampsKeys.get_welcome() >= 200: + if Config.get_welcome() >= 200: return glade = gtk.glade.XML(const.gladeFile,'scrollmsg') @@ -243,23 +243,23 @@ class Gramps: top.run() top.destroy() - GrampsKeys.save_welcome(200) - GrampsKeys.sync() + Config.save_welcome(200) + Config.sync() def researcher_key_update(self,client,cnxn_id,entry,data): pass -# 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()) +# self.db.set_person_id_prefix(Config.get_person_id_prefix()) +# self.db.set_family_id_prefix(Config.get_family_id_prefix()) +# self.db.set_source_id_prefix(Config.get_source_id_prefix()) +# self.db.set_object_id_prefix(Config.get_object_id_prefix()) +# self.db.set_place_id_prefix(Config.get_place_id_prefix()) +# self.db.set_event_id_prefix(Config.get_event_id_prefix()) def statusbar_key_update(self,client,cnxn_id,entry,data): self.modify_statusbar() def toolbar_key_update(self,client,cnxn_id,entry,data): - the_style = GrampsKeys.get_toolbar() + the_style = Config.get_toolbar() if the_style == -1: self.toolbar.unset_style() else: diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index 4fd770a71..58a14b5cf 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -913,8 +913,8 @@ class MediaPage(BasePage): def copy_preview_image(handle,photo): base = '/desktop/gnome/thumbnailers/%s' % mtype.replace('/','@') - thumbnailer = GrampsKeys.client.get_string(base + '/command') - enable = GrampsKeys.client.get_bool(base + '/enable') + thumbnailer = Config.client.get_string(base + '/command') + enable = Config.client.get_bool(base + '/enable') if thumbnailer and enable: run_thumbnailer(thumbnailer,path,_build_thumb_path(path),320) return path diff --git a/gramps2/src/plugins/WebPage.py b/gramps2/src/plugins/WebPage.py index 0dddd65a7..cec00a34c 100644 --- a/gramps2/src/plugins/WebPage.py +++ b/gramps2/src/plugins/WebPage.py @@ -49,7 +49,7 @@ import RelLib import HtmlDoc import BaseDoc import const -import GrampsKeys +import Config import GenericFilter import DateHandler import Sort