This file is indexed.

/usr/share/pyshared/kivy/modules/screen.py is in python-kivy 1.7.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
'''
Screen
======

This module change some environement and configuration to match the density /
dpi / screensize of a specific devices.

To see a list of the available screenid, just run::

    python main.py -m screen

Simulate a medium-density screen as Motolora Droid 2::

    python main.py -m screen:droid2

Simulate a high-density screen as HTC One X, in portrait::

    python main.py -m screen:onex,portrait

Simulate the iPad 2 screen::

    python main.py -m screen:ipad
'''

import sys
from os import environ
from kivy.config import Config
from kivy.logger import Logger

# taken from http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density
devices = {
    # device: (name, width, height, dpi, density)
    'onex': ('HTC One X', 1280, 720, 312, 2),
    's3': ('Galaxy SIII', 1280, 720, 306, 2),
    'droid2': ('Motolora Droid 2', 854, 480, 240, 1.5),
    'xoom': ('Motolora Xoom', 1280, 800, 149, 1),
    'ipad': ('iPad (1 and 2)', 1024, 768, 132, 1),
    'ipad3': ('iPad 3', 2048, 1536, 264, 2),
    'iphone4': ('iPhone 4', 640, 960, 326, 2),
    'iphone5': ('iPhone 5', 640, 1136, 326, 2),
}


def start(win, ctx):
    pass


def stop(win, ctx):
    pass


def apply_device(device, scale, orientation):
    name, width, height, dpi, density = devices[device]
    if orientation == 'portrait':
        width, height = height, width
    Logger.info('Screen: Apply screen settings for {0}'.format(name))
    Logger.info('Screen: size={0}x{1} dpi={2} density={3} '
        'orientation={4}'.format(width, height, dpi, density, orientation))
    environ['KIVY_METRICS_DENSITY'] = str(density)
    environ['KIVY_DPI'] = str(dpi)
    Config.set('graphics', 'width', str(width))
    Config.set('graphics', 'height', str(height))
    Config.set('graphics', 'fullscreen', '0')
    Config.set('graphics', 'show_mousecursor', '1')


def usage(device=None):
    if device:
        Logger.error('Screen: The specified device ({0}) is unknow.',
                device)
    print '\nModule usage: python main.py -m screen,deviceid[,orientation]\n'
    print 'Availables devices:\n'
    print '{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
        'Device ID', 'Name', 'Width', 'Height', 'DPI', 'Density')
    for device, info in devices.iteritems():
        print '{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
            device, *info)
    print '\n'
    print 'Simulate a medium-density screen as Motolora Droid 2:\n'
    print '    python main.py -m screen:droid2\n'
    print 'Simulate a high-density screen as HTC One X, in portrait:\n'
    print '    python main.py -m screen:onex,portrait\n'
    print 'Simulate the iPad 2 screen\n'
    print '    python main.py -m screen:ipad\n'
    sys.exit(1)


def configure(ctx):
    scale = ctx.pop('scale', None)
    orientation = 'landscape'
    ctx.pop('landscape', None)
    if ctx.pop('portrait', None):
        orientation = 'portrait'
    if not ctx:
        return usage(None)
    device = ctx.keys()[0]
    if device not in devices:
        return usage('')
    apply_device(device, scale, orientation)