Commit Graph

72 Commits

Author SHA1 Message Date
Olivier Gayot 348195b4d6 form: disable Done button on validation failure of a child form
When the validation of a field fails in a form, we disable the Done
button. With child forms, however, it did not work because they have
their own set of hidden buttons ; that are not the ones the users
interacts with.

This patch makes parent forms recurse on the child forms when checking
if any field is in error. Also, when a child form undertakes validation,
it now propagates to the parent, so that the done button can be
immediately enabled/disabled.

Having a validation error in a child form that is not currently enabled
should not prevent the user from moving forward, so we disable recursion
for child forms that are disabled.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-09 11:28:36 +02:00
Michael Hudson-Doyle 7bcfcba99b Merge branch 'master' into still-better-i18n 2020-05-21 11:15:32 +12:00
Michael Hudson-Doyle 812f33cab6 default to setting up LVM in guided storage screen 2020-05-13 16:34:35 +12:00
Michael Hudson-Doyle 21ed91d7d3 add comments, contexts for some translatable strings
from scanning though about one third of subiquity.pot
2020-05-08 15:40:59 +12:00
Michael Hudson-Doyle 2d65fe4f16 attempt to make providing a good translation easier
* annotate a few missed string literals with _()
 * try to consistently use named placeholders when formatting strings
   for display (i.e. _("frob the {thing}") not _("frob the {}")
 * run selector values, form captions and form help through _() before
   display
 * use ngettext in one place. not sure if there need to be more...
 * reduce cuteness about how strings are constructed in a few places
2020-05-06 21:16:24 +12:00
Michael Hudson-Doyle 9736825e32 simplify SubForm stuff a bit 2019-12-16 21:21:57 +13:00
Michael Hudson-Doyle a2fc6da694 add a RadioButtonField for forms 2019-12-14 22:35:19 +13:00
Michael Hudson-Doyle 4c84bb6494 add a form field that has another form as its widget 2019-12-12 23:20:12 +13:00
Michael Hudson-Doyle 05c4fa4403 add a way for a form field not to have space for help 2019-12-12 23:19:46 +13:00
Michael Hudson-Doyle d8746ce75e add a way for a form field to not have a caption 2019-12-12 23:19:09 +13:00
Dimitri John Ledkov 290c26d244 consoleconf: rewrite identity page. 2019-08-07 21:35:35 +01:00
Michael Hudson-Doyle 94df386a6c display a message when the user obstinately types in an unsuitable mount point 2019-07-24 13:03:04 +12:00
Michael Hudson-Doyle 2eb9420a75 move ssh key fetching over to ssh view 2018-12-13 14:15:43 +13:00
Michael Hudson-Doyle 16a853107e add form fields to ssh view 2018-12-13 14:15:43 +13:00
Michael Hudson-Doyle 53fb81a65b correctly call wrapped lost_focus in _Validator.lost_focus
fixes https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1781429
2018-07-16 12:44:38 +12:00
Michael Hudson-Doyle 79a380f28f initialize manual form fields 2018-07-06 13:36:53 +12:00
Michael Hudson-Doyle 0fdd9721ce tweaks 2018-07-06 13:36:53 +12:00
Michael Hudson-Doyle e0eeeadd28 enable/disable a Toggleable via a property not methods 2018-07-04 11:47:44 +12:00
Michael Hudson-Doyle edd6769a60 add ReadOnlyField (to be used for the size of a raid) 2018-06-26 12:19:47 +12:00
Michael Hudson-Doyle 22ae45e99b move widget_width() to its own module
also allow our widget subclasses to specify their width
2018-06-26 09:59:48 +12:00
Michael Hudson-Doyle 391b70cdf5 rework the look of the selector widget 2018-06-25 23:45:21 +12:00
Michael Hudson-Doyle 9cbaac4542 use our custom WidgetWrap everywhere 2018-06-22 09:38:18 +12:00
Michael Hudson-Doyle 0e2d376ed0 build a form out of tables 2018-06-21 21:07:02 +12:00
Michael Hudson-Doyle 99dd12f870 simplify how forms are built 2018-06-21 15:38:02 +12:00
Michael Hudson-Doyle ed86028dd2 provide a way for a field to opt out of default styling 2018-06-21 15:37:19 +12:00
Michael Hudson-Doyle 19d43c19c7 make field an ABC 2018-06-21 15:37:19 +12:00
Michael Hudson-Doyle ba809a9e97 simplify how form widgets get styled 2018-06-21 15:37:19 +12:00
Michael Hudson-Doyle 59da0e717b make Toggleable simpler and more robust 2018-06-21 15:37:15 +12:00
Ryan Harper 080ac4c245 pep8 fixes for subiquitycore/ui/form.py 2018-05-24 16:59:31 -05:00
Ryan Harper 7cbf8c2b69 pep8 fixes for subiquitycore/ui/form.py 2018-05-24 16:51:51 -05:00
Michael Hudson-Doyle cbd5afe2c0 move imports of i18n higher so _ is always installed before tests are imported 2018-05-21 10:14:34 +12:00
Michael Hudson-Doyle 11708703c9 move titles, footers, excerpts from controller to view
read title and footer from the view instance, make views respsonsible for rendering
the excerpt

adapts infrastructure, welcome, keyboard, network views
2018-05-18 15:55:49 +12:00
Michael Hudson-Doyle 960f51ca91 remove view argument to Form.as_rows and friends 2018-05-07 10:57:35 +12:00
Michael Hudson-Doyle 688a270c17 a round of marking strings as translatable and ensuring translations are actually displayed in the UI 2018-04-19 10:29:08 +12:00
Michael Hudson-Doyle 2d3d500e34 a couple of tweaks to make more translated strings appear 2018-04-18 20:18:15 +12:00
Michael Hudson-Doyle 5a6ad92239 add some validation to URLEditor 2018-04-12 09:43:02 +12:00
Michael Hudson-Doyle 13eaa5c9dc add a bare-bones proxy model/view/controller 2018-04-09 15:05:46 +12:00
Michael Hudson-Doyle 028914da97 another small helper 2018-04-09 14:37:26 +12:00
Michael Hudson-Doyle 59a500c9e5 add more space between form rows, align help to the left 2018-03-14 14:58:58 +13:00
Michael Hudson-Doyle ca953ea01f improve scrolling experience
Before this change, subiquity has lots of ListBoxes that just contain a single
Pile containing all their contents. This is (a) a bit silly (b) make some parts
of the scrolling experience a bit poor, for example urwid tries to scroll all
of a ListBox element into view when it gets focus but this is defeated by
shoving all the elements into a Pile (this causes
https://bugs.launchpad.net/subiquity/+bug/1750058 and a few other strange
bits).

The fix for this is obvious (don't wrap ListBox elements in a Pile) but this
breaks some aspects of tab cycling (when you shift tab back into a listbox you
want the last element of the box to be both selected and scrolled into view,
that sort of thing). Fixing all these bits of broken behaviour required
rewriting the tab cycling implementation to the point of copy/paste/hack-ing
the Pile.keypress method. Rather than doing the same for Columns, I just
prevent the creation of Columns with more than 1 selectable, which as we want
subiquity to be navigable with up/down/return does not seem so bad.

As penitence for all this, I've added a bunch of commentary explaining what is
going on.
2018-03-14 14:35:27 +13:00
Michael Hudson-Doyle c57f0057f3 simplifications 2018-03-14 14:20:53 +13:00
Michael Hudson-Doyle 9ba11aedb5 change how ssh import field works
This is the only place in subiquity today where we have selectable fields side
by side, which contradicts the goal to be able to navigate subiquity with up,
down and enter keys only. Replace the existing fancy widget with two fields,
one to select the import source and one to enter the username.

Also remove the "Ubuntu SSO" option as that has never worked.
2018-03-14 14:07:03 +13:00
Michael Hudson-Doyle 923df8d0b2 allow forms to override name of cancel button 2018-01-12 12:56:24 +13:00
Michael Hudson-Doyle c60d37f275 some testing ideas 2017-11-27 21:51:39 +13:00
Michael Hudson-Doyle ad95cdd4d7
Merge pull request #255 from CanonicalLtd/vorlon/fix-up-tests
fix tests slightly
2017-11-27 09:09:08 +13:00
Michael Hudson-Doyle c85602527e stop any of the *_btn functions defining a label by default 2017-11-22 13:53:35 +13:00
Steve Langasek ae1b8c2e66 Import i18n module before use. 2017-10-09 17:28:21 +00:00
Michael Hudson-Doyle f5637a717e a start at a more sophisticated ssh identity widget 2017-10-06 15:39:14 +13:00
Michael Hudson-Doyle b06d1a78c4 improve validation of hostname and username fields
not sure hostname validation makes perfect sense but at least it is a bit
more transparent now
2017-10-05 22:14:44 +13:00
Michael Hudson-Doyle a73b76c7d2 clear any validation error as soon as the field becomes valid
this is why I changed size's validation to be side-effect free in the last
commit...
2017-10-05 16:19:31 +13:00