]> git.phdru.name Git - xsetbg.git/blobdiff - print-filename.py
1 year.
[xsetbg.git] / print-filename.py
index 72769b1a591245789db184c88f1a1f3dedcdf7fe..c0d3c8ee6c31d2d6e9c8e107c8af812a38eea6f2 100755 (executable)
@@ -1,14 +1,19 @@
-#! /usr/local/bin/python -O
-"""This file is a part of XSetBg.
-Author: Oleg BroytMann <phd@phd.pp.ru>
-Copyright (C) 2004-2006 PhiloSoft Design
+#! /usr/bin/env python
+"""Print background filename
+
+Print the filename of the current or previous background image.
+
+This file is a part of XSetBg.
+
 """
 
 __version__ = "$Revision$"[11:-2]
-__author__ = "Oleg BroytMann <phd@phd.pp.ru>"
-__copyright__ = "Copyright (C) 2004-2006 PhiloSoft Design"
-__date__ = "$Date$"[7:-2]
 __revision__ = "$Id$"[5:-2]
+__date__ = "$Date$"[7:-2]
+
+__author__ = "Oleg BroytMann <phd@phd.pp.ru>"
+__copyright__ = "Copyright (C) 2004-2007 PhiloSoft Design"
+__license__ = "GNU GPL"
 
 
 import sys, os, shelve
@@ -76,18 +81,19 @@ else:
 filename = global_db[key]
 global_db.close()
 
+from m_lib.defenc import default_encoding
+filename = unicode(filename, default_encoding)
 
 if width:
    lines = []
    while filename:
       lines.append("%s%s%s" % (spaces, filename[:width], spaces))
       filename = filename[width:]
-   filename = "\n".join(lines)
+   filename = u'\n'.join(lines)
 else:
-   filename = "%s%s%s" % (spaces, filename, spaces)
-
+   filename = u"%s%s%s" % (spaces, filename, spaces)
 
-sys.stdout.write(filename)
+sys.stdout.write(filename.encode(default_encoding))
 
 if print0:
    sys.stdout.write('\0')