This file is indexed.

/usr/lib/python2.7/dist-packages/ubuntu-sso-client/ubuntu_sso/qt/network_detection_page.py is in ubuntu-sso-client-qt 13.10-0ubuntu6.

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
# -*- coding: utf-8 -*-
#
# Copyright 2012 Canonical Ltd.
#
# 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.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# In addition, as a special exception, the copyright holders give
# permission to link the code of portions of this program with the
# OpenSSL library under certain conditions as described in each
# individual source file, and distribute linked combinations
# including the two.
# You must obey the GNU General Public License in all respects
# for all of the code used other than OpenSSL.  If you modify
# file(s) with this exception, you may extend this exception to your
# version of the file(s), but you are not obligated to do so.  If you
# do not wish to do so, delete this exception statement from your
# version.  If you delete this exception statement from all source
# files in the program, then also delete it here.
"""Pages from SSO."""

from twisted.internet import defer
from PyQt4 import QtGui, QtCore

from ubuntu_sso import networkstate
from ubuntu_sso.logger import setup_logging
from ubuntu_sso.qt.sso_wizard_page import SSOWizardPage
from ubuntu_sso.qt.ui import network_detection_ui
from ubuntu_sso.utils.ui import (
    CLOSE_AND_SETUP_LATER,
    NETWORK_DETECTION_TITLE,
    NETWORK_DETECTION_WARNING,
    TRY_AGAIN_BUTTON,
)


logger = setup_logging('ubuntu_sso.network_detection_page')


class NetworkDetectionPage(SSOWizardPage):

    """Widget to show if we don't detect a network connection."""

    ui_class = network_detection_ui.Ui_Form
    connectionDetected = QtCore.pyqtSignal()

    def __init__(self, *args, **kwargs):
        super(NetworkDetectionPage, self).__init__(*args, **kwargs)
        banner_pixmap = kwargs.pop('banner_pixmap', None)
        if banner_pixmap is not None:
            self.ui.image_label.setPixmap(banner_pixmap)
        self.btn_try_again = None

    # pylint: disable=C0103

    def initializePage(self):
        """Set UI details."""
        logger.debug('initializePage - About to show NetworkDetectionPage')
        self.wizard()._next_id = -1

        self.setButtonText(QtGui.QWizard.CustomButton1, TRY_AGAIN_BUTTON)
        self.setButtonText(QtGui.QWizard.CancelButton,
            CLOSE_AND_SETUP_LATER)
        self.wizard().setButtonLayout([QtGui.QWizard.Stretch,
                                       QtGui.QWizard.CustomButton1,
                                       QtGui.QWizard.CancelButton,
                                       ])

        try:
            self.wizard().customButtonClicked.disconnect()
        except TypeError:
            pass

        self.ui.label.setText(NETWORK_DETECTION_WARNING %
                              {'app_name': self.app_name})
        self.btn_try_again = self.wizard().button(QtGui.QWizard.CustomButton1)
        self.btn_try_again.setDefault(True)
        self.wizard().customButtonClicked.connect(self.try_again)

    # pylint: enable=C0103

    @defer.inlineCallbacks
    def try_again(self, button_id=QtGui.QWizard.CustomButton1):
        """Test the connection again."""
        if button_id == QtGui.QWizard.CustomButton1:
            d = yield networkstate.is_machine_connected()
            if d:
                self.connectionDetected.emit()

    def _set_translated_strings(self):
        """Implement in each child."""
        self.setTitle(NETWORK_DETECTION_TITLE)

    def _connect_ui(self):
        """Implement in each child."""