This commit is contained in:
Michael Hudson-Doyle 2018-07-07 22:04:40 +12:00
parent ea7625881f
commit 896a99c525
3 changed files with 21 additions and 13 deletions

View File

@ -164,7 +164,7 @@ def asdict(inst):
v = getattr( v = getattr(
inst, inst,
'serialize_' + field.name, 'serialize_' + field.name,
lambda : getattr(inst, field.name))() lambda: getattr(inst, field.name))()
if v is not None: if v is not None:
if isinstance(v, (list, set)): if isinstance(v, (list, set)):
r[field.name] = [elem.id for elem in v] r[field.name] = [elem.id for elem in v]
@ -216,19 +216,20 @@ def _generic_can_REMOVE(obj):
min_devices = raidlevels_by_value[cd.raidlevel].min_devices min_devices = raidlevels_by_value[cd.raidlevel].min_devices
if len(cd.devices) == min_devices: if len(cd.devices) == min_devices:
return _( return _(
"Removing {selflabel} would leave the {cdtype} {cdlabel} with less" "Removing {selflabel} would leave the {cdtype} {cdlabel} with "
" than {min_devices} devices.").format( "less than {min_devices} devices.").format(
selflabel=obj.label, selflabel=obj.label,
cdtype=cd.desc(), cdtype=cd.desc(),
cdlabel=cd.label, cdlabel=cd.label,
min_devices=min_devices) min_devices=min_devices)
elif isinstance(cd, LVM_VolGroup): elif isinstance(cd, LVM_VolGroup):
return _( if len(cd.devices) == 1:
"Removing {selflabel} would leave the {cdtype} {cdlabel} with no " return _(
"devices.").format( "Removing {selflabel} would leave the {cdtype} {cdlabel} with "
selflabel=obj.label, "no devices.").format(
cdtype=cd.desc(), selflabel=obj.label,
cdlabel=cd.label) cdtype=cd.desc(),
cdlabel=cd.label)
return True return True
@ -622,7 +623,8 @@ class LVM_VolGroup(_Device):
def _can_EDIT(self): def _can_EDIT(self):
if len(self._partitions) > 0: if len(self._partitions) > 0:
return _( return _(
"Cannot edit {selflabel} because it has logical volumes.").format( "Cannot edit {selflabel} because it has logical "
"volumes.").format(
selflabel=self.label) selflabel=self.label)
else: else:
return _generic_can_EDIT(self) return _generic_can_EDIT(self)
@ -633,7 +635,8 @@ class LVM_VolGroup(_Device):
def _can_DELETE(self): def _can_DELETE(self):
if len(self._partitions) > 0: if len(self._partitions) > 0:
return _( return _(
"Cannot delete {selflabel} because it has logical volumes.").format( "Cannot delete {selflabel} because it has logical "
"volumes.").format(
selflabel=self.label) selflabel=self.label)
else: else:
return _generic_can_DELETE(self) return _generic_can_DELETE(self)

View File

@ -102,6 +102,7 @@ A LVM volume group is created containing the large partition. A \
It can easily be enlarged with standard LVM command line tools."""), It can easily be enlarged with standard LVM command line tools."""),
} }
class GuidedDiskSelectionView(BaseView): class GuidedDiskSelectionView(BaseView):
title = _("Filesystem setup") title = _("Filesystem setup")
@ -136,7 +137,10 @@ class GuidedDiskSelectionView(BaseView):
}), }),
button_pile([cancel]), button_pile([cancel]),
focus_buttons=False, focus_buttons=False,
excerpt=excerpts[method] + "\n\n" + _("Choose the disk to install to:"))) excerpt=(
excerpts[method]
+ "\n\n"
+ _("Choose the disk to install to:"))))
def cancel(self, btn=None): def cancel(self, btn=None):
self.controller.default() self.controller.default()

View File

@ -322,7 +322,8 @@ class FormatEntireStretchy(Stretchy):
del mountpoint_to_devpath_mapping[mount.path] del mountpoint_to_devpath_mapping[mount.path]
else: else:
initial['fstype'] = self.model.fs_by_name[None] initial['fstype'] = self.model.fs_by_name[None]
self.form = PartitionForm(mountpoint_to_devpath_mapping, 0, initial, False, {}) self.form = PartitionForm(
mountpoint_to_devpath_mapping, 0, initial, False, {})
self.form.remove_field('size') self.form.remove_field('size')
self.form.remove_field('name') self.form.remove_field('name')