* 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
This commit is contained in:
Don Allingham 2005-01-08 03:49:43 +00:00
parent bad8f0ba76
commit b5b5167e73
5 changed files with 54 additions and 63 deletions

View File

@ -1,3 +1,9 @@
2005-01-07 Don Allingham <dallingham@users.sourceforge.net>
* 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 <shura@alex.neuro.umn.edu>
* src/Plugins.py: Use doc lists from PluginMgr.
* src/Exporter.py: Use exports list from PluginMgr.

View File

@ -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

View File

@ -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',

View File

@ -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",

View File

@ -17829,28 +17829,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="lastnamegen">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget13">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label38">
<property name="visible">True</property>
@ -17875,6 +17853,20 @@ Other</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="lastnamegen">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -18395,16 +18387,8 @@ GNOME Settings</property>
</child>
<child>
<widget class="GtkOptionMenu" id="date_format">
<widget class="GtkComboBox" id="date_format">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget5">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
@ -18412,7 +18396,7 @@ GNOME Settings</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>