Debian Codegraph @

examples/cd-icc.py

raw
1 #!/usr/bin/python
2
3 # Copyright(C) 2013 Richard Hughes <[email protected]>
4 # Licensed under the GNU General Public License Version 2
5
6 from __future__ import print_function
7
8 from gi.repository import Colord
9 from gi.repository import Gio
10
11 import os
12 import locale
13
14 locale.setlocale(locale.LC_ALL, '')
15
16 # parse file
17 icc = Colord.Icc.new()
18 f = Gio.file_new_for_path('/usr/share/color/icc/colord/sRGB.icc')
19 cancellable = Gio.Cancellable.new()
20 icc.load_file(f, Colord.IccLoadFlags.METADATA, cancellable)
21
22 # get details about the profile
23 print("Filename:", icc.get_filename())
24 print("License:", icc.get_metadata_item("License"))
25
26 # get translated UTF-8 strings where available
27 locale = os.getenv("LANG")
28 print("Description:", icc.get_description(locale))
29 print("Model:", icc.get_model(locale))
30 print("Copyright:", icc.get_copyright(locale))