* src/EditPerson.py: switch to ComboBox from OptionMenu

* src/GenericFilter.py: switch to ComboBox from OptionMenu
* src/Marriage.py: switch to ComboBox from OptionMenu
* src/PeopleView.py: switch to ComboBox from OptionMenu
* src/gramps.glade:switch to ComboBox from OptionMenu
* src/gramps_main.py: switch to ComboBox from OptionMenu


svn: r3877
This commit is contained in:
Don Allingham 2005-01-07 04:34:02 +00:00
parent cfa560f7b1
commit cf5ddaf1c8
7 changed files with 158 additions and 170 deletions

View File

@ -1,4 +1,10 @@
2005-01-06 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson.py: switch to ComboBox from OptionMenu
* src/GenericFilter.py: switch to ComboBox from OptionMenu
* src/Marriage.py: switch to ComboBox from OptionMenu
* src/PeopleView.py: switch to ComboBox from OptionMenu
* src/gramps.glade:switch to ComboBox from OptionMenu
* src/gramps_main.py: switch to ComboBox from OptionMenu
* src/const.py.in: add support for overriding gconf usage
* src/GrampsIniKeys.py: provide support for the default schema
* src/GrampsKeys.py: select appropriate backend

View File

@ -642,20 +642,23 @@ class EditPerson:
else:
self.ldsfam = None
myMenu = gtk.Menu()
item = gtk.MenuItem(_("None"))
item.set_data("f",None)
item.connect("activate",self.menu_changed)
item.show()
myMenu.append(item)
cell = gtk.CellRendererText()
self.ldsseal_fam.pack_start(cell,True)
self.ldsseal_fam.add_attribute(cell,'text',0)
store = gtk.ListStore(str)
store.append(row=[_("None")])
index = 0
hist = 0
self.lds_fam_list = [None]
flist = [self.person.get_main_parents_family_handle()]
for (fam,mrel,frel) in self.person.get_parent_family_handle_list():
if fam not in flist:
flist.append(fam)
for fam_id in flist:
index += 1
fam = self.db.get_family_from_handle(fam_id)
if fam == None:
continue
@ -673,16 +676,13 @@ class EditPerson:
name = self.name_display.display(m)
else:
name = _("unknown")
item = gtk.MenuItem(name)
item.set_data("f",fam)
item.connect("activate",self.menu_changed)
item.show()
myMenu.append(item)
index = index + 1
if fam == self.ldsfam:
store.append(row=[name])
self.lds_fam_list.append(fam_id)
if fam_id == self.ldsfam:
hist = index
self.ldsseal_fam.set_menu(myMenu)
self.ldsseal_fam.set_history(hist)
self.ldsseal_fam.set_model(store)
self.ldsseal_fam.set_active(hist)
self.ldsseal_fam.connect("changed",self.menu_changed)
self.build_bap_menu()
self.build_seal_menu()
@ -704,17 +704,16 @@ class EditPerson:
self.is_female.set_active(True)
def build_menu(self,list,task,opt_menu,type):
menu = gtk.Menu()
index = 0
cell = gtk.CellRendererText()
opt_menu.pack_start(cell,True)
opt_menu.add_attribute(cell,'text',0)
store = gtk.ListStore(str)
for val in list:
menuitem = gtk.MenuItem(val)
menuitem.set_data("val",index)
menuitem.connect('activate',task)
menuitem.show()
menu.append(menuitem)
index = index + 1
opt_menu.set_menu(menu)
opt_menu.set_history(type)
store.append(row=[val])
opt_menu.set_model(store)
opt_menu.connect('changed',task)
opt_menu.set_active(type)
def build_bap_menu(self):
self.build_menu(const.lds_baptism,self.set_lds_bap,self.ldsbapstat,
@ -729,13 +728,13 @@ class EditPerson:
self.seal_stat)
def set_lds_bap(self,obj):
self.lds_baptism.set_status(obj.get_data("val"))
self.lds_baptism.set_status(obj.get_active())
def set_lds_endow(self,obj):
self.lds_endowment.set_status(obj.get_data("val"))
self.lds_endowment.set_status(obj.get_active())
def set_lds_seal(self,obj):
self.lds_sealing.set_status(obj.get_data("val"))
self.lds_sealing.set_status(obj.get_active())
def ev_drag_data_received(self,widget,context,x,y,sel_data,info,time):
row = self.etree.get_row_at(x,y)
@ -883,7 +882,7 @@ class EditPerson:
return
def menu_changed(self,obj):
self.ldsfam = obj.get_data("f")
self.ldsfam = self.lds_fam_list[obj.get_active()]
def get_widget(self,str):
"""returns the widget related to the passed string"""

View File

