2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2003-06-15 11:01:36 +05:30
|
|
|
# Copyright (C) 2002-2003 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GNOME modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
2004-05-02 09:40:33 +05:30
|
|
|
import gobject
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
def fill_combo(combo,data_list):
|
2004-10-29 06:19:40 +05:30
|
|
|
store = gtk.ListStore(gobject.TYPE_STRING)
|
2004-08-04 10:23:29 +05:30
|
|
|
|
2004-10-29 06:19:40 +05:30
|
|
|
for data in data_list:
|
2005-06-03 21:33:45 +05:30
|
|
|
if data:
|
|
|
|
store.append(row=[data])
|
2004-10-29 06:19:40 +05:30
|
|
|
|
|
|
|
combo.set_model(store)
|
|
|
|
combo.set_text_column(0)
|
|
|
|
completion = gtk.EntryCompletion()
|
|
|
|
completion.set_model(store)
|
|
|
|
completion.set_minimum_key_length(1)
|
|
|
|
completion.set_text_column(0)
|
|
|
|
combo.child.set_completion(completion)
|
2004-08-04 10:23:29 +05:30
|
|
|
|
|
|
|
def fill_entry(entry,data_list):
|
2004-10-29 06:19:40 +05:30
|
|
|
store = gtk.ListStore(gobject.TYPE_STRING)
|
|
|
|
for data in data_list:
|
2005-06-03 21:33:45 +05:30
|
|
|
if data:
|
|
|
|
store.append(row=[data])
|
2004-08-04 10:23:29 +05:30
|
|
|
|
2004-10-29 06:19:40 +05:30
|
|
|
completion = gtk.EntryCompletion()
|
|
|
|
completion.set_model(store)
|
|
|
|
completion.set_minimum_key_length(1)
|
|
|
|
completion.set_text_column(0)
|
|
|
|
entry.set_completion(completion)
|
2004-05-02 09:40:33 +05:30
|
|
|
|
2004-08-06 08:38:27 +05:30
|
|
|
def fill_option_text(combobox,data):
|
2005-02-23 10:00:08 +05:30
|
|
|
store = gtk.ListStore(str)
|
2004-10-29 06:19:40 +05:30
|
|
|
for item in data:
|
2005-06-03 21:33:45 +05:30
|
|
|
if item:
|
|
|
|
store.append(row=[item])
|
2004-10-29 06:19:40 +05:30
|
|
|
combobox.set_model(store)
|
|
|
|
combobox.set_active(0)
|
2004-08-06 08:38:27 +05:30
|
|
|
|
|
|
|
def get_option(combobox):
|
2004-10-29 06:19:40 +05:30
|
|
|
store = combobox.get_model()
|
|
|
|
return store.get_value(combobox.get_active_iter(),0)
|