示例#1
0
    def __init__(self):
        BaseFrontend.__init__(self)

        self.previous_excepthook = sys.excepthook
        sys.excepthook = self.excepthook

        self.debconf_callbacks = {}
        self.language_questions = ('oem_config', 'language_label',
                                   'language_heading_label',
                                   'timezone_heading_label',
                                   'keyboard_heading_label',
                                   'user_heading_label',
                                   'back', 'next')
        self.current_step = None
        # Set default language.
        dbfilter = language.Language(self, self.debconf_communicator())
        dbfilter.cleanup()
        dbfilter.db.shutdown()
        self.allowed_change_step = True
        self.allowed_go_forward = True
        self.mainLoopRunning = False
        self.apply_changes = False

        appName = "oem-config"
        catalog = ""
        programName = ki18n("OEM Config")
        version = "1.0"
        description = ki18n("Sets up the system")
        license = KAboutData.License_GPL
        copyright = ki18n("2006, 2007 Anirudh Ramesh. 2008 Canonical Ltd.")
        text = ki18n("none")
        homePage = "http://www.kubuntu.org"
        bugEmail = ""

        aboutData = KAboutData(appName, catalog, programName, version, description,
                               license, copyright, text, homePage, bugEmail)

        KCmdLineArgs.init(['oem-config', '-style=oxygen'], aboutData)

        self.app = KApplication()
        # We want to hide the minimise button if running in the ubiquity-only mode (no desktop)
        # To achieve this we need to set window flags to Dialog but we also need a parent widget which is showing
        # else Qt tried to be clever and puts the minimise button back
        self.parentWidget = QWidget()
        self.parentWidget.show()

        # The parent for our actual user interface window, this is needed only because Oxygen widget 
        # style refuses to draw our background on a top level widget
        self.parent2 = QWidget(self.parentWidget)
        self.parent2.setAutoFillBackground(True)
        self.parent2.setWindowState(Qt.WindowFullScreen)
        self.parent2.setWindowFlags(Qt.Dialog)
        layout = QVBoxLayout(self.parent2)
        layout.setContentsMargins(0, 0, 0, 0)

        self.userinterface = OEMConfUI(self.parent2)
        self.userinterface.setFrontend(self)
        layout.addWidget(self.userinterface)
        self.parent2.show()

        self.userinterface.next.setIcon(KIcon("go-next"))
        self.userinterface.back.setIcon(KIcon("go-previous"))

        self.translate_widgets()

        self.customize_installer()
        
        self.tzmap = TimezoneMap(self)
        map_vbox = QVBoxLayout(self.userinterface.map_frame)
        map_vbox.setMargin(0)
        map_vbox.addWidget(self.tzmap)