@ -1348,7 +1348,7 @@ class MatchesFilter(Rule):
return 'Matches the filter named'
def apply(self,db,p_id):
for filt in SystemFilters.get_filters():
for filt in SystemFilters.get_filter():
if filt.get_name() == self.list[0]:
return filt.check(p_id)
for filt in CustomFilters.get_filters():
@ -1771,6 +1771,37 @@ class GrampsFilterComboBox(gtk.ComboBox):
return self.map[key]
class FilterStore(gtk.ListStore):
def __init__(self,local_filters=[], default=""):
gtk.ListStore.__init__(self,str)
self.list_map = []
self.def_index = 0
cnt = 0
for filt in local_filters:
name = filt.get_name()
self.append(row=[name])
self.list_map.append(filt)
if default != "" and default == name:
self.def_index = cnt
cnt += 1
for filt in SystemFilters.get_filters() + CustomFilters.get_filters():
name = _(filt.get_name())
self.append(row=[name])
self.list_map.append(filt)
if default != "" and default == name:
self.def_index = cnt
cnt += 1
def default_index(self):
return self.def_index
def get_filter(self,index):
return self.list_map[index]
def build_filter_menu(local_filters = [], default=""):
menu = gtk.Menu()

View File

@ -331,20 +331,19 @@ class Marriage:
return
def build_seal_menu(self):
menu = gtk.Menu()
index = 0
cell = gtk.CellRendererText()
self.lds_status.pack_start(cell,True)
self.lds_status.add_attribute(cell,'text',0)
store = gtk.ListStore(str)
for val in const.lds_ssealing:
menuitem = gtk.MenuItem(val)
menuitem.set_data("val",index)
menuitem.connect('activate',self.set_lds_seal)
menuitem.show()
menu.append(menuitem)
index = index + 1
self.lds_status.set_menu(menu)
self.lds_status.set_history(self.seal_stat)
store.append(row=[val])
self.lds_status.set_model(store)
self.lds_status.connect('changed',self.set_lds_seal)
self.lds_status.set_active(self.seal_stat)
def set_lds_seal(self,obj):
self.seal_stat = obj.get_data("val")
self.seal_stat = obj.get_active()
def lds_src_clicked(self,obj):
lds_ord = self.family.get_lds_sealing()

View File

@ -170,8 +170,8 @@ class PeopleView:
self.parent.mhistory.remove(del_id)
def apply_filter_clicked(self):
mi = self.parent.filter_list.get_menu().get_active()
self.DataFilter = mi.get_data("filter")
index = self.parent.filter_list.get_active()
self.DataFilter = self.parent.filter_model.get_filter(index)
if self.DataFilter.need_param:
qual = unicode(self.parent.filter_text.get_text())
self.DataFilter.set_parameter(qual)

View File

@ -1278,17 +1278,8 @@
<property name="spacing">6</property>
<child>
<widget class="GtkOptionMenu" id="filter_list">
<property name="width_request">200</property>
<widget class="GtkComboBox" id="filter_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget12">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -12540,29 +12531,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="ldsbapstat">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget22">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="ldsbapdate">
<property name="visible">True</property>
@ -12875,28 +12843,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="endowstat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget26">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button132">
<property name="visible">True</property>
@ -12986,28 +12932,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="sealstat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget27">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label261">
<property name="visible">True</property>
@ -13135,9 +13059,6 @@ Other</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">sealparents</property>
<accessibility>
<atkrelation target="sealparents" type="label-for"/>
</accessibility>
</widget>
<packing>
<property name="left_attach">1</property>
@ -13149,28 +13070,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="sealparents">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget31">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label308">
<property name="visible">True</property>
@ -13236,6 +13135,62 @@ Other</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="ldsbapstat">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="endowstat">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="sealstat">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">11</property>
<property name="bottom_attach">12</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="sealparents">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">14</property>
<property name="bottom_attach">15</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@ -15214,28 +15169,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="lds_status">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget16">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button114">
<property name="visible">True</property>
@ -15303,6 +15236,20 @@ Other</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="lds_status">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -838,6 +838,10 @@ class Gramps:
def init_filters(self):
cell = gtk.CellRendererText()
self.filter_list.pack_start(cell,True)
self.filter_list.add_attribute(cell,'text',0)
filter_list = []
all = GenericFilter.GenericFilter()
@ -867,8 +871,9 @@ class Gramps:
menu = GenericFilter.build_filter_menu(filter_list)
self.filter_list.set_menu(menu)
self.filter_list.set_history(0)
self.filter_model = GenericFilter.FilterStore(filter_list)
self.filter_list.set_model(self.filter_model)
self.filter_list.set_active(self.filter_model.default_index())
self.filter_list.connect('changed',self.on_filter_name_changed)
self.filter_text.set_sensitive(0)
@ -1485,7 +1490,8 @@ class Gramps:
self.people_view.apply_filter_clicked()
def on_filter_name_changed(self,obj):
mime_filter = obj.get_menu().get_active().get_data('filter')
index = self.filter_list.get_active()
mime_filter = self.filter_model.get_filter(index)
qual = mime_filter.need_param
if qual:
self.filter_text.show()