diff --git a/ChangeLog b/ChangeLog index 35945eac2..3143cff80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-07-19 Alex Roitman + * src/GrampsCfg.py: More re-work of gconf usage. + * src/StartupDialog.py: Access keys through GrampsCfg methods. + * src/TipOfDay.py: Access keys through GrampsCfg methods. + * src/gramps_main.py: More re-work of gconf usage. + * src/data/gramps.schemas: More re-work of gconf usage. + * src/gramps.glade: Hotkey corrections. + 2004-07-14 Alex Roitman * src/data/gramps.schemas: Cleanup. * src/data/Makefile.am: Clen up install rule. Add uninstall rule. diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index 842a97297..29e24ba56 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -126,136 +126,279 @@ panellist = [ #------------------------------------------------------------------------- # -# Obtain values from gconf keys +# Functions to obtain values from gconf keys +# and store values into gconf keys +# +# All gramps keys should be accessed through these functions! # #------------------------------------------------------------------------- -def get_usetips(): - return client.get_bool("/apps/gramps/use-tips") - -def get_betawarn(): - return client.get_bool("/apps/gramps/betawarn") - -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") - +# interface keys def get_default_view(): - return client.get_int("/apps/gramps/defaultview") + return get_int("/apps/gramps/interface/defaultview",(0,1)) + +def save_default_view(val): + set_int("/apps/gramps/interface/defaultview",val,(0,1)) def get_family_view(): - return client.get_int("/apps/gramps/familyview") + return get_int("/apps/gramps/interface/familyview",(0,1)) + +def save_family_view(val): + set_int("/apps/gramps/interface/familyview",val,(0,1)) + +def get_filter(): + return get_bool("/apps/gramps/interface/filter") + +def save_filter(val): + set_bool("/apps/gramps/interface/filter",val) + +def get_index_visible(): + return get_bool("/apps/gramps/interface/index-visible") + +def save_index_visible(val): + set_bool("/apps/gramps/interface/index-visible",val) + +def get_statusbar(): + return get_int("/apps/gramps/interface/statusbar",(0,1,2)) + +def save_statusbar(val): + set_int("/apps/gramps/interface/statusbar",val,(0,1,2)) + +def get_toolbar(): + return get_int("/apps/gramps/interface/toolbar",(0,1,2,3,5)) + +def save_toolbar(val): + set_int("/apps/gramps/interface/toolbar",val,(0,1,2,3,5)) + +def get_toolbar_on(): + return get_bool("/apps/gramps/interface/toolbar-on") + +def save_toolbar_on(val): + set_bool("/apps/gramps/interface/toolbar-on",val) + +def get_view(): + return get_bool("/apps/gramps/interface/view") + +def save_view(val): + set_bool("/apps/gramps/interface/view",val) + +# paths keys +def get_lastfile(): + return get_string("/apps/gramps/paths/recent-file") + +def save_last_file(val): + set_string("/apps/gramps/paths/recent-file",val) + +def get_report_dir(): + return get_string("/apps/gramps/paths/report-directory") + +def save_report_dir(val): + set_string_as_path("/apps/gramps/paths/report-directory",val) + +def get_web_dir(): + return get_string("/apps/gramps/paths/website-directory") + +def save_web_dir(val): + set_string_as_path("/apps/gramps/paths/website-directory",val) + +# behavior keys +def get_startup(): + return get_int("/apps/gramps/behavior/startup",(0,1)) + +def save_startup(val): + set_int("/apps/gramps/behavior/startup",val,(0,1)) + +def get_autoload(): + return get_bool("/apps/gramps/behavior/autoload") + +def save_autoload(val): + set_bool("/apps/gramps/behavior/autoload",val) + +def get_betawarn(): + return get_bool("/apps/gramps/behavior/betawarn") + +def save_betawarn(val): + set_bool("/apps/gramps/behavior/betawarn",val) + +def get_id_edit(): + return get_bool("/apps/gramps/behavior/id-edit") + +def save_id_edit(val): + set_bool("/apps/gramps/behavior/id-edit",val) + +def get_media_reference(): + return get_bool("/apps/gramps/behavior/make-reference") + +def save_media_reference(val): + set_bool("/apps/gramps/behavior/make-reference",val) + +def get_media_global(): + return get_bool("/apps/gramps/behavior/media-global") + +def save_media_global(val): + set_bool("/apps/gramps/behavior/media-global",val) + +def get_media_local(): + return get_bool("/apps/gramps/behavior/media-local") + +def save_media_local(val): + set_bool("/apps/gramps/behavior/media-local",val) + +def get_calendar(): + return get_bool("/apps/gramps/behavior/show-calendar") + +def save_calendar(val): + set_bool("/apps/gramps/behavior/show-calendar",val) + +def get_lastnamegen(): + return get_int("/apps/gramps/behavior/surname-guessing", + range(len(_surname_styles))) + +def save_lastnamegen(val): + set_int("/apps/gramps/behavior/surname-guessing",val, + range(len(_surname_styles))) + +def get_uselds(): + return get_bool("/apps/gramps/behavior/use-lds") + +def save_uselds(val): + set_bool("/apps/gramps/behavior/use-lds",val) + +def get_usetips(): + return get_bool("/apps/gramps/behavior/use-tips") + +def save_usetips(val): + set_bool("/apps/gramps/behavior/use-tips",val) + +# preferences keys +def get_iprefix(): + return get_string("/apps/gramps/preferences/iprefix") + +def save_iprefix(val): + set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val) + +def get_oprefix(): + return get_string("/apps/gramps/preferences/oprefix") + +def save_oprefix(val): + set_string_as_id_prefix("/apps/gramps/preferences/oprefix",val) + +def get_sprefix(): + return get_string("/apps/gramps/preferences/sprefix") + +def save_sprefix(val): + set_string_as_id_prefix("/apps/gramps/preferences/sprefix",val) + +def get_pprefix(): + return get_string("/apps/gramps/preferences/pprefix") + +def save_pprefix(val): + set_string_as_id_prefix("/apps/gramps/preferences/pprefix",val) + +def get_fprefix(): + return get_string("/apps/gramps/preferences/fprefix") + +def save_fprefix(val): + set_string_as_id_prefix("/apps/gramps/preferences/fprefix",val) + +def get_paper_preference(): + return get_string("/apps/gramps/preferences/paper-preference") + +def save_paper_preference(val): + set_string("/apps/gramps/preferences/paper-preference",val) + +def get_output_preference(): + return get_string("/apps/gramps/preferences/output-preference") + +def save_output_preference(val): + set_string("/apps/gramps/preferences/output-preference",val) + +def get_goutput_preference(): + return get_string("/apps/gramps/preferences/goutput-preference") + +def save_goutput_preference(val): + set_string("/apps/gramps/preferences/goutput-preference",val) def get_use_tips(): - return client.get_bool("/apps/gramps/use-tips") + return get_bool("/apps/gramps/preferences/use-tips") + +def save_use_tips(val): + set_bool("/apps/gramps/preferences/use-tips",val) def get_date_entry(): - return client.get_int("/apps/gramps/date-entry") + return get_int("/apps/gramps/preferences/date-entry", + range(len(_date_entry_list))) + +def save_date_entry(val): + set_int("/apps/gramps/preferences/date-entry",val, + range(len(_date_entry_list))) def get_date_format(): - return client.get_int("/apps/gramps/date-format") + return get_int("/apps/gramps/preferences/date-format", + range(len(_date_format_list))) + +def save_date_format(val): + set_int("/apps/gramps/preferences/date-format",val, + range(len(_date_format_list))) def get_name_format(): - return client.get_int("/apps/gramps/name-format") + return get_int("/apps/gramps/preferences/name-format", + range(len(_name_format_list))) +def save_name_format(val): + set_int("/apps/gramps/preferences/name-format",val, + range(len(_name_format_list))) + +# researcher keys def get_researcher_name(): - return client.get_string("/apps/gramps/researcher-name") + return get_string("/apps/gramps/researcher/researcher-name") + +def save_researcher_name(val): + set_string("/apps/gramps/researcher/researcher-name",val) def get_researcher_addr(): - return client.get_string("/apps/gramps/researcher-addr") + return get_string("/apps/gramps/researcher/researcher-addr") + +def save_researcher_addr(val): + set_string("/apps/gramps/researcher/researcher-addr",val) def get_researcher_city(): - return client.get_string("/apps/gramps/researcher-city") + return get_string("/apps/gramps/researcher/researcher-city") + +def save_researcher_city(val): + set_string("/apps/gramps/researcher/researcher-city",val) def get_researcher_state(): - return client.get_string("/apps/gramps/researcher-state") + return get_string("/apps/gramps/researcher/researcher-state") + +def save_researcher_state(val): + set_string("/apps/gramps/researcher/researcher-state",val) def get_researcher_country(): - return client.get_string("/apps/gramps/researcher-country") + return get_string("/apps/gramps/researcher/researcher-country") + +def save_researcher_country(val): + set_string("/apps/gramps/researcher/researcher-country",val) def get_researcher_postal(): - return client.get_string("/apps/gramps/researcher-postal") + return get_string("/apps/gramps/researcher/researcher-postal") + +def save_researcher_postal(val): + set_string("/apps/gramps/researcher/researcher-postal",val) def get_researcher_phone(): - return client.get_string("/apps/gramps/researcher-phone") + return get_string("/apps/gramps/researcher/researcher-phone") + +def save_researcher_phone(val): + set_string("/apps/gramps/researcher/researcher-phone",val) def get_researcher_email(): - return client.get_string("/apps/gramps/researcher-email") + return get_string("/apps/gramps/researcher/researcher-email") +def save_researcher_email(val): + set_string("/apps/gramps/researcher/researcher-email",val) + +# Not exactly gconf keys, but the functions directly dependent on them def get_nameof(): return _name_format_list[get_name_format()][1] @@ -265,6 +408,89 @@ def get_display_name(): def get_display_surname(): return _name_format_list[get_name_format()][3] +def get_toolbar_style(): + saved_toolbar = get_toolbar() + if saved_toolbar in range(4): + return saved_toolbar + else: + try: + gnome_toolbar_str = client.get_string("/desktop/gnome/interface/toolbar_style") + gnome_toolbar = eval("gtk.TOOLBAR_%s" % + gnome_toolbar_str.replace('-','_').upper()) + except: + gnome_toolbar = 2 + return gnome_toolbar + +def set_calendar_date_format(): + Calendar.set_format_code(get_date_format()) + +def set_calendar_date_entry(): + Calendar.Calendar.ENTRYCODE = get_date_entry() + +#------------------------------------------------------------------------- +# +# Low-level grabbing and saving keys with error checking. +# +#------------------------------------------------------------------------- +def get_bool(key): + try: + val = client.get_bool(key) + except gobject.GError: + val = None + if val in (True,False): + return val + else: + return client.get_default_from_schema(key).get_bool() + +def set_bool(key,val): + if val in (True,False): + client.set_bool(key,val) + +def get_int(key,correct_tuple=None): + try: + val = client.get_int(key) + except gobject.GError: + val = None + if not correct_tuple or val in correct_tuple: + return val + else: + return client.get_default_from_schema(key).get_int() + +def set_int(key,val,correct_tuple=None): + if not correct_tuple or val in correct_tuple: + client.set_int(key,val) + +def get_string(key,test_func=None): + try: + val = client.get_string(key) + except gobject.GError: + val = None + if not test_func or test_func(val): + return val + else: + return client.get_default_from_schema(key).get_string() + +def set_string(key,val,test_func=None): + if not test_func or test_func(val): + client.set_string(key,val) + +def set_string_as_path(key,val): + if not val: + val = client.get_default_from_schema(key).get_string() + else: + val = os.path.normpath(val) + os.sep + client.set_string(key,val) + +def set_string_as_id_prefix(key,val): + if not val: + val = client.get_default_from_schema(key).get_string() + else: + try: + junk = val % 1 + except: + val = client.get_default_from_schema(key).get_string() + client.set_string(key,val) + #------------------------------------------------------------------------- # # make_path - @@ -294,15 +520,6 @@ def loadConfig(): def sync(): client.suggest_sync() -#------------------------------------------------------------------------- -# -# -# -#------------------------------------------------------------------------- -def save_last_file(file): - client.set_string("/apps/gramps/recent-file",file) - sync() - #------------------------------------------------------------------------- # # @@ -451,7 +668,6 @@ class GrampsPreferences: self.top.signal_autoconnect({ "on_close_clicked" : self.on_close_clicked, "on_help_clicked" : self.on_propertybox_help, - "on_object_toggled" : self.on_object_toggled, "on_tree_select_row" : self.select }) @@ -490,54 +706,91 @@ class GrampsPreferences: self.imap[path] = tab def build(self): + auto = self.top.get_widget("autoload") - idedit = self.top.get_widget("gid_edit") -# cap = self.top.get_widget('capitalize') - index_vis = self.top.get_widget("show_child_id") + auto.set_active(get_autoload()) + auto.connect('toggled',lambda obj: save_autoload(obj.get_active())) + lds = self.top.get_widget("uselds") + lds.set_active(get_uselds()) + lds.connect('toggled',lambda obj: save_uselds(obj.get_active())) + mr = self.top.get_widget("mediaref") mc = self.top.get_widget("mediacopy") - dg = self.top.get_widget("globalprop") - dl = self.top.get_widget("localprop") - cal = self.top.get_widget("calendar") - - auto.set_active(get_autoload()) - lds.set_active(get_uselds()) if get_media_reference(): mr.set_active(1) else: mc.set_active(1) + mr.connect('toggled',lambda obj: save_media_reference(obj.get_active())) + + dg = self.top.get_widget("globalprop") dg.set_active(get_media_global()) + dg.connect('toggled',lambda obj: save_media_global(obj.get_active())) + + dl = self.top.get_widget("localprop") dl.set_active(get_media_local()) + dl.connect('toggled',lambda obj: save_media_local(obj.get_active())) + + cal = self.top.get_widget("calendar") cal.set_active(get_calendar()) + cal.connect('toggled',lambda obj: save_calendar(obj.get_active())) + + idedit = self.top.get_widget("gid_edit") idedit.set_active(get_id_edit()) -# cap.set_active(capitalize) + idedit.connect('toggled',lambda obj: save_id_edit(obj.get_active())) + + index_vis = self.top.get_widget("show_child_id") index_vis.set_active(get_index_visible()) + index_vis.connect('toggled',lambda obj: save_index_visible(obj.get_active())) - 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()) + ipr = self.top.get_widget("iprefix") + ipr.set_text(get_iprefix()) + ipr.connect('changed',lambda obj: save_iprefix(obj.get_text())) + opr = self.top.get_widget("oprefix") + opr.set_text(get_oprefix()) + opr.connect('changed',lambda obj: save_oprefix(obj.get_text())) + fpr = self.top.get_widget("fprefix") + fpr.set_text(get_fprefix()) + fpr.connect('changed',lambda obj: save_fprefix(obj.get_text())) + spr = self.top.get_widget("sprefix") + spr.set_text(get_sprefix()) + spr.connect('changed',lambda obj: save_sprefix(obj.get_text())) + ppr = self.top.get_widget("pprefix") + ppr.set_text(get_pprefix()) + ppr.connect('changed',lambda obj: save_pprefix(obj.get_text())) + sb2 = self.top.get_widget("stat2") + sb3 = self.top.get_widget("stat3") if get_statusbar() == 0 or get_statusbar() == 1: - self.top.get_widget("stat2").set_active(1) + sb2.set_active(1) else: - self.top.get_widget("stat3").set_active(1) + sb3.set_active(1) + sb2.connect('toggled', + lambda obj: save_statusbar(2-obj.get_active())) - self.top.get_widget("tooloptmenu").set_history(get_toolbar()) + toolbarmenu = self.top.get_widget("tooloptmenu") + toolbarmenu.set_history(get_toolbar()) + toolbarmenu.connect('changed',lambda obj: save_toolbar(obj.get_history())) + pvbutton = self.top.get_widget('pvbutton') + fvbutton = self.top.get_widget('fvbutton') if get_default_view() == 0: - self.top.get_widget('pvbutton').set_active(1) + pvbutton.set_active(1) else: - self.top.get_widget('fvbutton').set_active(1) + fvbutton.set_active(1) + fvbutton.connect('toggled',lambda obj: save_default_view(obj.get_active())) + familyview1 = self.top.get_widget('familyview1') + familyview2 = self.top.get_widget('familyview2') if get_family_view() == 0: - self.top.get_widget('familyview1').set_active(1) + familyview1.set_active(1) else: - self.top.get_widget('familyview2').set_active(1) + familyview2.set_active(1) + familyview2.connect('toggled',lambda obj: save_family_view(obj.get_active())) - self.top.get_widget('usetips').set_active(get_usetips()) + usetips = self.top.get_widget('usetips') + usetips.set_active(get_usetips()) + usetips.connect('toggled',lambda obj: save_usetips(obj.get_active())) paper_obj = self.top.get_widget("paper_size") menu = gtk.Menu() @@ -548,11 +801,12 @@ class GrampsPreferences: choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) - item.connect("activate", self.on_format_toggled) item.show() menu.append(item) menu.set_active(choice) paper_obj.set_menu(menu) + paper_obj.connect("changed", + lambda obj: save_paper_preference(obj.get_menu().get_active().get_data(DATA))) lastnamegen_obj = self.top.get_widget("lastnamegen") menu = gtk.Menu() @@ -561,11 +815,12 @@ class GrampsPreferences: name = _surname_styles[index] item = gtk.MenuItem(name) item.set_data(DATA,index) - item.connect("activate", self.on_format_toggled) item.show() menu.append(item) menu.set_active(get_lastnamegen()) lastnamegen_obj.set_menu(menu) + lastnamegen_obj.connect("changed", + lambda obj: save_lastnamegen(obj.get_menu().get_active().get_data(DATA))) self.osubmenu = gtk.Menu() choice = 0 @@ -575,12 +830,13 @@ class GrampsPreferences: choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) - item.connect("activate", self.on_format_toggled) item.show() self.osubmenu.append(item) index = index + 1 self.osubmenu.set_active(choice) self.ofmt.set_menu(self.osubmenu) + self.ofmt.connect("changed", + lambda obj: save_output_preference(obj.get_menu().get_active().get_data(DATA))) self.gsubmenu = gtk.Menu() choice = 0 @@ -590,34 +846,37 @@ class GrampsPreferences: choice = index item = gtk.MenuItem(name) item.set_data(DATA,name) - item.connect("activate", self.on_format_toggled) item.show() self.gsubmenu.append(item) index = index + 1 self.gsubmenu.set_active(choice) self.gfmt.set_menu(self.gsubmenu) + self.gfmt.connect("changed", + lambda obj: save_goutput_preference(obj.get_menu().get_active().get_data(DATA))) date_option = self.top.get_widget("date_format") date_menu = gtk.Menu() for index in range(0,len(_date_format_list)): item = gtk.MenuItem(_date_format_list[index]) item.set_data(INDEX,index) - item.connect("activate", self.on_format_toggled) item.show() date_menu.append(item) date_menu.set_active(Calendar.get_format_code()) date_option.set_menu(date_menu) + date_option.connect("changed", + lambda obj: save_date_format(obj.get_menu().get_active().get_data(INDEX))) date_entry = self.top.get_widget("date_entry_format") date_menu = gtk.Menu() for index in range(0,len(_date_entry_list)): item = gtk.MenuItem(_date_entry_list[index]) item.set_data(INDEX,index) - item.connect("activate", self.on_format_toggled) item.show() date_menu.append(item) date_menu.set_active(Calendar.Calendar.ENTRYCODE) date_entry.set_menu(date_menu) + date_entry.connect("changed", + lambda obj: save_date_entry(obj.get_menu().get_active().get_data(INDEX))) name_option = self.top.get_widget("name_format") name_menu = gtk.Menu() @@ -625,23 +884,44 @@ class GrampsPreferences: name_tuple = _name_format_list[index] item = gtk.MenuItem(name_tuple[0]) item.set_data(INDEX,index) - item.connect("activate", self.on_format_toggled) item.show() name_menu.append(item) name_menu.set_active(get_name_format()) name_option.set_menu(name_menu) + name_option.connect("changed", + lambda obj: save_name_format(obj.get_menu().get_active().get_data(INDEX))) - 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()) + resname = self.top.get_widget("resname") + resname.set_text(get_researcher_name()) + resname.connect('changed',lambda obj: save_researcher_name(obj.get_text())) + resaddr = self.top.get_widget("resaddr") + resaddr.set_text(get_researcher_addr()) + resaddr.connect('changed',lambda obj: save_researcher_addr(obj.get_text())) + rescity = self.top.get_widget("rescity") + rescity.set_text(get_researcher_city()) + rescity.connect('changed',lambda obj: save_researcher_city(obj.get_text())) + resstate = self.top.get_widget("resstate") + resstate.set_text(get_researcher_state()) + resstate.connect('changed',lambda obj: save_researcher_state(obj.get_text())) + rescountry = self.top.get_widget("rescountry") + rescountry.set_text(get_researcher_country()) + rescountry.connect('changed',lambda obj: save_researcher_country(obj.get_text())) + respostal = self.top.get_widget("respostal") + respostal.set_text(get_researcher_postal()) + respostal.connect('changed',lambda obj: save_researcher_postal(obj.get_text())) + resphone = self.top.get_widget("resphone") + resphone.set_text(get_researcher_phone()) + resphone.connect('changed',lambda obj: save_researcher_phone(obj.get_text())) + resemail = self.top.get_widget("resemail") + resemail.set_text(get_researcher_email()) + resemail.connect('changed',lambda obj: save_researcher_email(obj.get_text())) - self.top.get_widget("repdir").gtk_entry().set_text(get_report_dir()) - self.top.get_widget("htmldir").gtk_entry().set_text(get_web_dir()) + repdir = self.top.get_widget("repdir").gtk_entry() + repdir.set_text(get_report_dir()) + repdir.connect('changed',lambda obj: save_report_dir(obj.get_text())) + webdir = self.top.get_widget("htmldir").gtk_entry() + webdir.set_text(get_web_dir()) + webdir.connect('changed',lambda obj: save_web_dir(obj.get_text())) def build_ext(self): self.c = {} @@ -711,160 +991,9 @@ class GrampsPreferences: self.save_data() def save_data(self): - - autoload = self.top.get_widget("autoload").get_active() - uselds = self.top.get_widget("uselds").get_active() - mediaref = self.top.get_widget("mediaref").get_active() - localprop = self.top.get_widget("localprop").get_active() - globalprop = self.top.get_widget("globalprop").get_active() - calendar = self.top.get_widget("calendar").get_active() - id_edit = self.top.get_widget("gid_edit").get_active() - - index_visible = self.top.get_widget("show_child_id").get_active() - paper_obj = self.top.get_widget("paper_size").get_menu().get_active() - - output_obj = self.osubmenu.get_active() - goutput_obj = self.gsubmenu.get_active() - - if self.top.get_widget("stat2").get_active(): - status_bar = 1 - else: - status_bar = 2 - - save_toolbar = self.top.get_widget("tooloptmenu").get_history() - 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: - toolbar = gnome_toolbar - else: - toolbar = save_toolbar - - defaultview = not self.top.get_widget("pvbutton").get_active() - familyview = not self.top.get_widget("familyview1").get_active() - usetips = self.top.get_widget("usetips").get_active() - - iprefix = unicode(self.top.get_widget("iprefix").get_text()) - if iprefix == "": - iprefix = "I%04d" - sprefix = unicode(self.top.get_widget("sprefix").get_text()) - if sprefix == "": - sprefix = "S%04d" - oprefix = unicode(self.top.get_widget("oprefix").get_text()) - if oprefix == "": - oprefix = "O%04d" - fprefix = unicode(self.top.get_widget("fprefix").get_text()) - if fprefix == "": - fprefix = "F%04d" - pprefix = unicode(self.top.get_widget("pprefix").get_text()) - if pprefix == "": - pprefix = "P%04d" - - repdir_temp = self.top.get_widget("repdir").get_full_path(1) - if repdir_temp != None and os.path.isdir(repdir_temp): - report_dir = os.path.normpath(repdir_temp) + os.sep - - webdir_temp = self.top.get_widget("htmldir").get_full_path(1) - if webdir_temp != None and os.path.isdir(webdir_temp): - web_dir = os.path.normpath(webdir_temp) + os.sep - - paper_preference = paper_obj.get_data(DATA) - output_preference = output_obj.get_data(DATA) - goutput_preference = goutput_obj.get_data(DATA) - - 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) - - 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) - 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 - client.set_int("/apps/gramps/date-entry",entry_active) - - # get the name format - - format_menu = self.top.get_widget("name_format").get_menu() - active_name = format_menu.get_active().get_data(INDEX) - - nameof = _name_format_list[active_name][1] - display_name = _name_format_list[active_name][2] - display_surname = _name_format_list[active_name][3] - client.set_int("/apps/gramps/name-format",active_name) - - format_menu = self.top.get_widget("lastnamegen").get_menu() - lastnamegen = format_menu.get_active().get_data(DATA) - 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()) - city = unicode(self.top.get_widget("rescity").get_text()) - state = unicode(self.top.get_widget("resstate").get_text()) - country = unicode(self.top.get_widget("rescountry").get_text()) - postal = unicode(self.top.get_widget("respostal").get_text()) - phone = unicode(self.top.get_widget("resphone").get_text()) - email = unicode(self.top.get_widget("resemail").get_text()) - - 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() - # update the config file - - sync() - - def on_object_toggled(self,obj): - """Called by the elements on the property box to set the changed flag, - so that the property box knows to set the Apply button""" - if self.built: - self.on_propertybox_apply(obj) - - def on_format_toggled(self,obj): - """Called by the elements on the property box to set the changed flag, - so that the property box knows to set the Apply button""" - if self.built: - self.on_propertybox_apply(obj) - #------------------------------------------------------------------------- # # Create the property box, and set the elements off the current values @@ -872,32 +1001,3 @@ class GrampsPreferences: #------------------------------------------------------------------------- def display_preferences_box(db): GrampsPreferences(db) - -_view_str = "/apps/gramps/view" -_toolbar_str = "/apps/gramps/toolbar-on" - -def save_view(val): - client.set_bool(_view_str, not val) - sync() - -def get_view(): - return not client.get_bool(_view_str) - -def save_filter(val): - client.set_bool("/apps/gramps/filter",val) - -def get_filter(): - return client.get_bool("/apps/gramps/filter") - -def save_toolbar_on(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/StartupDialog.py b/src/StartupDialog.py index 61dfd0533..64416b7ed 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -25,20 +25,12 @@ import gtk.glade import gnome import gnome.ui -try: - import gconf -except ImportError: - import gnome.gconf - gconf = gnome.gconf +import GrampsCfg from gettext import gettext as _ -_StartupEntry = "/apps/gramps/startup" - def need_to_run(): - client = gconf.client_get_default() - client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) - val = client.get_int(_StartupEntry) + val = GrampsCfg.get_startup() if val < const.startup: return 1 return 0 @@ -56,8 +48,6 @@ class StartupDialog: self.logo = gtk.gdk.pixbuf_new_from_file("%s/gramps.png" % const.rootDir) self.splash = gtk.gdk.pixbuf_new_from_file("%s/splash.jpg" % const.rootDir) - self.client = gconf.client_get_default() - d = gnome.ui.Druid() self.w.add(d) d.add(self.build_page1()) @@ -106,33 +96,26 @@ class StartupDialog: 'contribute.\n\nPlease enjoy using GRAMPS.')) return p - def get_string(self,key): - val = self.client.get_string(key) - if val == None: - return "" - else: - return val - def complete(self,obj,obj2): - self.client.set_string('/apps/gramps/researcher-name',unicode(self.name.get_text())) - self.client.set_string('/apps/gramps/researcher-addr',unicode(self.addr.get_text())) - self.client.set_string('/apps/gramps/researcher-city',unicode(self.city.get_text())) - self.client.set_string('/apps/gramps/researcher-state',unicode(self.state.get_text())) - self.client.set_string('/apps/gramps/researcher-postal',unicode(self.postal.get_text())) - self.client.set_string('/apps/gramps/researcher-country',unicode(self.country.get_text())) - self.client.set_string('/apps/gramps/researcher-phone',unicode(self.phone.get_text())) - self.client.set_string('/apps/gramps/researcher-email',unicode(self.email.get_text())) + GrampsCfg.save_researcher_name(unicode(self.name.get_text())) + GrampsCfg.save_researcher_addr(unicode(self.addr.get_text())) + GrampsCfg.save_researcher_city(unicode(self.city.get_text())) + GrampsCfg.save_researcher_state(unicode(self.state.get_text())) + GrampsCfg.save_researcher_postal(unicode(self.postal.get_text())) + GrampsCfg.save_researcher_country(unicode(self.country.get_text())) + GrampsCfg.save_researcher_phone(unicode(self.phone.get_text())) + GrampsCfg.save_researcher_email(unicode(self.email.get_text())) if self.date1.get_active(): - self.client.set_int("/apps/gramps/date-entry",0) + GrampsCfg.save_date_entry(0) elif self.date2.get_active(): - self.client.set_int("/apps/gramps/date-entry",1) + GrampsCfg.save_date_entry(1) elif self.date3.get_active(): - self.client.set_int("/apps/gramps/date-entry",2) + GrampsCfg.save_date_entry(2) - 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) + GrampsCfg.save_calendar(self.calendar.get_active()) + GrampsCfg.save_uselds(self.lds.get_active()) + GrampsCfg.save_startup(const.startup) self.w.destroy() self.task(self.args) @@ -170,7 +153,7 @@ class StartupDialog: box.add(table) box.show_all() - name = self.get_string('/apps/gramps/researcher-name') + name = GrampsCfg.get_researcher_name() if name.strip() == "": import pwd import os @@ -181,13 +164,13 @@ class StartupDialog: name = "" self.name.set_text(name) - self.addr.set_text(self.get_string('/apps/gramps/researcher-addr')) - self.city.set_text(self.get_string('/apps/gramps/researcher-city')) - self.state.set_text(self.get_string('/apps/gramps/researcher-state')) - self.postal.set_text(self.get_string('/apps/gramps/researcher-postal')) - self.country.set_text(self.get_string('/apps/gramps/researcher-country')) - self.phone.set_text(self.get_string('/apps/gramps/researcher-phone')) - self.email.set_text(self.get_string('/apps/gramps/researcher-email')) + self.addr.set_text(GrampsCfg.get_researcher_addr()) + self.city.set_text(GrampsCfg.get_researcher_city()) + self.state.set_text(GrampsCfg.get_researcher_state()) + self.postal.set_text(GrampsCfg.get_researcher_postal()) + self.country.set_text(GrampsCfg.get_researcher_country()) + self.phone.set_text(GrampsCfg.get_researcher_phone()) + self.email.set_text(GrampsCfg.get_researcher_email()) return p @@ -217,7 +200,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/date-entry") + val = GrampsCfg.get_date_entry() if val == 0: self.date1.set_active(1) @@ -257,7 +240,7 @@ class StartupDialog: self.calendar = gtk.CheckButton(label=_("Enable support for alternate calendars")) - self.calendar.set_active(self.client.get_bool("/apps/gramps/show-calendar")) + self.calendar.set_active(GrampsCfg.get_calendar()) align.add(self.calendar) @@ -288,7 +271,7 @@ class StartupDialog: self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support")) - self.lds.set_active(self.client.get_bool("/apps/gramps/use-lds")) + self.lds.set_active(GrampsCfg.get_uselds()) align.add(self.lds) diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 96420861f..117daf94d 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -46,7 +46,7 @@ class TipOfDay: else: index += 1 - GrampsCfg.client.set_bool("/apps/gramps/use-tips",use.get_active()) + GrampsCfg.save_usetips(use.get_active()) top.destroy() class TipParser: diff --git a/src/data/gramps.schemas b/src/data/gramps.schemas index 602ab6b87..708e9f258 100644 --- a/src/data/gramps.schemas +++ b/src/data/gramps.schemas @@ -1,8 +1,11 @@ + + + - /schemas/apps/gramps/autoload - /apps/gramps/autoload + /schemas/apps/gramps/behavior/autoload + /apps/gramps/behavior/autoload gramps bool 0 @@ -13,20 +16,21 @@ - /schemas/apps/gramps/betawarn - /apps/gramps/betawarn + /schemas/apps/gramps/behavior/betawarn + /apps/gramps/behavior/betawarn gramps bool 0 - Display beta warning on startup - If set to 1, the warning about beta version will be loaded on the startup. + Hide beta warning on startup + If set to 1, the warning about beta version will not be + displayed on the startup. - /schemas/apps/gramps/date-entry - /apps/gramps/date-entry + /schemas/apps/gramps/preferences/date-entry + /apps/gramps/preferences/date-entry gramps int 0 @@ -39,8 +43,8 @@ - /schemas/apps/gramps/date-format - /apps/gramps/date-format + /schemas/apps/gramps/preferences/date-format + /apps/gramps/preferences/date-format gramps int 0 @@ -53,8 +57,8 @@ - /schemas/apps/gramps/defaultview - /apps/gramps/defaultview + /schemas/apps/gramps/interface/defaultview + /apps/gramps/interface/defaultview gramps int 0 @@ -66,8 +70,8 @@ - /schemas/apps/gramps/familyview - /apps/gramps/familyview + /schemas/apps/gramps/interface/familyview + /apps/gramps/interface/familyview gramps int 0 @@ -79,8 +83,8 @@ - /schemas/apps/gramps/filter - /apps/gramps/filter + /schemas/apps/gramps/interface/filter + /apps/gramps/interface/filter gramps bool 0 @@ -91,8 +95,8 @@ - /schemas/apps/gramps/fprefix - /apps/gramps/fprefix + /schemas/apps/gramps/preferences/fprefix + /apps/gramps/preferences/fprefix gramps string F%04d @@ -104,8 +108,8 @@ - /schemas/apps/gramps/iprefix - /apps/gramps/iprefix + /schemas/apps/gramps/preferences/iprefix + /apps/gramps/preferences/iprefix gramps string I%04d @@ -117,8 +121,8 @@ - /schemas/apps/gramps/oprefix - /apps/gramps/oprefix + /schemas/apps/gramps/preferences/oprefix + /apps/gramps/preferences/oprefix gramps string F%04d @@ -130,8 +134,8 @@ - /schemas/apps/gramps/pprefix - /apps/gramps/pprefix + /schemas/apps/gramps/preferences/pprefix + /apps/gramps/preferences/pprefix gramps string F%04d @@ -143,8 +147,8 @@ - /schemas/apps/gramps/sprefix - /apps/gramps/sprefix + /schemas/apps/gramps/preferences/sprefix + /apps/gramps/preferences/sprefix gramps string F%04d @@ -156,8 +160,8 @@ - /schemas/apps/gramps/goutput-preference - /apps/gramps/goutput-preference + /schemas/apps/gramps/preferences/goutput-preference + /apps/gramps/preferences/goutput-preference gramps string No default format @@ -168,8 +172,8 @@ - /schemas/apps/gramps/output-preference - /apps/gramps/output-preference + /schemas/apps/gramps/preferences/output-preference + /apps/gramps/preferences/output-preference gramps string No default format @@ -180,8 +184,8 @@ - /schemas/apps/gramps/paper-preference - /apps/gramps/paper-preference + /schemas/apps/gramps/preferences/paper-preference + /apps/gramps/preferences/paper-preference gramps string Letter @@ -192,8 +196,8 @@ - /schemas/apps/gramps/id-edit - /apps/gramps/id-edit + /schemas/apps/gramps/behavior/id-edit + /apps/gramps/behavior/id-edit gramps bool 0 @@ -204,8 +208,8 @@ - /schemas/apps/gramps/index-visible - /apps/gramps/index-visible + /schemas/apps/gramps/interface/index-visible + /apps/gramps/interface/index-visible gramps bool 0 @@ -216,32 +220,20 @@ - /schemas/apps/gramps/last-file - /apps/gramps/last-file + /schemas/apps/gramps/paths/recent-file + /apps/gramps/paths/recent-file gramps string - Last XML database GRAMPS has worked with - Full pathname of the last XML database GRAMPS has worked with. - - - - - /schemas/apps/gramps/recent-file - /apps/gramps/recent-file - gramps - string - - - Last GRDB database GRAMPS has worked with + Last database GRAMPS has worked with Full pathname of the last GRDB database GRAMPS has worked with. - /schemas/apps/gramps/make-reference - /apps/gramps/make-reference + /schemas/apps/gramps/behavior/make-reference + /apps/gramps/behavior/make-reference gramps bool 1 @@ -254,8 +246,8 @@ - /schemas/apps/gramps/media-global - /apps/gramps/media-global + /schemas/apps/gramps/behavior/media-global + /apps/gramps/behavior/media-global gramps bool 1 @@ -268,8 +260,8 @@ - /schemas/apps/gramps/media-local - /apps/gramps/media-local + /schemas/apps/gramps/behavior/media-local + /apps/gramps/behavior/media-local gramps bool 1 @@ -282,8 +274,8 @@ - /schemas/apps/gramps/name-format - /apps/gramps/name-format + /schemas/apps/gramps/preferences/name-format + /apps/gramps/preferences/name-format gramps int 0 @@ -296,8 +288,8 @@ - /schemas/apps/gramps/report-directory - /apps/gramps/report-directory + /schemas/apps/gramps/paths/report-directory + /apps/gramps/paths/report-directory gramps string ./ @@ -308,8 +300,8 @@ - /schemas/apps/gramps/researcher-addr - /apps/gramps/researcher-addr + /schemas/apps/gramps/researcher/researcher-addr + /apps/gramps/researcher/researcher-addr gramps string @@ -320,8 +312,8 @@ - /schemas/apps/gramps/researcher-city - /apps/gramps/researcher-city + /schemas/apps/gramps/researcher/researcher-city + /apps/gramps/researcher/researcher-city gramps string @@ -332,8 +324,8 @@ - /schemas/apps/gramps/researcher-country - /apps/gramps/researcher-country + /schemas/apps/gramps/researcher/researcher-country + /apps/gramps/researcher/researcher-country gramps string @@ -344,8 +336,8 @@ - /schemas/apps/gramps/researcher-email - /apps/gramps/researcher-email + /schemas/apps/gramps/researcher/researcher-email + /apps/gramps/researcher/researcher-email gramps string @@ -356,8 +348,8 @@ - /schemas/apps/gramps/researcher-name - /apps/gramps/researcher-name + /schemas/apps/gramps/researcher/researcher-name + /apps/gramps/researcher/researcher-name gramps string @@ -368,8 +360,8 @@ - /schemas/apps/gramps/researcher-phone - /apps/gramps/researcher-phone + /schemas/apps/gramps/researcher/researcher-phone + /apps/gramps/researcher/researcher-phone gramps string @@ -380,8 +372,8 @@ - /schemas/apps/gramps/researcher-postal - /apps/gramps/researcher-postal + /schemas/apps/gramps/researcher/researcher-postal + /apps/gramps/researcher/researcher-postal gramps string @@ -392,8 +384,8 @@ - /schemas/apps/gramps/researcher-state - /apps/gramps/researcher-state + /schemas/apps/gramps/researcher/researcher-state + /apps/gramps/researcher/researcher-state gramps string @@ -404,8 +396,8 @@ - /schemas/apps/gramps/show-calendar - /apps/gramps/show-calendar + /schemas/apps/gramps/behavior/show-calendar + /apps/gramps/behavior/show-calendar gramps bool 0 @@ -417,8 +409,8 @@ - /schemas/apps/gramps/startup - /apps/gramps/startup + /schemas/apps/gramps/behavior/startup + /apps/gramps/behavior/startup gramps int 0 @@ -430,8 +422,8 @@ - /schemas/apps/gramps/statusbar - /apps/gramps/statusbar + /schemas/apps/gramps/interface/statusbar + /apps/gramps/interface/statusbar gramps int 1 @@ -444,8 +436,8 @@ - /schemas/apps/gramps/surname-guessing - /apps/gramps/surname-guessing + /schemas/apps/gramps/behavior/surname-guessing + /apps/gramps/behavior/surname-guessing gramps int 0 @@ -459,8 +451,8 @@ - /schemas/apps/gramps/toolbar - /apps/gramps/toolbar + /schemas/apps/gramps/interface/toolbar + /apps/gramps/interface/toolbar gramps int 5 @@ -473,8 +465,8 @@ - /schemas/apps/gramps/toolbar-on - /apps/gramps/toolbar-on + /schemas/apps/gramps/interface/toolbar-on + /apps/gramps/interface/toolbar-on gramps bool 1 @@ -486,8 +478,8 @@ - /schemas/apps/gramps/use-lds - /apps/gramps/use-lds + /schemas/apps/gramps/behavior/use-lds + /apps/gramps/behavior/use-lds gramps bool 0 @@ -498,8 +490,8 @@ - /schemas/apps/gramps/use-tips - /apps/gramps/use-tips + /schemas/apps/gramps/behavior/use-tips + /apps/gramps/behavior/use-tips gramps bool 0 @@ -510,21 +502,21 @@ - /schemas/apps/gramps/view - /apps/gramps/view + /schemas/apps/gramps/interface/view + /apps/gramps/interface/view gramps bool - 0 + 1 - Save last view - If set to 1, the last displayed view will be presented - on the startup. + Sidebar View + If set to 1, the Sidebar View will be enabled. If set to 0, + the Notebook View will be used instead. - /schemas/apps/gramps/website-directory - /apps/gramps/website-directory + /schemas/apps/gramps/paths/website-directory + /apps/gramps/paths/website-directory gramps string ./ diff --git a/src/gramps.glade b/src/gramps.glade index 0fbbf96b3..f84d71bdb 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -6286,7 +6286,7 @@ 5 True True - _Open an existing database + Open an _existing database True GTK_RELIEF_NORMAL True @@ -6306,7 +6306,7 @@ 5 True True - _Create a new database + Create a _new database True GTK_RELIEF_NORMAL True diff --git a/src/gramps_main.py b/src/gramps_main.py index 6349f2793..fe1de63a2 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -143,7 +143,7 @@ class 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.client.set_bool('/apps/gramps/betawarn',1) + GrampsCfg.save_betawarn(1) self.RelClass = Plugins.relationship_class @@ -156,7 +156,16 @@ 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) + GrampsCfg.client.notify_add("/apps/gramps/researcher",self.researcher_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/statusbar",self.statusbar_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar",self.toolbar_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar-on",self.toolbar_on_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/filter",self.filter_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/view",self.sidebar_key_update) + GrampsCfg.client.notify_add("/apps/gramps/interface/familyview",self.familyview_key_update) + GrampsCfg.client.notify_add("/apps/gramps/preferences/name-format",self.familyview_key_update) + GrampsCfg.client.notify_add("/apps/gramps/preferences/date-format",self.date_format_key_update) + GrampsCfg.client.notify_add("/apps/gramps/preferences/date-entry",self.date_entry_key_update) self.topWindow.show() if GrampsCfg.get_usetips(): @@ -164,18 +173,45 @@ class Gramps: self.db.set_researcher(GrampsCfg.get_researcher()) - def pref_callback(self,client,cnxn_id,entry,data): + def date_format_key_update(self,client,cnxn_id,entry,data): + GrampsCfg.set_calendar_date_format() + self.familyview_key_update(client,cnxn_id,entry,data) + + def date_entry_key_update(self,client,cnxn_id,entry,data): + GrampsCfg.set_calendar_date_entry() + + def researcher_key_update(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()) + def statusbar_key_update(self,client,cnxn_id,entry,data): self.modify_statusbar() + + def toolbar_key_update(self,client,cnxn_id,entry,data): + self.toolbar.set_style(GrampsCfg.get_toolbar_style()) + + def toolbar_on_key_update(self,client,cnxn_id,entry,data): + is_on = GrampsCfg.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 = GrampsCfg.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 = GrampsCfg.get_view() + self.sidebar_btn.set_active(is_on) + self.enable_sidebar(is_on) + + def familyview_key_update(self,client,cnxn_id,entry,data): self.family_view.init_interface() self.update_display(1) self.goto_active_person() - self.toolbar.set_style(GrampsCfg.get_toolbar()) def init_interface(self): """Initializes the GLADE interface, and gets references to the @@ -235,14 +271,6 @@ class Gramps: self.db.set_undo_label(self.undolabel) self.db.set_redo_label(self.redolabel) - self.use_sidebar = GrampsCfg.get_view() - self.sidebar_btn.set_active(self.use_sidebar) - - self.use_filter = GrampsCfg.get_filter() - self.filter_btn.set_active(self.use_filter) - - self.use_toolbar = GrampsCfg.get_toolbar_on() - self.toolbar_btn.set_active(self.use_toolbar) self.child_model = gtk.ListStore( gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_STRING, @@ -253,7 +281,7 @@ class Gramps: self.build_plugin_menus() self.init_filters() - self.toolbar.set_style(GrampsCfg.get_toolbar()) + self.toolbar.set_style(GrampsCfg.get_toolbar_style()) self.views.set_show_tabs(0) self.family_view = FamilyView.FamilyView(self) @@ -349,9 +377,13 @@ class Gramps: "on_open_example" : self.open_example, }) + self.filter_btn.set_active(GrampsCfg.get_filter()) + self.enable_filter(GrampsCfg.get_filter()) + self.toolbar_btn.set_active(GrampsCfg.get_toolbar_on()) + self.enable_toolbar(GrampsCfg.get_toolbar_on()) + self.sidebar_btn.set_active(GrampsCfg.get_view()) + self.enable_sidebar(GrampsCfg.get_view()) - self.enable_filter(self.use_filter) - self.enable_sidebar(self.use_sidebar) self.find_place = None self.find_person = None self.find_source = None @@ -369,7 +401,6 @@ class Gramps: self.back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK) self.forward = gtk.ImageMenuItem(gtk.STOCK_GO_FORWARD) - self.enable_toolbar(self.use_toolbar) def undo(self,*args): self.db.undo() @@ -672,8 +703,7 @@ class Gramps: Plugins.PluginStatus() def on_sidebar_activate(self,obj): - val = obj.get_active() - self.enable_sidebar(val) + GrampsCfg.save_view(obj.get_active()) def enable_sidebar(self,val): if val: @@ -682,7 +712,6 @@ class Gramps: else: self.sidebar.hide() self.views.set_show_tabs(1) - GrampsCfg.save_view(val) def enable_filter(self,val): if val: @@ -691,19 +720,16 @@ class Gramps: self.filterbar.hide() def on_filter_activate(self,obj): - self.enable_filter(obj.get_active()) GrampsCfg.save_filter(obj.get_active()) def on_toolbar_activate(self,obj): - val = obj.get_active() - self.enable_toolbar(val) + GrampsCfg.save_toolbar_on(obj.get_active()) def enable_toolbar(self,val): if val: self.toolbardock.show() else: self.toolbardock.hide() - GrampsCfg.save_toolbar_on(val) def build_plugin_menus(self): export_menu = self.gtop.get_widget("export1")