Exemple #1
0
    def __init__(self, data, storage, payload):
        super().__init__(data, storage, payload)
        self.title = N_("Partition Scheme Options")
        self._container = None
        self.part_schemes = OrderedDict()

        self._auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
        pre_select = self._auto_part_proxy.Type
        supported_choices = get_supported_autopart_choices()

        if supported_choices:
            # Fallback value (eg when default is not supported)
            self._selected_scheme_value = supported_choices[0][1]

        for item in supported_choices:
            self.part_schemes[item[0]] = item[1]
            if item[1] == pre_select:
                self._selected_scheme_value = item[1]
Exemple #2
0
    def __init__(self, data, storage, payload):
        super().__init__(data, storage, payload)
        self.title = N_("Partition Scheme Options")
        self._container = None
        self.part_schemes = OrderedDict()

        self._auto_part_proxy = STORAGE.get_proxy(AUTO_PARTITIONING)
        pre_select = self._auto_part_proxy.Type
        supported_choices = get_supported_autopart_choices()

        if supported_choices:
            # Fallback value (eg when default is not supported)
            self._selected_scheme_value = supported_choices[0][1]

        for item in supported_choices:
            self.part_schemes[item[0]] = item[1]
            if item[1] == pre_select:
                self._selected_scheme_value = item[1]
Exemple #3
0
    def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True):
        super().__init__(title)

        # Create a box where we store the "Here's how you create a new blah" info.
        self._createBox = Gtk.Grid()
        self._createBox.set_row_spacing(6)
        self._createBox.set_column_spacing(6)
        self._createBox.set_margin_start(16)

        label = Gtk.Label(label=_("You haven't created any mount points for your "
                            "%(product)s %(version)s installation yet.  "
                            "You can:") % {"product" : productName, "version" : productVersion},
                            wrap=True, xalign=0, yalign=0.5)
        self._createBox.attach(label, 0, 0, 2, 1)

        dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False)
        self._createBox.attach(dot, 0, 1, 1, 1)

        self._createNewButton = Gtk.LinkButton(uri="",
                label=C_("GUI|Custom Partitioning|Autopart Page", "_Click here to create them automatically."))
        label = self._createNewButton.get_children()[0]
        label.set_xalign(0)
        label.set_yalign(0.5)
        label.set_hexpand(True)
        label.set_line_wrap(True)
        label.set_use_underline(True)

        # Create this now to pass into the callback.  It will be populated later
        # on in this method.
        store = Gtk.ListStore(str, int)
        combo = Gtk.ComboBox(model=store)
        cellrendr = Gtk.CellRendererText()
        combo.pack_start(cellrendr, True)
        combo.add_attribute(cellrendr, "text", 0)
        combo.connect("changed", autopartTypeChangedCB)

        self._createNewButton.set_has_tooltip(False)
        self._createNewButton.set_halign(Gtk.Align.START)
        self._createNewButton.connect("clicked", createClickedCB, combo)
        self._createNewButton.connect("activate-link", lambda *args: Gtk.true())
        self._createBox.attach(self._createNewButton, 1, 1, 1, 1)

        dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False)
        self._createBox.attach(dot, 0, 2, 1, 1)

        label = Gtk.Label(label=_("Create new mount points by clicking the '+' button."),
                          xalign=0, yalign=0.5, hexpand=True, wrap=True)
        self._createBox.attach(label, 1, 2, 1, 1)

        if partitionsToReuse:
            dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False)
            self._createBox.attach(dot, 0, 3, 1, 1)

            label = Gtk.Label(label=_("Or, assign new mount points to existing "
                                      "partitions after selecting them below."),
                              xalign=0, yalign=0.5, hexpand=True, wrap=True)
            self._createBox.attach(label, 1, 3, 1, 1)

        label = Gtk.Label(label=C_("GUI|Custom Partitioning|Autopart Page", "_New mount points will use the following partitioning scheme:"),
                          xalign=0, yalign=0.5, wrap=True, use_underline=True)
        self._createBox.attach(label, 0, 4, 2, 1)
        label.set_mnemonic_widget(combo)

        default = None
        for name, code in get_supported_autopart_choices():
            itr = store.append([_(name), code])
            if code == DEFAULT_AUTOPART_TYPE:
                default = itr

        combo.set_margin_start(18)
        combo.set_margin_end(18)
        combo.set_hexpand(False)
        combo.set_active_iter(default or store.get_iter_first())

        self._createBox.attach(combo, 0, 5, 2, 1)

        self.add(self._createBox)
