This file is indexed.

/usr/lib/python2.7/dist-packages/unity/emulators/unity.py is in unity-autopilot 7.5.0+18.04.20180413-0ubuntu1.

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
100
101
102
103
104
105
106
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
# Author: Thomi Richards
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#

from __future__ import absolute_import

from dbus import Interface, SessionBus

from unity.emulators import UnityIntrospectionObject
from unity.emulators.dash import DashController
from unity.emulators.hud import HudController
from unity.emulators.launcher import LauncherController
from unity.emulators.panel import PanelController
from unity.emulators.screen import Screen
from unity.emulators.shortcut_hint import ShortcutController
from unity.emulators.switcher import SwitcherController
from unity.emulators.window_manager import WindowManager


# acquire the debugging dbus object
UNITY_BUS_NAME = 'com.canonical.Unity'
DEBUG_PATH = '/com/canonical/Unity/Debug'
LOGGING_IFACE = 'com.canonical.Unity.Debug.Logging'


def get_dbus_proxy_object():
    return SessionBus().get_object(UNITY_BUS_NAME, DEBUG_PATH)


def get_dbus_logging_interface():
    return Interface(get_dbus_proxy_object(), LOGGING_IFACE)


def start_log_to_file(file_path):
    """Instruct Unity to start logging to the given file."""
    get_dbus_logging_interface().StartLogToFile(file_path)


def reset_logging():
    """Instruct Unity to stop logging to a file."""
    get_dbus_logging_interface().ResetLogging()


def set_log_severity(component, severity):
    """Instruct Unity to set a log component's severity.

    'component' is the unity logging component name.

    'severity' is the severity name (like 'DEBUG', 'INFO' etc.)

    """
    get_dbus_logging_interface().SetLogSeverity(component, severity)


def log_unity_message(severity, message):
    """Instruct unity to log a message for us.

    severity: one of ('TRACE', 'DEBUG', 'INFO', 'WARNING', 'ERROR').

    message: The message to log.

    For debugging purposes only! If you want to log a message during an autopilot
    test, use the python logging framework instead.

    """
    get_dbus_logging_interface().LogMessage(severity, message)


class Unity(UnityIntrospectionObject):

    @property
    def screen(self):
        return self.get_children_by_type(Screen)[0]

    @property
    def dash(self):
        return self.get_children_by_type(DashController)[0]

    @property
    def hud(self):
        return self.get_children_by_type(HudController)[0]

    @property
    def launcher(self):
        return self.get_children_by_type(LauncherController)[0]

    @property
    def panels(self):
        return self.get_children_by_type(PanelController)[0]

    @property
    def switcher(self):
        return self.get_children_by_type(SwitcherController)[0]

    @property
    def shortcut_hint(self):
        return self.get_children_by_type(ShortcutController)[0]

    @property
    def window_manager(self):
        return self.get_children_by_type(WindowManager)[0]