Beispiel #1
0
    def store_values(self):
        """ User wants to continue """
        parent = self.get_toplevel()
        msg = _("Are you REALLY sure you want to continue?")

        try:
            response = show.question(parent, msg)
        except TypeError as ex:
            response = show.question(None, msg)

        if response != Gtk.ResponseType.YES:
            return False

        install_screen = self.get_install_screen()
        self.process = Process(install_screen, self.settings,
                               self.callback_queue)
        self.process.start()
        return True
 def store_values(self):
     response = show.question(
         self.get_toplevel(),
         _("Are you REALLY sure you want to continue?"))
     if response != Gtk.ResponseType.YES:
         return False
     install_screen = self.get_install_screen()
     self.process = Process(install_screen, self.settings, self.callback_queue)
     self.process.start()
     return True
Beispiel #3
0
    def store_values(self):
        """ User wants to continue """
        parent = self.get_toplevel()
        msg = _("Are you REALLY sure you want to continue?")

        try:
            response = show.question(parent, msg)
        except TypeError as ex:
            response = show.question(None, msg)

        if response != Gtk.ResponseType.YES:
            return False

        install_screen = self.get_install_screen()
        self.process = Process(install_screen, self.settings, self.callback_queue)
        self.process.start()
        return True
Beispiel #4
0
class Summary(Page):
    """ Summary Screen """
    def __init__(self,
                 params,
                 prev_page="user_info",
                 next_page="slides",
                 **kwargs):
        """ Init class ui """
        super().__init__(self,
                         params,
                         name="summary",
                         prev_page=prev_page,
                         next_page=next_page,
                         **kwargs)

        self.main_window = params['main_window']

        if not self.main_window:
            raise InstallError("Can't get main window")

        scrolled_window = self.ui.get_object("scrolled_window")
        if scrolled_window:
            scrolled_window.set_policy(Gtk.PolicyType.NEVER,
                                       Gtk.PolicyType.ALWAYS)

        self.num_features = 0
        self.process = None
        self.title = _("Review")

    def translate_ui(self):
        """ Translates all ui elements """
        # self.header.set_subtitle(self.title)

        items = {
            "location": _("Location"),
            "timezone": _("Timezone"),
            "keyboard": _("Keyboard"),
            "de": _("Desktop Environment"),
            "features": _("Features"),
            "partitions": _("Partitions")
        }

        for item_id in items:
            label = self.ui.get_object(item_id + "_label")
            txt = "<b>{0}</b>".format(items[item_id])
            label.set_markup(txt)

        # Fill stateboxes

        # Location
        statebox = self.ui.get_object("location_statebox")
        statebox.set_property("label", self.settings.get('location'))

        # Timezone
        statebox = self.ui.get_object("timezone_statebox")
        txt = "{0}/{1}".format(self.settings.get("timezone_human_country"),
                               self.settings.get("timezone_human_zone"))
        statebox.set_property("label", txt)

        # Keyboard
        statebox = self.ui.get_object("keyboard_statebox")
        layout = self.settings.get("keyboard_layout")
        variant = self.settings.get("keyboard_variant")
        txt = _("Layout: {0}").format(layout)
        if variant:
            txt += ", " + _("Variant: {0}").format(variant)
        statebox.set_property("label", txt)

        # Desktop Environment
        statebox = self.ui.get_object("de_statebox")
        desktop = self.settings.get('desktop')
        desktop_name = desktop_info.NAMES[desktop]
        statebox.set_property("label", desktop_name)

        # Features
        statebox = self.ui.get_object("features_statebox")
        txt = ""
        self.num_features = 0
        for feature in features_info.TITLES:
            if self.settings.get("feature_" + feature):
                feature_title = _(features_info.TITLES[feature])
                txt += "{0}\n".format(feature_title)
                self.num_features += 1
        txt = txt[:-1]
        statebox.set_property("label", txt)

        # Partitions
        install_screen = self.get_install_screen()
        if install_screen:
            txt = ""
            statebox = self.ui.get_object("partitions_statebox")
            changes = install_screen.get_changes()
            if not changes:
                txt = _("Error getting changes from install screen")
                logging.error("Error getting changes from install screen")
            else:
                for action in changes:
                    txt += "{0}\n".format(_(str(action)))
                txt = txt[:-1]
        else:
            txt = _("Error getting changes from install screen")
            logging.error("Error getting changes from install screen")

        statebox.set_property("label", txt)

    def get_install_screen(self):
        """ Returns installation screen page """
        page = "installation_" + self.settings.get('partition_mode')
        install_screen = None
        try:
            install_screen = self.main_window.pages['disk_grp'][page]
        except (AttributeError, KeyError) as page_error:
            msg = "Can't find installation page called {0}: {1}"
            msg = msg.format(page, page_error)
            logging.error(msg)
            raise InstallError(msg)
        return install_screen

    def prepare(self, direction):
        """ Load screen """
        self.translate_ui()

        # self.forward_button.set_label(_("Install now!"))
        # self.forward_button.set_name('fwd_btn_install_now')

        self.show_all()

        # Hide features statebox if no features are selected
        if self.num_features == 0:
            names = ["features_statebox", "features_label"]
            for name in names:
                widget = self.ui.get_object(name)
                widget.hide()

    def store_values(self):
        """ User wants to continue """
        parent = self.get_toplevel()
        msg = _("Are you REALLY sure you want to continue?")

        try:
            response = show.question(parent, msg)
        except TypeError as ex:
            response = show.question(None, msg)

        if response != Gtk.ResponseType.YES:
            return False

        install_screen = self.get_install_screen()
        self.process = Process(install_screen, self.settings,
                               self.callback_queue)
        self.process.start()
        return True

    def get_prev_page(self):
        """ Gets previous page """
        # page = "installation_" + self.settings.get('partition_mode')
        return self.prev_page
