From 35ab7ad62159185993b02e6c00b7d497f6a65672 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 8 Aug 2019 13:33:07 +1000 Subject: [PATCH] gui: reverse-sort the drawings by timestamp before adding them We want the most-recent drawings up the top. And since we always add to the flowbox, we need to reverse-sort everything. Signed-off-by: Peter Hutterer --- tuhigui/drawingperspective.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuhigui/drawingperspective.py b/tuhigui/drawingperspective.py index e0eb307..97390dd 100644 --- a/tuhigui/drawingperspective.py +++ b/tuhigui/drawingperspective.py @@ -88,7 +88,7 @@ class DrawingPerspective(Gtk.Stack): def _hash(drawing): return time.strftime('%Y%m', time.gmtime(drawing.timestamp)) - for js in config.drawings: + for js in sorted(config.drawings, reverse=True, key=lambda j: j['timestamp']): ts = js['timestamp'] if ts in self.known_drawings: continue