From 42b339605cebcbbc0128035a4bf3fe1c7f7a5bcf Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Mon, 16 Jul 2018 22:45:36 +1200 Subject: [PATCH] make button labels more consistent especially back vs cancel for https://bugs.launchpad.net/subiquity/+bug/1781457 --- subiquity/ui/views/filesystem/lvm.py | 8 ++++++++ subiquity/ui/views/filesystem/raid.py | 5 ++++- subiquity/ui/views/mirror.py | 2 ++ subiquity/ui/views/proxy.py | 2 ++ subiquity/ui/views/snaplist.py | 2 +- .../ui/views/network_configure_manual_interface.py | 5 +++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/subiquity/ui/views/filesystem/lvm.py b/subiquity/ui/views/filesystem/lvm.py index c70a0490..4dd064f0 100644 --- a/subiquity/ui/views/filesystem/lvm.py +++ b/subiquity/ui/views/filesystem/lvm.py @@ -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) diff --git a/subiquity/ui/views/filesystem/raid.py b/subiquity/ui/views/filesystem/raid.py index d7e22491..42e24cad 100644 --- a/subiquity/ui/views/filesystem/raid.py +++ b/subiquity/ui/views/filesystem/raid.py @@ -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) diff --git a/subiquity/ui/views/mirror.py b/subiquity/ui/views/mirror.py index 40180f09..e28470c3 100644 --- a/subiquity/ui/views/mirror.py +++ b/subiquity/ui/views/mirror.py @@ -36,6 +36,8 @@ mirror_help = _( class MirrorForm(Form): + cancel_label = _("Back") + url = URLField(_("Mirror address:"), help=mirror_help) diff --git a/subiquity/ui/views/proxy.py b/subiquity/ui/views/proxy.py index 444b2c58..2dfc7d69 100644 --- a/subiquity/ui/views/proxy.py +++ b/subiquity/ui/views/proxy.py @@ -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) diff --git a/subiquity/ui/views/snaplist.py b/subiquity/ui/views/snaplist.py index 0682504c..8c038ec8 100644 --- a/subiquity/ui/views/snaplist.py +++ b/subiquity/ui/views/snaplist.py @@ -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, diff --git a/subiquitycore/ui/views/network_configure_manual_interface.py b/subiquitycore/ui/views/network_configure_manual_interface.py index 9ebcadbd..6e7402da 100644 --- a/subiquitycore/ui/views/network_configure_manual_interface.py +++ b/subiquitycore/ui/views/network_configure_manual_interface.py @@ -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__(