KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/task/21573/root/usr/share/firstboot/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/task/21573/root/usr/share/firstboot/modules/eula.py
from gtk import *
import string
import gtk
import gobject
import sys
import functions
import rhpl.iconv
import os

##
## I18N
## 
import gettext
gettext.bindtextdomain ("firstboot", "/usr/share/locale")
gettext.textdomain ("firstboot")
_=gettext.gettext

class childWindow:
    #You must specify a runPriority for the order in which you wish your module to run
    runPriority = 15
    moduleName = (_("License Agreement"))
    # Turn this thing off completely
    skipme=True

    def launch(self, doDebug = None):
        self.doDebug = doDebug
        if self.doDebug:
            print "initializing eula module"

        self.vbox = gtk.VBox()
        self.vbox.set_size_request(400, 200)

        msg = (_("License Agreement"))

        title_pix = functions.imageFromFile("workstation.png")

        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)

        lang = os.environ["LANG"]
        if len(string.split(lang, ".")) > 1:
            lang = string.split(lang, ".")[0]

        path = "/usr/share/eula/eula.%s" % lang

        if not os.access(path, os.R_OK):
            #Try to open the translated eula
            lines = open("/usr/share/eula/eula.en_US").readlines()            
        else:
            #If we don't have a translation for this locale, just open the English one
            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)
        return self.vbox, title_pix, msg

    def apply(self, notebook):
        if self.okButton.get_active() == TRUE:
            return 0
        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 None
            elif rc == 1:
                if self.doDebug:
                    print "shut down system"

                os.system("/sbin/halt")
                return None
                

Anon7 - 2021