* src/PlaceView.py: select correct column for sorting

* src/SourceView.py: select correct column for sorting


svn: r4605
This commit is contained in:
Don Allingham 2005-05-17 03:58:18 +00:00
parent 41fef8d7d6
commit a662f3717b
3 changed files with 15 additions and 6 deletions

View File

@ -1,4 +1,6 @@
2005-05-16 Don Allingham <don@gramps-project.org> 2005-05-16 Don Allingham <don@gramps-project.org>
* src/PlaceView.py: select correct column for sorting
* src/SourceView.py: select correct column for sorting
* src/WriteGedcom.py: used 'replace' mode on iso-8859-1 string * src/WriteGedcom.py: used 'replace' mode on iso-8859-1 string
encoding conversion encoding conversion

View File

@ -101,13 +101,16 @@ class PlaceView:
self.model = DisplayModels.PlaceModel(self.parent.db, self.model = DisplayModels.PlaceModel(self.parent.db,
self.sort_col,order) self.sort_col,order)
self.list.set_model(self.model) self.list.set_model(self.model)
colmap = self.parent.db.get_place_column_order()
if handle: if handle:
path = self.model.on_get_path(handle) path = self.model.on_get_path(handle)
self.selection.select_path(path) self.selection.select_path(path)
self.list.scroll_to_cell(path,None,1,0.5,0) self.list.scroll_to_cell(path,None,1,0.5,0)
for i in range(0,len(self.columns)): for i in range(0,len(self.columns)):
self.columns[i].set_sort_indicator(i==data) self.columns[i].set_sort_indicator(i==colmap[data][1]-1)
self.columns[data].set_sort_order(order) self.columns[self.sort_col].set_sort_order(order)
def build_columns(self): def build_columns(self):
for column in self.columns: for column in self.columns:
@ -121,6 +124,7 @@ class PlaceView:
self.list.append_column(column) self.list.append_column(column)
self.columns = [column] self.columns = [column]
index = 1
for pair in self.parent.db.get_place_column_order(): for pair in self.parent.db.get_place_column_order():
if not pair[0]: if not pair[0]:
continue continue
@ -129,7 +133,8 @@ class PlaceView:
column.set_resizable(True) column.set_resizable(True)
column.set_min_width(75) column.set_min_width(75)
column.set_clickable(True) column.set_clickable(True)
column.connect('clicked',self.column_clicked,pair[1]) column.connect('clicked',self.column_clicked,index)
index += 1
self.columns.append(column) self.columns.append(column)
self.list.append_column(column) self.list.append_column(column)

View File

@ -99,13 +99,15 @@ class SourceView:
self.model = DisplayModels.SourceModel(self.parent.db, self.model = DisplayModels.SourceModel(self.parent.db,
self.sort_col,order) self.sort_col,order)
self.list.set_model(self.model) self.list.set_model(self.model)
colmap = self.parent.db.get_place_column_order()
if handle: if handle:
path = self.model.on_get_path(handle) path = self.model.on_get_path(handle)
self.selection.select_path(path) self.selection.select_path(path)
self.list.scroll_to_cell(path,None,1,0.5,0) self.list.scroll_to_cell(path,None,1,0.5,0)
for i in range(0,len(self.columns)): for i in range(0,len(self.columns)):
self.columns[i].set_sort_indicator(i==data) self.columns[i].set_sort_indicator(i==colmap[data][1]-1)
self.columns[data].set_sort_order(order) self.columns[self.sort_col].set_sort_order(order)
def build_columns(self): def build_columns(self):
for column in self.columns: for column in self.columns:
@ -125,7 +127,7 @@ class SourceView:
continue continue
name = column_names[pair[1]] name = column_names[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.connect('clicked',self.column_clicked,pair[1]) column.connect('clicked',self.column_clicked,index)
column.set_resizable(True) column.set_resizable(True)
column.set_min_width(75) column.set_min_width(75)
column.set_clickable(True) column.set_clickable(True)