diff options
author | Richard Hughes <richard@hughsie.com> | 2013-04-18 09:45:47 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2013-04-18 09:45:47 +0100 |
commit | 9e43ae57d5d8d0c5be688615d9004875767cf03d (patch) | |
tree | 510fb1549826dae673cbd10f7571f33773c9c39d | |
parent | 980a54c9430acb95a211e18db8ae538d54af6819 (diff) | |
download | colord-9e43ae57d5d8d0c5be688615d9004875767cf03d.tar.gz |
trivial: Add a python version of the CdIcc example
-rwxr-xr-x | examples/cd-icc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/cd-icc.py b/examples/cd-icc.py new file mode 100755 index 0000000..6fb8bf0 --- /dev/null +++ b/examples/cd-icc.py @@ -0,0 +1,30 @@ +#!/usr/bin/python + +# Copyright(C) 2013 Richard Hughes <richard@hughsie.com> +# Licensed under the GNU General Public License Version 2 + +from __future__ import print_function + +from gi.repository import Colord +from gi.repository import Gio + +import os +import locale + +locale.setlocale(locale.LC_ALL, '') + +# parse file +icc = Colord.Icc.new() +f = Gio.file_new_for_path('/usr/share/color/icc/colord/sRGB.icc') +cancellable = Gio.Cancellable.new() +icc.load_file(f, Colord.IccLoadFlags.METADATA, cancellable) + +# get details about the profile +print("Filename:", icc.get_filename()) +print("License:", icc.get_metadata_item("License")) + +# get translated UTF-8 strings where available +locale = os.getenv("LANG") +print("Description:", icc.get_description(locale)) +print("Model:", icc.get_model(locale)) +print("Copyright:", icc.get_copyright(locale)) |