From 3484056b38c8094e90e045c246f2e8dd9becbb23 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 6 Dec 2002 03:37:31 +0000 Subject: [PATCH] List sorting svn: r1219 --- example/gramps/data.gramps | Bin 3779 -> 3801 bytes src/ListModel.py | 28 ++++++++++++++-------------- src/gramps_main.py | 2 ++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/example/gramps/data.gramps b/example/gramps/data.gramps index 42a9b52b513222926a5311df368be4a42729af29..7283cfcf7cfcb1305184a4ad52dab4c9e2834e8d 100644 GIT binary patch delta 3780 zcmV;#4mY;!C2daP8HBR0k zbUdddqFg+}k1405ppl?K-}fB!;e3p2%d&eLe%2rySp5a3qaIpNwn(6&3(qr>#z{AYrKzRE~SPtMpqnxt_tKOWYv8dXRX@e^!W zXfi<8B+k&J7|4pUpiyxe7ps4h$%4n(!z`vrBrD06jY@d|<2?C7pU_vvzsoA+t0p0~ z%nH6b`F(O)(x`qnsw^0^N=~rtxSp(2y=YdMvy7fNj??!%uOIrhT~?H@8}(>P;^gF> z-RA;=f95QuPk<5~WVDbi$_gcl!)+LkhZ|WQm!d%tosnfyyzhN-{9b?6YyqNV8Hyu# zYX`kG`v;nd))&Xa>ZvXeLO{i80g^t8c`-*{;KjNfRG7s)FHTOgj2sWk=S^8c;OC^^ zG@i{Uhe5~}HR<7&faxR6iYBKf6QPrj1T>!{pku+v>RVyoc50m}hbB}CaXNe7yT$IN z=y)hezsTqVsC)~f(Dr}(mI{BAj2tze1>x`$)Ku2Iz<50ahNTo<5=r=zNUpnzWXwtY zfNp6)xk@tSR5K%#a0G^+tVw3TQwf=^hHN^IlZeeK!~zPy)|zbqu=D5%q;(xn=Y%Hu zkU>#t@u1gb&nLJ!#O{FNzUB38SB>PhUOw-Iqc;a`rqktu6kvbgxB3Fsj>ik}`eedp z#S>^VI?o>Bj0$~f7HjZ0kCxM)S-@~P$sQ;Ii^&TyWIu%EqhJg19JCBvdwM@`N?Ra) z#-ll^v%zF=4*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G)&?ZUohV_?Trxs!B~`lkvKwMS+YyR*}=Ao)7EfybHX!DgtvbvwQK#n zjd(oV=xX8q(OFUJ?edp|dL_O_$!FqWQ2Z!*D2-DBggKZw|~VAK2oOz9Jl?>Lzk zf1YwS15HT(3>!)NE%2in{Aho$jONdQm#?>APYWuPwfO9cZCUtPxLyj^8+=>d)o|k! zw)61YlHNT5S$=x^?<8IR3suMdWNGMG*lr5j)q=fUh-!iB)Nq{_%(*&_(*oA6!P~)c^nh diff --git a/src/ListModel.py b/src/ListModel.py index 93719e276..95947fa2e 100644 --- a/src/ListModel.py +++ b/src/ListModel.py @@ -32,6 +32,8 @@ class ListModel: self.selection = self.tree.get_selection() self.data_index = l + + self.cids = [] cnum = 0 for name in dlist: @@ -46,21 +48,15 @@ class ListModel: column.set_clickable(gtk.FALSE) else: column.set_clickable(gtk.TRUE) - cnum = cnum + 1 - self.tree.append_column(column) - - self.column = None - num = 0 - for name in dlist: - column = self.tree.get_column(num) - if name[1] != -1: column.set_sort_column_id(name[1]) - if not self.column: - self.column = column - num = num + 1 + + cnum = cnum + 1 + self.cids.append(name[1]) + if name[1] != -1: + self.tree.append_column(column) + self.model.set_sort_column_id(self.cids[0],gtk.SORT_ASCENDING) self.connect_model() - self.model.set_sort_column_id(0,gtk.SORT_ASCENDING) if select_func: self.selection.connect('changed',select_func) @@ -73,11 +69,15 @@ class ListModel: def connect_model(self): self.tree.set_model(self.model) - self.model.set_sort_column_id(0,gtk.SORT_ASCENDING) + self.sort() def sort(self): val = self.model.get_sort_column_id() - self.model.set_sort_column_id(val[0],val[1]) + col = val[0] + if col > 0: + self.model.set_sort_column_id(col,val[1]) + else: + self.model.set_sort_column_id(self.cids[0],val[1]) self.model.sort_column_changed() def get_selected(self): diff --git a/src/gramps_main.py b/src/gramps_main.py index e82607f03..188cca6e0 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1387,6 +1387,8 @@ class Gramps: if self.id2col.has_key(key): (model,iter,page) = self.id2col[key] model.remove(iter) + for i in self.pl_page: + i.sort() def on_home_clicked(self,obj): temp = self.db.getDefaultPerson()