summaryrefslogtreecommitdiffstats
path: root/iw/confirm_gui.py
blob: 6880e89456f4c0be2cfae9aa891b8ebb9ea1313f (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
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
107
108
109
110
111
#
# confirm_gui.py: install/upgrade point of no return screen.
#
# Copyright 2000-2003 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import gtk
from iw_gui import *
from rhpl.translate import _, N_
from constants import *
from package_gui import queryUpgradeContinue
from image import presentRequiredMediaMessage
import gui
import sys

class ConfirmWindow (InstallWindow):

    # ConfirmWindow tag="aboutupgrade" or "aboutinstall"
    def getScreen (self, labelText, longText):
        hbox = gtk.HBox (True, 5)
        box = gtk.VBox (False, 5)

        pix = gui.readImageFromFile ("about-to-install.png")
        if pix:
            a = gtk.Alignment ()
            a.add (pix)
            a.set (0.5, 0.5, 1.0, 1.0)
            hbox.pack_start (a, False)

	label = gtk.Label (labelText)
        label.set_line_wrap (True)
        label.set_size_request(190, -1)

	label2 = gtk.Label (longText)
        label2.set_line_wrap (True)
        label2.set_size_request(190, -1)
        
        box.pack_start (label, False)
        box.pack_start (label2, False)
        box.set_border_width (5)

        a = gtk.Alignment ()
        a.add (box)
        a.set (0.5, 0.5, 0.0, 0.0)

        hbox.pack_start (a)
        return hbox
        
class InstallConfirmWindow (ConfirmWindow):
    windowTitle = N_("About to Install")
    htmlTag = "aboutinstall"

    def getNext(self):
	if self.id.methodstr.startswith("cdrom://") and (self.id.instClass.name and self.id.instClass.name != "kickstart"):
	    rc = presentRequiredMediaMessage(self.intf, self.id.grpset)
	    
	    if rc == 0:
		rc2 = self.intf.messageWindow(_("Reboot?"),
					_("The system will be rebooted now."),
					type="custom", custom_icon="warning",
					custom_buttons=[_("_Back"), _("_Reboot")])
		if rc2 == 1:
		    sys.exit(0)
		else:
		    raise gui.StayOnScreen

    def getScreen(self, intf, id):
	self.intf = intf
	self.id = id
	
	return ConfirmWindow.getScreen(self,
	    _("Click next to begin installation of %s.") % (productName,),
	    _("A complete log of the installation can be found in "
	      "the file '%s' after rebooting your system.\n\n"
              "A kickstart file containing the installation options "
	      "selected can be found in the file '%s' after rebooting the "
	      "system.") % (u'/root/install.log', '/root/anaconda-ks.cfg'))

class UpgradeConfirmWindow (ConfirmWindow):
    windowTitle = N_("About to Upgrade")
    htmlTag = "aboutupgrade"

    def getNext(self):
	if self.id.methodstr.startswith("cdrom://") and (self.id.instClass.name and self.id.instClass.name != "kickstart"):
	    rc = presentRequiredMediaMessage(self.intf, self.id.grpset)
	    
	    if rc == 0:
		rc2 = self.intf.messageWindow(_("Reboot?"),
					_("The system will be rebooted now."),
					type="custom", custom_icon="warning",
					custom_buttons=[_("_Back"), _("_Reboot")])
		if rc2 == 1:
		    sys.exit(0)
		else:
		    raise gui.StayOnScreen

    def getScreen(self, intf, id):
	self.intf = intf
	self.id = id
	return ConfirmWindow.getScreen(self,
            _("Click next to begin upgrade of %s.") % (productName,),
            _("A complete log of the upgrade can be found in "
	      "the file '%s' after rebooting your system.") % (u'\uFEFF/\uFEFFroot\uFEFF/\uFEFFupgrade\uFEFF.\uFEFFlog',))