* src/AutoComp.py: switch over entirely to ComboBox for

autocompletion
* src/GenericFilter.py: support ComboBox
* src/TransTable.py: sort items on getting keys
* src/plugins/FilterEditor.py: support ComboBox
* src/plugins/SoundGen.py: support ComboBox
* src/plugins/soundex.glade: support ComboBox


svn: r3346
This commit is contained in:
Don Allingham
2004-08-06 03:08:27 +00:00
parent e2122c9d67
commit 0843d5033a
9 changed files with 101 additions and 352 deletions

View File

@@ -59,9 +59,12 @@ _name2list = {
_('Family event:') : const.family_events,
_('Personal attribute:') : const.personal_attributes,
_('Family attribute:') : const.family_attributes,
_('Relationship type:') : const.family_relations,
}
_menulist = {
_('Relationship type:') : const.family_relations,
}
#-------------------------------------------------------------------------
#
# MyBoolean - check button with standard interface
@@ -103,11 +106,11 @@ class MyInteger(gtk.SpinButton):
# MyFilters - Combo box with list of filters with a standard interface
#
#-------------------------------------------------------------------------
class MyFilters(gtk.Combo):
class MyFilters(gtk.ComboBox):
def __init__(self,filters):
gtk.Combo.__init__(self)
gtk.ComboBox.__init__(self)
flist = []
for f in filters:
flist.append(f.get_name())
@@ -117,12 +120,12 @@ class MyFilters(gtk.Combo):
self.set_sensitive(0)
else:
self.ok = 1
AutoComp.AutoCombo(self,flist)
AutoComp.fill_option_text(self,flist)
self.show()
def get_text(self):
if self.ok:
return unicode(self.entry.get_text())
return unicode(AutoComp.get_option(self))
else:
return ""
@@ -140,7 +143,7 @@ class MyPlaces(gtk.Entry):
def __init__(self,places):
gtk.Entry.__init__(self)
self.comp = AutoComp.AutoEntry(self,places)
self.comp = AutoComp.fill_entry(self,places)
self.show()
#-------------------------------------------------------------------------
@@ -193,16 +196,33 @@ class MyID(gtk.HBox):
#
#
#-------------------------------------------------------------------------
class MySelect(gtk.Combo):
class MySelect(gtk.ComboBoxEntry):
def __init__(self,transtable):
gtk.Combo.__init__(self)
list = transtable.get_values()
list.sort()
self.set_popdown_strings(list)
self.set_value_in_list(1,0)
self.entry.set_editable(0)
self.transtable = transtable
gtk.ComboBoxEntry.__init__(self)
AutoComp.fill_combo(self,transtable.get_values())
self.show()
def get_text(self):
return self.transtable.find_key(unicode(self.entry.get_text()))
def set_text(self,val):
self.entry.set_text(_(val))
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
class MyListSelect(gtk.ComboBoxEntry):
def __init__(self,data_list):
gtk.ComboBoxEntry.__init__(self)
new_list = []
for item in data_list:
new_list.append(item[0])
new_list.sort()
AutoComp.fill_combo(self,new_list)
self.show()
def get_text(self):
@@ -595,6 +615,9 @@ class EditRule:
elif _name2list.has_key(v1):
data =_name2list[v1]
t = MySelect(data)
elif _menulist.has_key(v1):
data =_menulist[v1]
t = MyListSelect(data)
elif v == _('Inclusive:'):
t = MyBoolean(_('Include original person'))
else:

View File

@@ -62,7 +62,8 @@ class SoundGen:
_('SoundEx code generator'))
self.value = self.glade.get_widget("value")
self.name = self.glade.get_widget("name")
self.autocomp = self.glade.get_widget("name_list")
self.name = self.autocomp.child
self.name.connect('changed',self.on_apply_clicked)
@@ -74,8 +75,8 @@ class SoundGen:
names.append(lastname)
names.sort()
self.autocomp = AutoComp.AutoCombo(self.glade.get_widget("nameList"),
names)
AutoComp.fill_combo(self.autocomp, names)
if active_person:
n = active_person.get_primary_name().get_surname()

View File

@@ -138,68 +138,6 @@
</packing>
</child>
<child>
<widget class="GtkCombo" id="nameList">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="name">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Name used to generate SoundEx code</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="convertwidget1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
<child>
<widget class="GtkListItem" id="convertwidget2">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="convertwidget3">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="value">
<property name="visible">True</property>
@@ -223,6 +161,20 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="name_list">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>