2006-08-25 Don Allingham <don@gramps-project.org>

* src/DisplayModels/_MediaModel.py (MediaModel.sort_date): add
	sorting by date value instead of by text string



svn: r7266
This commit is contained in:
Don Allingham 2006-08-26 02:07:46 +00:00
parent 2e34d583c8
commit 3ef45448cf
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-08-25 Don Allingham <don@gramps-project.org>
* src/DisplayModels/_MediaModel.py (MediaModel.sort_date): add
sorting by date value instead of by text string
2006-08-25 Alex Roitman <shura@gramps-project.org> 2006-08-25 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py (preferences_activate): Use uistate to emit. * src/ViewManager.py (preferences_activate): Use uistate to emit.
* src/DisplayState.py (DisplayState.__signals__): Add new signal. * src/DisplayState.py (DisplayState.__signals__): Add new signal.

View File

@ -75,13 +75,14 @@ class MediaModel(BaseModel):
self.column_handle, self.column_handle,
self.column_tooltip self.column_tooltip
] ]
self.smap = [ self.smap = [
self.column_description, self.column_description,
self.column_id, self.column_id,
self.column_mime, self.column_mime,
self.column_path, self.column_path,
self.sort_change, self.sort_change,
self.column_date, self.sort_date,
self.column_handle, self.column_handle,
] ]
BaseModel.__init__(self, db, scol, order, tooltip_column=7, BaseModel.__init__(self, db, scol, order, tooltip_column=7,
@ -118,6 +119,15 @@ class MediaModel(BaseModel):
return unicode(DateHandler.displayer.display(date)) return unicode(DateHandler.displayer.display(date))
return u'' return u''
def sort_date(self,data):
obj = RelLib.MediaObject()
obj.unserialize(data)
d = obj.get_date_object()
if d:
return "%09d" % d.get_sort_value()
else:
return ''
def column_handle(self,data): def column_handle(self,data):
return unicode(data[0]) return unicode(data[0])