summaryrefslogtreecommitdiffstats
path: root/pyanaconda/installinterfacebase.py
blob: 580c1893777dfd885c0e5efda6e83e87bce11334 (plain)
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
#
# installinterfacebase.py: a baseclass for anaconda interface classes
#
# Copyright (C) 2010  Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY 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/>.
#
# Author(s): Hans de Goede <hdegoede@redhat.com>

import gettext
import sys

_ = lambda x: gettext.ldgettext("anaconda", x)
P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)

import logging
log = logging.getLogger("anaconda")

class InstallInterfaceBase(object):
    def reinitializeWindow(self, title, path, size, description):
        raise NotImplementedError

    def messageWindow(self, title, text, type="ok", default = None,
             custom_buttons=None,  custom_icon=None):
        raise NotImplementedError

    def detailedMessageWindow(self, title, text, longText=None, type="ok",
                              default=None, custom_icon=None,
                              custom_buttons=[], expanded=False):
        raise NotImplementedError

    def methodstrRepoWindow(self, methodstr, exception):
        """ Called when the repo specified by methodstr could not be found.

            Depending on the interface implementation terminates the program or
            gives user a chance to specify a new repo path it then returns. The
            default implementation is to terminate.
        """
        self.messageWindow(
            _("Error Setting Up Repository"),
            _("The following error occurred while setting up the "
              "installation repository:\n\n%(e)s\n\n"
              "Installation can not continue.")
            % {'e': exception},
            type = "custom",
            custom_icon="info",
            custom_buttons=[_("Exit installer")])
        sys.exit(0)

    def hardwareError(self, exception):
        text=_("The installation was stopped due to what seems to be a problem "
               "with your hardware. The exact error message is:\n\n%s.\n\n "
               "The installer will now terminate.") % str(exception)
        self.messageWindow(title=_("Hardware Error Encountered"),
                           text=text,
                           type="custom",
                           custom_icon="error",
                           custom_buttons=[_("_Exit installer")])
        sys.exit(0)

    def unsupported_steps(self):
        """ List of steps this interface is unable to carry out. """
        return []