* src/DisplayModels.py: Fix sorting

* src/FamilyList.py: Fix sorting
* src/PageView.py: Fix sorting
* src/GrampsDb/_GrampsDbBase.py: set default column sorting order


svn: r5697
This commit is contained in:
Don Allingham 2006-01-09 00:54:04 +00:00
parent 2f1a21fb6e
commit f9e333f696
5 changed files with 27 additions and 28 deletions

View File

@ -1,3 +1,9 @@
2006-01-08 Don Allingham <don@gramps-project.org>
* src/DisplayModels.py: Fix sorting
* src/FamilyList.py: Fix sorting
* src/PageView.py: Fix sorting
* src/GrampsDb/_GrampsDbBase.py: set default column sorting order
2006-01-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/GrampsLogger/_ErrorReportAssistant.py: don't show excep twice
* src/GrampsLogger/_ErrorView.py: don't show excep twice

View File

@ -58,6 +58,9 @@ _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
#-------------------------------------------------------------------------
_codeset = GrampsLocale.codeset
def sfunc(a,b):
return locale.strcoll(a[0],b[0])
#-------------------------------------------------------------------------
#
# BaseModel
@ -86,7 +89,7 @@ class BaseModel(gtk.GenericTreeModel):
sarray.append((self.sort_func(data[1]),data[0]))
data = cursor.next()
cursor.close()
sarray.sort()
sarray.sort(sfunc)
if self.reverse:
sarray.reverse()
return map(lambda x: x[1], sarray)
@ -460,18 +463,18 @@ class FamilyModel(BaseModel):
self.gen_cursor = db.get_family_cursor
self.map = db.get_raw_family_data
self.fmap = [
self.column_id,
self.column_father,
self.column_mother,
self.column_id,
self.column_type,
self.column_change,
self.column_handle,
self.column_tooltip
]
self.smap = [
self.column_id,
self.sort_father,
self.sort_mother,
self.column_id,
self.column_type,
self.sort_change,
self.column_handle,
@ -802,7 +805,6 @@ class RepositoryModel(BaseModel):
except:
return u''
def column_email(self,data):
return unicode(data[5])

View File

@ -48,9 +48,9 @@ from QuestionDialog import QuestionDialog, ErrorDialog
from gettext import gettext as _
column_names = [
_('ID'),
_('Father'),
_('Mother'),
_('ID'),
_('Relationship'),
_('Last Changed'),
]

View File

@ -1536,7 +1536,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Person display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(1,3),(1,4),(0,5)]
default = [(1,0), (1,1),(1,2),(1,3),(0,4)]
return self._get_column_order(FAMILY_COL_KEY,default)
def get_child_column_order(self):
@ -1552,7 +1552,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Place display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(0,3),(0,4),(1,5),(0,6),(1,7),(0,8),(0,9),(0,10)]
default = [(1,0), (1,1),(1,2),(0,3),(0,4),(1,5),(0,6),(1,7),(0,8),(0,9),(0,10)]
return self._get_column_order(PLACE_COL_KEY,default)
def get_source_column_order(self):
@ -1560,7 +1560,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Source display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(0,3),(1,4),(0,5)]
default = [(1,0),(1,1),(1,2),(0,3),(1,4),(0,5)]
return self._get_column_order(SOURCE_COL_KEY,default)
def get_media_column_order(self):
@ -1568,7 +1568,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the MediaObject display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(1,3),(1,5),(0,4)]
default = [(1,0),(1,1),(1,2),(1,3),(1,5),(0,4)]
return self._get_column_order(MEDIA_COL_KEY,default)
def get_event_column_order(self):
@ -1576,7 +1576,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Event display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(1,3),(1,4),(1,5),(0,6)]
default = [(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(0,6)]
return self._get_column_order(EVENT_COL_KEY,default)
def get_repository_column_order(self):
@ -1584,7 +1584,7 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Repository display common information stored in the
database's metadata.
"""
default = [(1,1),(0,5),(0,6),(1,2),(1,3),(0,4),(0,7),(0,8),(0,9),(0,10)]
default = [(1,0),(1,1),(0,5),(0,6),(1,2),(1,3),(0,4),(0,7),(0,8),(0,9),(0,10)]
return self._get_column_order(REPOSITORY_COL_KEY,default)
def _update_reference_map(self,obj):

View File

@ -357,8 +357,8 @@ class ListView(PageView):
path = self.model.on_get_path(handle)
self.selection.select_path(path)
self.list.scroll_to_cell(path,None,1,0.5,0)
for i in range(0,len(self.columns)):
self.columns[i].set_sort_indicator(i==colmap[data][1]-1)
for i in xrange(len(self.columns)):
self.columns[i].set_sort_indicator(i==colmap[data][1])
self.columns[self.sort_col].set_sort_order(order)
def build_columns(self):
@ -367,17 +367,8 @@ class ListView(PageView):
self.columns = []
column = gtk.TreeViewColumn(self.colinfo[0], self.renderer,text=0)
column.set_resizable(True)
column.set_min_width(225)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.list.append_column(column)
self.columns = [column]
index = 0
for pair in self.column_order():
if not pair[0]:
continue
for pair in [pair for pair in self.column_order() if pair[0]]:
name = self.colinfo[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.connect('clicked',self.column_clicked,index)
@ -388,14 +379,14 @@ class ListView(PageView):
self.list.append_column(column)
index += 1
def build_tree(self):
self.model = self.make_model(self.dbstate.db,self.sort_col)
self.list.set_model(self.model)
self.selection = self.list.get_selection()
if self.model.tooltip_column != None:
self.tooltips = TreeTips.TreeTips(self.list,self.model.tooltip_column,True)
self.tooltips = TreeTips.TreeTips(self.list,
self.model.tooltip_column,True)
def change_db(self,db):
for sig in self.signal_map:
@ -425,9 +416,9 @@ class ListView(PageView):
Most PageViews really won't care about this.
"""
self.add_action('Add', gtk.STOCK_ADD, "_Add", callback=self.add)
self.add_action('Edit', gtk.STOCK_EDIT, "_Edit", callback=self.edit)
self.add_action('Remove', gtk.STOCK_REMOVE,"_Remove",callback=self.remove)
self.add_action('Add', gtk.STOCK_ADD, "_Add", callback=self.add)
self.add_action('Edit', gtk.STOCK_EDIT, "_Edit", callback=self.edit)
self.add_action('Remove',gtk.STOCK_REMOVE,"_Remove",callback=self.remove)
def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: