make button labels more consistent

especially back vs cancel

for https://bugs.launchpad.net/subiquity/+bug/1781457
This commit is contained in:
Michael Hudson-Doyle 2018-07-16 22:45:36 +12:00
parent 5d42ace4c9
commit 42b339605c
6 changed files with 22 additions and 2 deletions

View File

@ -54,6 +54,11 @@ class VolGroupForm(CompoundDiskForm):
devices = MultiDeviceField(_("Devices:"))
size = ReadOnlyField(_("Size:"))
def validate_devices(self):
if len(self.devices.value) < 1:
return _("Select at least one device to be part of the volume "
"group.")
def validate_name(self):
if self.name.value in self.vg_names:
return _("There is already a volume group named '{}'").format(
@ -67,6 +72,7 @@ class VolGroupStretchy(Stretchy):
vg_names = {vg.name for vg in parent.model.all_volgroups()}
if existing is None:
title = _('Create LVM volume group')
label = _('Create')
x = 0
while True:
name = 'vg{}'.format(x)
@ -81,6 +87,7 @@ class VolGroupStretchy(Stretchy):
else:
vg_names.remove(existing.name)
title = _('Edit volume group "{}"').format(existing.name)
label = _('Save')
devices = {d: 'active' for d in existing.devices}
initial = {
'devices': devices,
@ -93,6 +100,7 @@ class VolGroupStretchy(Stretchy):
form = self.form = VolGroupForm(
self.parent.model, possible_components, initial, vg_names)
self.form.buttons.base_widget[0].set_label(label)
self.form.devices.widget.set_supports_spares(False)

View File

@ -95,6 +95,7 @@ class RaidStretchy(Stretchy):
raid_names = {raid.name for raid in parent.model.all_raids()}
if existing is None:
title = _('Create software RAID ("MD") disk')
label = _('Create')
x = 0
while True:
name = 'md{}'.format(x)
@ -110,6 +111,7 @@ class RaidStretchy(Stretchy):
else:
raid_names.remove(existing.name)
title = _('Edit software RAID disk "{}"').format(existing.name)
label = _('Save')
name = existing.name
if name.startswith('md/'):
name = name[3:]
@ -131,8 +133,9 @@ class RaidStretchy(Stretchy):
form = self.form = RaidForm(
self.parent.model, possible_components, initial, raid_names)
self.form.devices.widget.set_supports_spares(
form.devices.widget.set_supports_spares(
initial['level'].supports_spares)
form.buttons.base_widget[0].set_label(label)
connect_signal(form.level.widget, 'select', self._select_level)
connect_signal(form.devices.widget, 'change', self._change_devices)

View File

@ -36,6 +36,8 @@ mirror_help = _(
class MirrorForm(Form):
cancel_label = _("Back")
url = URLField(_("Mirror address:"), help=mirror_help)

View File

@ -38,6 +38,8 @@ proxy_help = _("If you need to use a HTTP proxy to access the outside world, "
class ProxyForm(Form):
cancel_label = _("Back")
url = URLField(_("Proxy address:"), help=proxy_help)

View File

@ -339,7 +339,7 @@ class SnapListView(BaseView):
1: ColSpec(omittable=True),
2: ColSpec(pack=False, min_width=40),
})
ok = ok_btn(label=_("OK"), on_press=self.done)
ok = ok_btn(label=_("Done"), on_press=self.done)
self._main_screen = screen(
table, [ok],
focus_buttons=False,

View File

@ -245,6 +245,8 @@ class EditNetworkStretchy(Stretchy):
class VlanForm(Form):
ok_label = _("Create")
def __init__(self, parent, device):
self.parent = parent
self.device = device
@ -425,6 +427,7 @@ class BondStretchy(Stretchy):
device.name for device in parent.model.get_all_netdevs()}
if existing is None:
title = _('Create bond')
label = _("Create")
x = 0
while True:
name = 'bond{}'.format(x)
@ -437,6 +440,7 @@ class BondStretchy(Stretchy):
}
else:
title = _('Edit bond')
label = _("Save")
all_netdev_names.remove(existing.name)
params = existing._configuration['parameters']
mode = params['mode']
@ -464,6 +468,7 @@ class BondStretchy(Stretchy):
if device_ok(device)]
self.form = BondForm(initial, candidate_netdevs, all_netdev_names)
self.form.buttons.base_widget[0].set_label(label)
connect_signal(self.form, 'submit', self.done)
connect_signal(self.form, 'cancel', self.cancel)
super().__init__(