Пример #1
0
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

        with misc.raised_privileges():
            self.console = open('/dev/console', 'w')
        if not self.console:
            self.console = sys.stdout # better than crashing
        self.installing = False
        self.progress_position = ubiquity.progressposition.ProgressPosition()
        self.progress_val = 0
        self.progress_info = ''
        self.mainloop = GObject.MainLoop()

        self.pages = []
        for mod in self.modules:
            if hasattr(mod.module, 'PageNoninteractive'):
                mod.controller = ubiquity.frontend.base.Controller(self)
                mod.ui_class = mod.module.PageNoninteractive
                mod.ui = mod.ui_class(mod.controller)
                self.pages.append(mod)

        i18n.reset_locale(self)

        if self.oem_config:
            misc.execute_root('apt-install', 'oem-config-gtk')
Пример #2
0
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

        with misc.raised_privileges():
            self.console = open('/dev/console', 'w')
        if not self.console:
            self.console = sys.stdout  # better than crashing
        self.installing = False
        self.progress_position = ubiquity.progressposition.ProgressPosition()
        self.progress_val = 0
        self.progress_info = ''
        self.mainloop = GObject.MainLoop()

        self.pages = []
        for mod in self.modules:
            if hasattr(mod.module, 'PageNoninteractive'):
                mod.controller = ubiquity.frontend.base.Controller(self)
                mod.ui_class = mod.module.PageNoninteractive
                mod.ui = mod.ui_class(mod.controller)
                self.pages.append(mod)

        i18n.reset_locale(self)

        if self.oem_config:
            misc.execute_root('apt-install', 'oem-config-gtk')
Пример #3
0
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

        if self.oem_user_config:
            self.db.info('ubiquity/text/oem_user_config_title')
        else:
            self.db.info('ubiquity/text/live_installer')

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

        # Set default language.
        i18n.reset_locale(self)

        self.stop_debconf()
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

        if self.oem_user_config:
            self.db.info('ubiquity/text/oem_user_config_title')
        else:
            self.db.info('ubiquity/text/live_installer')

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

        # Set default language.
        i18n.reset_locale(self)

        self.stop_debconf()
Пример #5
0
 def debconffilter_done(self, dbfilter):
     if BaseFrontend.debconffilter_done(self, dbfilter):
         if self.mainloop.is_running():
             self.mainloop.quit()
         return True
     else:
         return False
Пример #6
0
 def debconffilter_done(self, dbfilter):
     if BaseFrontend.debconffilter_done(self, dbfilter):
         if self.mainloop.is_running():
             self.mainloop.quit()
         return True
     else:
         return False
Пример #7
0
 def debconf_communicator(self):
     if 'DEBIAN_HAS_FRONTEND' in os.environ:
         # We may only instantiate Debconf once, as it fiddles with
         # sys.stdout. See LP #24727.
         if self.db is None:
             self.db = PersistentDebconfCommunicator()
         return self.db
     else:
         # This needs to be instantiated afresh each time, as normal.
         return BaseFrontend.debconf_communicator(self)
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

        self.installing = False
        self.progress_position = ubiquity.progressposition.ProgressPosition()
        self.fullname = ''
        self.username = ''
        self.password = ''
        self.verifiedpassword = ''
        self.progress_val = 0
        self.progress_info = ''
        self.mainloop = gobject.MainLoop()

        dbfilter = language.Language(self, self.debconf_communicator())
        dbfilter.cleanup()
        dbfilter.db.shutdown()

        if self.oem_config:
            execute_root('apt-install', 'oem-config-gtk')
 def debconf_communicator(self):
     if 'DEBIAN_HAS_FRONTEND' in os.environ:
         # We may only instantiate Debconf once, as it fiddles with
         # sys.stdout. See LP #24727.
         if self.db is None:
             self.db = PersistentDebconfCommunicator()
         return self.db
     else:
         # This needs to be instantiated afresh each time, as normal.
         return BaseFrontend.debconf_communicator(self)
