Beispiel #1
0
def get_supported_autopart_choices():
    """Get the supported autopart choices.

    # FIXME: Move this function to the Storage module.
    """
    from blivet.devicefactory import is_supported_device_type
    return [c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]])]
Beispiel #2
0
    def test_vdo_dependencies_devicefactory(self):
        with patch("blivet.devices.lvm.LVMVDOPoolMixin._external_dependencies",
                   new=[
                       blivet.tasks.availability.unavailable_resource(
                           "VDO unavailability test")
                   ]):
            with patch(
                    "blivet.devices.lvm.LVMVDOLogicalVolumeMixin._external_dependencies",
                    new=[
                        blivet.tasks.availability.unavailable_resource(
                            "VDO unavailability test")
                    ]):

                # shouldn't affect "normal" LVM
                lvm_supported = devicefactory.is_supported_device_type(
                    devicefactory.DEVICE_TYPE_LVM)
                self.assertTrue(lvm_supported)

                vdo_supported = devicefactory.is_supported_device_type(
                    devicefactory.DEVICE_TYPE_LVM_VDO)
                self.assertFalse(vdo_supported)
Beispiel #3
0
    def _set_up_storage(self):
        if not devicefactory.is_supported_device_type(
                devicefactory.DEVICE_TYPE_LVM_VDO):
            self.skipTest("VDO not supported, skipping")

        self.blivet.factory_device(devicefactory.DEVICE_TYPE_LVM_VDO,
                                   size=Size("10 GiB"),
                                   fstype="ext4",
                                   disks=self.blivet.disks[:],
                                   name="vdolv",
                                   pool_name="vdopool",
                                   virtual_size=Size("40 GiB"))
Beispiel #4
0
def get_supported_autopart_choices():
    return [c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]])]
Beispiel #5
0
    def __init__(self, title, createClickedCB, autopartTypeChangedCB, partitionsToReuse=True):
        # pylint: disable=super-init-not-called,non-parent-init-called
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=6)
        self.members = []
        self.pageTitle = 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_left(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_alignment(0, 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)

        autopart_choices = (c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]]))
        default = None
        for name, code in autopart_choices:
            itr = store.append([_(name), code])
            if code == DEFAULT_AUTOPART_TYPE:
                default = itr

        combo.set_margin_left(18)
        combo.set_margin_right(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)
Beispiel #6
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_left(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_alignment(0, 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)

        autopart_choices = (
            c for c in AUTOPART_CHOICES
            if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]]))
        default = None
        for name, code in autopart_choices:
            itr = store.append([_(name), code])
            if code == DEFAULT_AUTOPART_TYPE:
                default = itr

        combo.set_margin_left(18)
        combo.set_margin_right(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)
Beispiel #7
0
def get_supported_autopart_choices():
    return [c for c in AUTOPART_CHOICES if is_supported_device_type(AUTOPART_DEVICE_TYPES[c[1]])]