Sorting in ChooseParents dialog
svn: r1042
This commit is contained in:
parent
a624eaff40
commit
ace403cb64
@ -104,9 +104,17 @@ class AddSpouse:
|
||||
self.relation_type.set_text(_("Married"))
|
||||
|
||||
def select_row(self,obj,a,b,c):
|
||||
"""
|
||||
Called with a row has be unselected. Used to ensable the OK button
|
||||
when a row has been selected.
|
||||
"""
|
||||
self.ok.set_sensitive(1)
|
||||
|
||||
def unselect_row(self,obj,a,b,c):
|
||||
"""
|
||||
Called with a row has be unselected. Used to disable the OK button
|
||||
when nothing is selected.
|
||||
"""
|
||||
self.ok.set_sensitive(0)
|
||||
|
||||
def new_spouse_clicked(self,obj):
|
||||
@ -130,10 +138,15 @@ class AddSpouse:
|
||||
QuickAdd.QuickAdd(self.db,gen,self.update_list)
|
||||
|
||||
def update_list(self,person):
|
||||
"""
|
||||
Updates the potential spouse list after a person has been added
|
||||
to database. Called by the QuickAdd class when the dialog has
|
||||
been closed.
|
||||
"""
|
||||
self.addperson(person)
|
||||
self.relation_type_changed(self.relation_type)
|
||||
row = self.spouse_list.find_row_from_data(person)
|
||||
self.sorter.sort_list()
|
||||
row = self.spouse_list.find_row_from_data(person.getId())
|
||||
self.spouse_list.select_row(row,0)
|
||||
self.spouse_list.moveto(row,0)
|
||||
|
||||
|
@ -43,6 +43,7 @@ import const
|
||||
import sort
|
||||
import Utils
|
||||
import GrampsCfg
|
||||
import Sorter
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -83,8 +84,16 @@ class ChooseParents:
|
||||
self.mlabel = self.glade.get_widget("mlabel")
|
||||
self.fcombo.set_popdown_strings(const.familyRelations)
|
||||
|
||||
fmap = [(2,self.glade.get_widget('fname_arrow')),
|
||||
(3,self.glade.get_widget('fbirth_arrow'))]
|
||||
self.fsort = Sorter.Sorter(self.father_list,fmap,'flist')
|
||||
mmap = [(2,self.glade.get_widget('mname_arrow')),
|
||||
(3,self.glade.get_widget('mbirth_arrow'))]
|
||||
self.msort = Sorter.Sorter(self.mother_list,mmap,'mlist')
|
||||
self.mother_list.set_column_visibility(2,0)
|
||||
self.father_list.set_column_visibility(2,0)
|
||||
self.mother_list.set_column_visibility(3,0)
|
||||
self.father_list.set_column_visibility(3,0)
|
||||
self.mother_list.set_sort_column(2)
|
||||
self.father_list.set_sort_column(2)
|
||||
|
||||
@ -125,43 +134,52 @@ class ChooseParents:
|
||||
self.father_list.clear()
|
||||
self.mother_list.clear()
|
||||
|
||||
self.father_list.append(["Unknown","",""])
|
||||
self.father_list.append(["Unknown","","",""])
|
||||
self.father_list.set_row_data(0,None)
|
||||
|
||||
self.mother_list.append(["Unknown","",""])
|
||||
self.mother_list.append(["Unknown","","",""])
|
||||
self.mother_list.set_row_data(0,None)
|
||||
|
||||
father_index = 1
|
||||
mother_index = 1
|
||||
fsel = 0
|
||||
msel = 0
|
||||
pkey = self.person.getId()
|
||||
gender = self.person.getGender()
|
||||
if self.father:
|
||||
fid = self.father.getId()
|
||||
else:
|
||||
fid = None
|
||||
if self.mother:
|
||||
mid = self.mother.getId()
|
||||
else:
|
||||
mid = None
|
||||
|
||||
for key in self.db.getPersonKeys():
|
||||
person = self.db.getPerson(key)
|
||||
if person == self.person:
|
||||
if pkey == key:
|
||||
continue
|
||||
if person.getGender() == RelLib.Person.unknown:
|
||||
if gender == const.unknown:
|
||||
continue
|
||||
if self.father == person:
|
||||
if fid == key:
|
||||
fsel = father_index
|
||||
if self.mother == person:
|
||||
if mid == key:
|
||||
msel = mother_index
|
||||
name = person.getPrimaryName()
|
||||
rdata = [Utils.phonebook_name(person),Utils.birthday(person),
|
||||
sort.build_sort_name(name)]
|
||||
dinfo = self.db.getPersonDisplay(key)
|
||||
rdata = [dinfo[0],dinfo[3],dinfo[5],dinfo[6]]
|
||||
if self.type == "Partners":
|
||||
self.father_list.append(rdata)
|
||||
self.father_list.set_row_data(father_index,person)
|
||||
self.father_list.set_row_data(father_index,dinfo[1])
|
||||
father_index = father_index + 1
|
||||
self.mother_list.append(rdata)
|
||||
self.mother_list.set_row_data(mother_index,person)
|
||||
self.mother_list.set_row_data(mother_index,dinfo[1])
|
||||
mother_index = mother_index + 1
|
||||
elif person.getGender() == RelLib.Person.male:
|
||||
elif dinfo[2] == const.male:
|
||||
self.father_list.append(rdata)
|
||||
self.father_list.set_row_data(father_index,person)
|
||||
self.father_list.set_row_data(father_index,dinfo[1])
|
||||
father_index = father_index + 1
|
||||
else:
|
||||
self.mother_list.append(rdata)
|
||||
self.mother_list.set_row_data(mother_index,person)
|
||||
self.mother_list.set_row_data(mother_index,dinfo[1])
|
||||
mother_index = mother_index + 1
|
||||
|
||||
self.mother_list.select_row(msel,0)
|
||||
@ -213,10 +231,18 @@ class ChooseParents:
|
||||
return family
|
||||
|
||||
def mother_list_select_row(self,obj,a,b,c):
|
||||
self.mother = obj.get_row_data(a)
|
||||
id = obj.get_row_data(a)
|
||||
if id:
|
||||
self.mother = self.db.getPerson(id)
|
||||
else:
|
||||
self.mother = None
|
||||
|
||||
def father_list_select_row(self,obj,a,b,c):
|
||||
self.father = obj.get_row_data(a)
|
||||
id = obj.get_row_data(a)
|
||||
if id:
|
||||
self.father = self.db.getPerson(id)
|
||||
else:
|
||||
self.father = None
|
||||
|
||||
def save_parents_clicked(self,obj):
|
||||
mother_rel = const.childRelations[self.mother_rel.get_text()]
|
||||
|
@ -5101,36 +5101,123 @@
|
||||
<name>select_row</name>
|
||||
<handler>on_fatherList_select_row</handler>
|
||||
</signal>
|
||||
<columns>3</columns>
|
||||
<column_widths>200,190,10</column_widths>
|
||||
<columns>4</columns>
|
||||
<column_widths>200,190,5,5</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label81</name>
|
||||
<label>Name</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<name>hbox84</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox85</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label320</name>
|
||||
<label>Name</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkArrow</class>
|
||||
<name>fname_arrow</name>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
<arrow_type>GTK_ARROW_DOWN</arrow_type>
|
||||
<shadow_type>GTK_SHADOW_OUT</shadow_type>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label82</name>
|
||||
<label>Birth Date</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<name>hbox88</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox89</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label322</name>
|
||||
<label>Birth Date</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkArrow</class>
|
||||
<name>fbirth_arrow</name>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
<visible>False</visible>
|
||||
<arrow_type>GTK_ARROW_DOWN</arrow_type>
|
||||
<shadow_type>GTK_SHADOW_OUT</shadow_type>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
@ -5145,6 +5232,19 @@
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label82b</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -5260,36 +5360,123 @@ Unknown
|
||||
<name>select_row</name>
|
||||
<handler>on_motherList_select_row</handler>
|
||||
</signal>
|
||||
<columns>3</columns>
|
||||
<column_widths>200,190,10</column_widths>
|
||||
<columns>4</columns>
|
||||
<column_widths>200,190,5,5</column_widths>
|
||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||
<show_titles>True</show_titles>
|
||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label84</name>
|
||||
<label>Name</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<name>hbox86</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox87</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label321</name>
|
||||
<label>Name</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkArrow</class>
|
||||
<name>mname_arrow</name>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
<arrow_type>GTK_ARROW_DOWN</arrow_type>
|
||||
<shadow_type>GTK_SHADOW_OUT</shadow_type>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<class>GtkHBox</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label85</name>
|
||||
<label>Birth Date</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<name>hbox90</name>
|
||||
<homogeneous>True</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox91</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label323</name>
|
||||
<label>Birth Date</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkArrow</class>
|
||||
<name>mbirth_arrow</name>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
<visible>False</visible>
|
||||
<arrow_type>GTK_ARROW_DOWN</arrow_type>
|
||||
<shadow_type>GTK_SHADOW_OUT</shadow_type>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
@ -5304,6 +5491,19 @@ Unknown
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<child_name>CList:title</child_name>
|
||||
<name>label85b</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -5370,7 +5570,7 @@ Unknown
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<text>Birth</text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -5479,7 +5679,7 @@ Unknown
|
||||
<editable>False</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text>Birth</text>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user