From 72abad5af9e89331952a64578b8f24c146a6e767 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 21 Jul 2015 23:30:18 +0300 Subject: [PATCH] Convert print_all.py It's really a simpler version of dump_db.py. --- print_all.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/print_all.py b/print_all.py index e67c642..e03ac4e 100755 --- a/print_all.py +++ b/print_all.py @@ -6,13 +6,15 @@ This file is a part of XSetBg. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design" +__copyright__ = "Copyright (C) 2006-2015 PhiloSoft Design" __license__ = "GNU GPL" -from operator import itemgetter +import sys +from m_lib.defenc import default_encoding from xsetbg_db import xsetbg_db -for key, value in sorted(xsetbg_db.items(), key=itemgetter(1), reverse=1): - if key.startswith('/'): - print key -xsetbg_db.close() +if not xsetbg_db: + sys.exit("Error: no database found") + +for row in xsetbg_db.select('last_shown IS NOT NULL', orderBy='-last_shown'): + print row.full_name.encode(default_encoding) -- 2.39.5