• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Module for display info."""
6
7class DisplayInfo(object):
8    """The class match displayInfo object from chrome.system.display API.
9    """
10
11    class Bounds(object):
12        def __init__(self, d):
13            """The class match Bounds object from chrome.system.display API.
14
15            @param d: Map of display properties.
16            """
17
18            self.left = d['left']
19            self.top = d['top']
20            self.width = d['width']
21            self.height = d['height']
22
23
24    class Insets(object):
25        def __init__(self, d):
26            """The class match Insets object from chrome.system.display API.
27
28            @param d: Map of display properties.
29            """
30
31            self.left = d['left']
32            self.top = d['top']
33            self.right = d['right']
34            self.bottom = d['bottom']
35
36
37    class Edid(object):
38        def __init__(self, edid):
39            """The class match the Edid object from chrome.system.display API.
40
41            @param edid: Map of Edid properties.
42            """
43
44            self.manufacturer_id = edid['manufacturerId']
45            self.year_of_manufacture = edid['yearOfManufacture']
46            self.product_id = edid['productId']
47
48
49    def __init__(self, d):
50        self.display_id = d['id']
51        self.name = d['name']
52        self.mirroring_source_id = d['mirroringSourceId']
53        self.is_primary = d['isPrimary']
54        self.is_internal = d['isInternal']
55        self.is_enabled = d['isEnabled']
56        self.dpi_x = d['dpiX']
57        self.dpi_y = d['dpiY']
58        self.rotation = d['rotation']
59        self.bounds = self.Bounds(d['bounds'])
60        self.overscan = self.Insets(d['overscan'])
61        self.work_area = self.Bounds(d['workArea'])
62        self.edid = self.Edid(d['edid'])
63