[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[firstboot] Fixed the eula module to show Red Hat license (#563734)



---
 modules/eula.py |   79 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 59 insertions(+), 20 deletions(-)

diff --git a/modules/eula.py b/modules/eula.py
index 2b60799..09fe2e8 100644
--- a/modules/eula.py
+++ b/modules/eula.py
@@ -18,6 +18,8 @@
 # with the express permission of Red Hat, Inc. 
 #
 import gtk
+import os
+import glob
 
 from firstboot.config import *
 from firstboot.constants import *
@@ -37,30 +39,67 @@ class moduleClass(Module):
         self.icon = "workstation.png"
 
     def apply(self, interface, testing=False):
-        return RESULT_SUCCESS
+        if self.okButton.get_active() == True:
+            return RESULT_SUCCESS
+        else:
+            dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE,
+                                    (_("Do you want to reread or reconsider the Licence Agreement?  " 
+                                       "If not, please shut down the computer and remove this "
+                                       "product from your system. ")))
+
+            dlg.set_position(gtk.WIN_POS_CENTER)
+            dlg.set_modal(True)
+
+            continueButton = dlg.add_button(_("_Reread license"), 0)
+            shutdownButton = dlg.add_button(_("_Shut down"), 1)
+            continueButton.grab_focus()
+
+            rc = dlg.run()
+            dlg.destroy()
+
+            if rc == 0:
+                return RESULT_FAILURE
+            elif rc == 1:
+                os.system("/sbin/halt")
+                return RESULT_FAILURE
 
     def createScreen(self):
         self.vbox = gtk.VBox(spacing=10)
 
-        label = gtk.Label(_("""Thank you for installing Fedora.  Fedora is a \
-compilation of software packages, each under its own license.  The \
-compilation is made available under the GNU General Public License version \
-2.  There are no restrictions on using, copying, or modifying this code.  \
-However, there are restrictions and obligations that apply to the \
-redistribution of the code, either in its original or a modified form.  \
-Among other things, those restrictions/obligations pertain to the \
-licensing of the redistribution, trademark rights, and export control.\n\n\
-If you would like to understand what those restrictions are, please \
-visit http://fedoraproject.org/wiki/Legal/Licenses/LicenseAgreement.""";))
-        label.set_line_wrap(True)
-        label.set_alignment(0.0, 0.0)
-        label.set_size_request(500, -1)
-        self.vbox.pack_start(label, expand=False, fill=False)
-
-        label = gtk.Label(_("Understood, please proceed."))
-        label.set_alignment(0.0, 0.1)
-
-        self.vbox.pack_start(label)
+        internalVBox = gtk.VBox()
+        internalVBox.set_border_width(10)
+        internalVBox.set_spacing(5)
+
+        textBuffer = gtk.TextBuffer()
+        textView = gtk.TextView()
+        textView.set_editable(False)
+        textSW = gtk.ScrolledWindow()
+        textSW.set_shadow_type(gtk.SHADOW_IN)
+        textSW.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        textSW.add(textView)
+
+        try:
+            path = glob.glob("/usr/share/doc/redhat-release*/EULA")[0]
+        except IndexError:
+            lines = "No license file\n"
+        else:
+            lines = open(path).readlines()
+
+        iter = textBuffer.get_iter_at_offset(0)
+
+        for line in lines:
+            textBuffer.insert(iter, line)
+        textView.set_buffer(textBuffer)
+
+        self.okButton = gtk.RadioButton(None, (_("_Yes, I agree to the License Agreement")))
+        self.noButton = gtk.RadioButton(self.okButton, (_("N_o, I do not agree")))
+        self.okButton.set_active(True)
+
+        internalVBox.pack_start(textSW, True)
+        internalVBox.pack_start(self.okButton, False)
+        internalVBox.pack_start(self.noButton, False)
+
+        self.vbox.pack_start(internalVBox, True, 5)
 
     def initializeUI(self):
         pass
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]