Пример #10
0
 def debconffilter_done (self, dbfilter):
     # processing events here prevents GUI from hanging until mouse moves (LP #556376)
     self.app.processEvents()
     ##FIXME in Qt 4 without this disconnect it calls watch_debconf_fd_helper_read once more causing
     ## a crash after the keyboard stage.  No idea why.
     try:
         self.socketNotifierRead.activated.disconnect(self.watch_debconf_fd_helper_read)
     except Exception:
         pass # May not be connected if it's a trivial dbfilter
     if BaseFrontend.debconffilter_done(self, dbfilter):
         self.app.exit()
         return True
     else:
         return False
Пример #11
0
    def __init__(self, distro):
        BaseFrontend.__init__(self, distro)

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

        appName     = "kubuntu-ubiquity"
        catalog     = ""
        programName = ki18n ("Installer")
        ver         = "1.0"
        description = ki18n ("Live CD Installer for Kubuntu")
        rights      = KAboutData.License_GPL
        copy        = ki18n ("(c) 2006 Canonical Ltd")
        text        = ki18n ("none")
        homePage    = "http://wiki.kubuntu.org/KubuntuUbiquity"
        bugEmail    = "*****@*****.**"

        about = KAboutData (appName, catalog, programName, ver, description,
                            rights, copy, text, homePage, bugEmail)
        about.addAuthor(ki18n("Jonathan Riddell"), KLocalizedString() ,"*****@*****.**")
        about.addAuthor(ki18n("Roman Shtylman"), KLocalizedString() ,"*****@*****.**")
        KCmdLineArgs.init([""],about)

        # KApplication won't initialise if real UID != effective UID.  On
        # the other hand, we can't talk to D-Bus unless the effective user
        # is the live CD user.  Oh dear.  The solution is to use saved IDs:
        # if we hide our rootliness in the saved IDs, then neither
        # KApplication nor D-Bus will spot it.
        drop_privileges_save()
        try:
            self.app = KApplication()
            self.app.setStyleSheet(file(os.path.join(UIDIR, "style.qss")).read())
        finally:
            regain_privileges_save()

        self.ui = UbiquityUI()

        # handle smaller screens (old school eee pc
        if (QApplication.desktop().screenGeometry().height() < 560):
            self.ui.main_frame.setFixedHeight(470)
            self.ui.main_frame.setStyleSheet(file(os.path.join(UIDIR, "style_small.qss")).read())

        # initially the steps widget is not visible
        # it becomes visible once the first step becomes active
        self.ui.steps_widget.setVisible(False)
        self.ui.content_widget.setVisible(False)

        if 'UBIQUITY_GREETER' in os.environ:
            self.ui.minimize_button.hide()

        self.ui.setWindowState(self.ui.windowState() ^ Qt.WindowFullScreen)

        self.ui.setWizard(self)
        #self.ui.setWindowFlags(Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowMinMaxButtonsHint)

        #hide the minimize button if in "install only" mode
        if 'UBIQUITY_ONLY' in os.environ or 'UBIQUITY_GREETER' in os.environ:
            self.ui.minimize_button.setVisible(False)

        self.stackLayout = QStackedLayout(self.ui.widgetStack)

        self.pages = []
        self.pagesindex = 0
        self.pageslen = 0
        for mod in self.modules:
            if hasattr(mod.module, 'PageKde'):
                mod.ui_class = mod.module.PageKde
                mod.controller = Controller(self)
                mod.ui = mod.ui_class(mod.controller)
                widgets = mod.ui.get('plugin_widgets')
                optional_widgets = mod.ui.get('plugin_optional_widgets')
                breadcrumb = mod.ui.get('plugin_breadcrumb')
                if widgets or optional_widgets:
                    def fill_out(widget_list):
                        rv = []
                        if not isinstance(widget_list, list):
                            widget_list = [widget_list]
                        for w in widget_list:
                            if not w: continue
                            if not isinstance(w, str):
                                # Until we ship with no pre-built pages, insert
                                # at 'beginning'
                                self.stackLayout.insertWidget(self.pageslen, w)
                            elif hasattr(self.ui, w):
                                w = getattr(self.ui, w)
                            rv.append(w)
                        return rv
                    mod.widgets = fill_out(widgets)
                    mod.optional_widgets = fill_out(optional_widgets)
                    if not hasattr(mod.ui, 'plugin_breadcrumb'):
                        breadcrumb = '------' # just a placeholder
                    if breadcrumb:
                        mod.breadcrumb_question = breadcrumb
                        mod.breadcrumb = SqueezeLabel()
                        mod.breadcrumb.setObjectName(mod.breadcrumb_question)
                        label_index = self.ui.steps_widget.layout().count() - 2 # Room for install crumb
                        self.ui.steps_widget.layout().insertWidget(label_index, mod.breadcrumb)
                    else:
                        mod.breadcrumb_question = None
                        mod.breadcrumb = None # page intentionally didn't want a label (intro)
                    self.pageslen += 1
                    self.pages.append(mod)
        self.user_pageslen = self.pageslen

        # declare attributes
        self.language_questions = (
            'live_installer',
            'step_label',
            'quit',
            'back',
            'next',
            'warning_dialog',
            'warning_dialog_label',
            'cancelbutton',
            'exitbutton',
            'install_process_label'
        )

        self.current_page = None
        self.first_seen_page = None
        self.allowed_change_step = True
        self.allowed_go_backward = True
        self.allowed_go_forward = True
        self.stay_on_page = False
        self.mainLoopRunning = False
        self.progress_position = ubiquity.progressposition.ProgressPosition()
        self.progress_cancelled = False
        self.previous_partitioning_page = self.step_index("stepPartAuto")
        self.installing = False
        self.installing_no_return = False
        self.returncode = 0
        self.backup = False
        self.history = []
        self.progressDialog = ProgressDialog(0, 0, self.ui)

        self.laptop = execute("laptop-detect")

        # set default language
        self.locale = i18n.reset_locale(self)

        self.debconf_callbacks = {}    # array to keep callback functions needed by debconf file descriptors

        self.ui.setWindowIcon(KIcon("ubiquity"))
        self.allow_go_backward(False)

        if not 'UBIQUITY_AUTOMATIC' in os.environ:
            self.ui.show()

        self.stop_debconf()
        self.translate_widgets(reget=True)

        if self.oem_config:
            self.ui.setWindowTitle(self.get_string('oem_config_title'))
        elif self.oem_user_config:
            self.ui.setWindowTitle(self.get_string('oem_user_config_title'))
            self.ui.setWindowIcon(KIcon("preferences-system"))
            flags = self.ui.windowFlags() ^ Qt.WindowMinMaxButtonsHint
            if hasattr(Qt, 'WindowCloseButtonHint'):
                flags = flags ^ Qt.WindowCloseButtonHint
            self.ui.setWindowFlags(flags)
            self.ui.quit.hide()
            # TODO cjwatson 2010-04-07: provide alternative strings instead
            self.ui.install_process_label.hide()
            self.ui.breadcrumb_install.hide()

        iconLoader = KIconLoader()
        warningIcon = iconLoader.loadIcon("dialog-warning", KIconLoader.Desktop)

        # TODO move to plugin
        #self.ui.part_advanced_warning_image.setPixmap(warningIcon)

        self.forwardIcon = KIcon("go-next")
        self.ui.next.setIcon(self.forwardIcon)

        #Used for the last step
        self.applyIcon = KIcon("dialog-ok-apply")

        backIcon = KIcon("go-previous")
        self.ui.back.setIcon(backIcon)

        quitIcon = KIcon("dialog-close")
        self.ui.quit.setIcon(quitIcon)

        self.ui.progressBar.hide()
        self.ui.progressCancel.hide()
Пример #12
0
 def stop_debconf(self):
     if 'DEBIAN_HAS_FRONTEND' not in os.environ:
         BaseFrontend.stop_debconf(self)
Пример #13
0
 def set_autopartition_choices(self, choices, extra_options,
                               resize_choice, manual_choice,
                               biggest_free_choice):
     """Set available autopartitioning choices."""
     BaseFrontend.set_autopartition_choices(self, choices, extra_options,
         resize_choice, manual_choice, biggest_free_choice)
 def stop_debconf(self):
     if 'DEBIAN_HAS_FRONTEND' not in os.environ:
         BaseFrontend.stop_debconf(self)