From d9291bb1838599fa8f41627ae6ee1bf09bb1839b Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 8 Jan 2005 03:49:43 +0000 Subject: [PATCH] * src/gramps.glade: removal of more OptionMenus in favor of ComboBoxes * src/GrampsCfg.py: use new ComboBoxes * src/DateHandler.py: fix set_format vs. formats bug svn: r3882 --- gramps2/ChangeLog | 6 ++++ gramps2/src/DateHandler.py | 2 +- gramps2/src/GrampsCfg.py | 53 +++++++++++++++++----------------- gramps2/src/GrampsGconfKeys.py | 8 ++--- gramps2/src/gramps.glade | 48 ++++++++++-------------------- 5 files changed, 54 insertions(+), 63 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4081ba3e4..b246d45c7 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2005-01-07 Don Allingham + * src/gramps.glade: removal of more OptionMenus in favor + of ComboBoxes + * src/GrampsCfg.py: use new ComboBoxes + * src/DateHandler.py: fix set_format vs. formats bug + 2005-01-07 Alex Roitman * src/Plugins.py: Use doc lists from PluginMgr. * src/Exporter.py: Use exports list from PluginMgr. diff --git a/gramps2/src/DateHandler.py b/gramps2/src/DateHandler.py index 3a6e47965..ab05dbfe4 100644 --- a/gramps2/src/DateHandler.py +++ b/gramps2/src/DateHandler.py @@ -78,7 +78,7 @@ def get_date_formats(): def set_format(val): try: - _lang_to_display[_lang].formats = val + _lang_to_display[_lang].set_format(val) except: pass diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index f8f7f53a9..a7bd7c0d0 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -70,7 +70,7 @@ _surname_styles = [ panellist = [ (_("Display"), [( _("General"), 3), - ( _("Dates and Names"), 4), + ( _("Dates"), 4), ( _("Toolbar and Statusbar"), 2)]), (_("Database"), [( _("General"), 1), @@ -235,7 +235,6 @@ class GrampsPreferences: toolbarmenu = self.top.get_widget("tooloptmenu") toolbarmenu.set_active(GrampsKeys.get_toolbar()-1) - print GrampsKeys.get_toolbar() toolbarmenu.connect('changed', lambda obj: GrampsKeys.save_toolbar(obj.get_active()+1)) @@ -263,41 +262,43 @@ class GrampsPreferences: lambda obj: GrampsKeys.save_usetips(obj.get_active())) lastnamegen_obj = self.top.get_widget("lastnamegen") - menu = gtk.Menu() - for index in range(0,len(_surname_styles)): - name = _surname_styles[index] - item = gtk.MenuItem(name) - item.set_data(DATA,index) - item.show() - menu.append(item) - menu.set_active(GrampsKeys.get_lastnamegen(_surname_styles)) - lastnamegen_obj.set_menu(menu) + cell = gtk.CellRendererText() + lastnamegen_obj.pack_start(cell,True) + lastnamegen_obj.add_attribute(cell,'text',0) + + store = gtk.ListStore(str) + 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.connect("changed", lambda obj: - GrampsKeys.save_lastnamegen(obj.get_menu().get_active().get_data(DATA),_surname_styles) + GrampsKeys.save_lastnamegen(obj.get_active(),_surname_styles) ) date_option = self.top.get_widget("date_format") - date_menu = gtk.Menu() dlist = DateHandler.get_date_formats() - for index in range(0,len(dlist)): - item = gtk.MenuItem(dlist[index]) - item.set_data(INDEX,index) - item.show() - date_menu.append(item) - try: - # Technically, a selected format might be out of range - # for this locale's format list. - date_menu.set_active(GrampsKeys.get_date_format(dlist)) - except: - pass + date_option.pack_start(cell,True) + date_option.add_attribute(cell,'text',0) - date_option.set_menu(date_menu) + store = gtk.ListStore(str) + for item in dlist: + store.append(row=[item]) + + date_option.set_model(store) date_option.connect("changed", lambda obj: - GrampsKeys.save_date_format(obj.get_menu().get_active().get_data(INDEX),dlist) + GrampsKeys.save_date_format(obj.get_active(),dlist) ) + 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)) + except: + date_option.set_active(0) + + resname = self.top.get_widget("resname") resname.set_text(GrampsKeys.get_researcher_name()) resname.connect('changed', diff --git a/gramps2/src/GrampsGconfKeys.py b/gramps2/src/GrampsGconfKeys.py index ccf1f5b9b..a738ed290 100644 --- a/gramps2/src/GrampsGconfKeys.py +++ b/gramps2/src/GrampsGconfKeys.py @@ -267,13 +267,13 @@ def get_use_tips(): def save_use_tips(val): set_bool("/apps/gramps/preferences/use-tips",val) -def get_date_format(_date_format_list=[]): +def get_date_format(date_format_list): return get_int("/apps/gramps/preferences/date-format", - range(len(_date_format_list))) + range(len(date_format_list))) -def save_date_format(val,_date_format_list=[]): +def save_date_format(val,date_format_list): set_int("/apps/gramps/preferences/date-format",val, - range(len(_date_format_list))) + range(len(date_format_list))) def get_name_format(_name_format_list): return get_int("/apps/gramps/preferences/name-format", diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index ede488f03..fc662c709 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -17829,28 +17829,6 @@ Other - - - True - True - -1 - - - - True - - - - - 1 - 2 - 4 - 5 - fill - - - - True @@ -17875,6 +17853,20 @@ Other + + + + True + + + 1 + 2 + 4 + 5 + fill + fill + + 0 @@ -18395,16 +18387,8 @@ GNOME Settings - + True - True - -1 - - - - True - - 2 @@ -18412,7 +18396,7 @@ GNOME Settings 1 2 fill - + fill