class Summary(GtkBaseBox):
    """ Summary Screen """

    def __init__(self, params, prev_page="", next_page="user_info"):
        """ Init class ui """
        super().__init__(self, params, "summary", prev_page, next_page)

        self.main_window = params['main_window']

        scrolled_window = self.ui.get_object("scrolled_window")
        if scrolled_window:
            scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)

        self.num_features = 0
        self.process = None

    def translate_ui(self):
        """ Translates all ui elements """
        txt = _("Installation Summary")
        self.header.set_subtitle(txt)

        items = {
            "location": _("Location"),
            "timezone": _("Timezone"),
            "keyboard": _("Keyboard"),
            "de": _("Desktop Environment"),
            "features": _("Features"),
            "partitions": _("Partitions")}

        for item_id in items:
            label = self.ui.get_object(item_id + "_label")
            txt = "<b>{0}</b>".format(items[item_id])
            label.set_markup(txt)

        # Fill stateboxes

        # Location
        statebox = self.ui.get_object("location_statebox")
        statebox.set_property("label", self.settings.get('location'))

        # Timezone
        statebox = self.ui.get_object("timezone_statebox")
        txt = "{0}/{1}".format(
            self.settings.get("timezone_human_country"),
            self.settings.get("timezone_human_zone"))
        statebox.set_property("label", txt)

        # Keyboard
        statebox = self.ui.get_object("keyboard_statebox")
        layout = self.settings.get("keyboard_layout")
        variant = self.settings.get("keyboard_variant")
        txt = _("Layout: {0}").format(layout)
        if variant:
            txt += ", " + _("Variant: {0}").format(variant)
        statebox.set_property("label", txt)

        # Desktop Environment
        statebox = self.ui.get_object("de_statebox")
        desktop = self.settings.get('desktop')
        desktop_name = desktop_info.NAMES[desktop]
        statebox.set_property("label", desktop_name)

        # Features
        statebox = self.ui.get_object("features_statebox")
        txt = ""
        self.num_features = 0
        for feature in features_info.TITLES:
            if self.settings.get("feature_" + feature):
                txt += "{0}\n".format(features_info.TITLES[feature])
                self.num_features += 1
        txt = txt[:-1]
        statebox.set_property("label", txt)

        # Partitions
        install_screen = self.get_install_screen()
        if install_screen:
            changes = install_screen.get_changes()
            statebox = self.ui.get_object("partitions_statebox")
            txt = ""
            for action in changes:
                txt += "{0}\n".format(str(action))
            txt = txt[:-1]
            statebox.set_property("label", txt)

    def get_install_screen(self):
        page = "installation_" + self.settings.get('partition_mode')
        try:
            install_screen = self.main_window.pages[page]
        except AttributeError:
            install_screen = None
        return install_screen

    def prepare(self, direction):
        """ Load screen """
        self.translate_ui()

        # self.forward_button.set_label(_("Install now!"))
        # self.forward_button.set_name('fwd_btn_install_now')

        self.show_all()

        # Hide features statebox if no features are selected
        if self.num_features == 0:
            statebox = self.ui.get_object("features_statebox")
            statebox.hide()
            label = self.ui.get_object("features_label")
            label.hide()

    def store_values(self):
        response = show.question(
            self.get_toplevel(),
            _("Are you REALLY sure you want to continue?"))
        if response != Gtk.ResponseType.YES:
            return False
        install_screen = self.get_install_screen()
        self.process = Process(install_screen, self.settings, self.callback_queue)
        self.process.start()
        return True

    def get_prev_page(self):
        page = "installation_" + self.settings.get('partition_mode')
        return page