Exemple #4
0
    def __init__(self,
                 title,
                 createClickedCB,
                 autopartTypeChangedCB,
                 partitionsToReuse=True):
        super().__init__(title)

        # Create a box where we store the "Here's how you create a new blah" info.
        self._createBox = Gtk.Grid()
        self._createBox.set_row_spacing(6)
        self._createBox.set_column_spacing(6)
        self._createBox.set_margin_start(16)

        label = Gtk.Label(
            label=_("You haven't created any mount points for your "
                    "%(product)s %(version)s installation yet.  "
                    "You can:") % {
                        "product": productName,
                        "version": productVersion
                    },
            wrap=True,
            xalign=0,
            yalign=0.5)
        self._createBox.attach(label, 0, 0, 2, 1)

        dot = Gtk.Label(label="•", xalign=0.5, yalign=0.4, hexpand=False)
        self._createBox.attach(dot, 0, 1, 1, 1)

        self._createNewButton = Gtk.LinkButton(
            uri="",
            label=C_("GUI|Custom Partitioning|Autopart Page",
                     "_Click here to create them automatically."))
        label = self._createNewButton.get_children()[0]
        label.set_xalign(0)
        label.set_yalign(0.5)
        label.set_hexpand(True)
        label.set_line_wrap(True)
        label.set_use_underline(True)

        # Create this now to pass into the callback.  It will be populated later
        # on in this method.
        store = Gtk.ListStore(str, int)
        combo = Gtk.ComboBox(model=store)
        cellrendr = Gtk.CellRendererText()
        combo.pack_start(cellrendr, True)
        combo.add_attribute(cellrendr, "text", 0)
        combo.connect("changed", autopartTypeChangedCB)

        self._createNewButton.set_has_tooltip(False)
        self._createNewButton.set_halign(Gtk.Align.START)
        self._createNewButton.connect("clicked", createClickedCB, combo)
        self._createNewButton.connect("activate-link",
                                      lambda *args: Gtk.true())
        self._createBox.attach(self._createNewButton, 1, 1, 1, 1)

        dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False)
        self._createBox.attach(dot, 0, 2, 1, 1)

        label = Gtk.Label(
            label=_("Create new mount points by clicking the '+' button."),
            xalign=0,
            yalign=0.5,
            hexpand=True,
            wrap=True)
        self._createBox.attach(label, 1, 2, 1, 1)

        if partitionsToReuse:
            dot = Gtk.Label(label="•", xalign=0.5, yalign=0, hexpand=False)
            self._createBox.attach(dot, 0, 3, 1, 1)

            label = Gtk.Label(label=_(
                "Or, assign new mount points to existing "
                "partitions after selecting them below."),
                              xalign=0,
                              yalign=0.5,
                              hexpand=True,
                              wrap=True)
            self._createBox.attach(label, 1, 3, 1, 1)

        label = Gtk.Label(label=C_(
            "GUI|Custom Partitioning|Autopart Page",
            "_New mount points will use the following partitioning scheme:"),
                          xalign=0,
                          yalign=0.5,
                          wrap=True,
                          use_underline=True)
        self._createBox.attach(label, 0, 4, 2, 1)
        label.set_mnemonic_widget(combo)

        default = None
        for name, code in get_supported_autopart_choices():
            itr = store.append([_(name), code])
            if code == DEFAULT_AUTOPART_TYPE:
                default = itr

        combo.set_margin_start(18)
        combo.set_margin_end(18)
        combo.set_hexpand(False)
        combo.set_active_iter(default or store.get_iter_first())

        self._createBox.attach(combo, 0, 5, 2, 1)

        self.add(self._createBox)