diff --git a/ChangeLog b/ChangeLog index 6b7a379c9..4460bf7c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-08-25 Don Allingham + * src/DisplayModels/_MediaModel.py (MediaModel.sort_date): add + sorting by date value instead of by text string + 2006-08-25 Alex Roitman * src/ViewManager.py (preferences_activate): Use uistate to emit. * src/DisplayState.py (DisplayState.__signals__): Add new signal. diff --git a/src/DisplayModels/_MediaModel.py b/src/DisplayModels/_MediaModel.py index 90c045114..f2304587e 100644 --- a/src/DisplayModels/_MediaModel.py +++ b/src/DisplayModels/_MediaModel.py @@ -75,13 +75,14 @@ class MediaModel(BaseModel): self.column_handle, self.column_tooltip ] + self.smap = [ self.column_description, self.column_id, self.column_mime, self.column_path, self.sort_change, - self.column_date, + self.sort_date, self.column_handle, ] BaseModel.__init__(self, db, scol, order, tooltip_column=7, @@ -118,6 +119,15 @@ class MediaModel(BaseModel): return unicode(DateHandler.displayer.display(date)) 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): return unicode(data[0])