Commit Graph

451 Commits

Author SHA1 Message Date
Robert Krátký 4e81b0d81d Unify UI screen titles and minor lang. fixes 2023-11-21 14:05:59 +01:00
Olivier Gayot cda6c54b87 filesystem: store the actual size in bytes alongside the human readable size
Currently, the partition form stores the size as a human readable value.
(e.g., 123456K, 1.1G, 1.876G, 100G). When we exit the size field (i.e., upon
losing focus), we convert the value to a number of bytes and then align
it up to the nearest MiB (or whatever the alignment requirement is).

Unfortunately, after computing the aligned value, we turn it back into a
human-readable string and store it as is. It is not okay because the
conversion does not ensure that the alignment requirement is still
honored.

For instance, if the user types in 1.1G, we do the following:

 * convert it to a number of bytes -> 1181116006.4 (surprise, it is not
   even an integer).

 * round it up to the nearest MiB -> 1181745152 (this is the correct
   value)

 * transform it into a human readable string and store it as is -> 1.1G
   - which actually corresponds to the original value.

This leads to an exception later when creating the partition:

    File "subiquity/models/filesystem.py", line 1841, in add_partition
      raise Exception(
   Exception: ('size %s or offset %s not aligned to %s', 1181116006, 1048576, 1048576)

Fixed by storing the actual size as a number of bytes - alongside the
human readable size.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-08-09 16:50:03 +02:00
Michael Hudson-Doyle 0395b6e9b0 add support for 'dd' image sources
I think only a core dd image source will work for now. Probably.
2023-08-03 09:07:06 +12:00
Dan Bungert c08fdab2f8 one-off format of long lines with black 2023-07-25 15:27:49 -06:00
Dan Bungert 34d40643ad format with black + isort 2023-07-25 15:27:42 -06:00
Dan Bungert e095d5040f network: use pyroute2 to manage default routes
The existing event based method of watching for has_network has a flaw.

The incoming route_change events from probert do not distinguish routes
on the same interface but a different metric, so if 2 routes on one
interface appear, we only get one event.  Then if one of those routes is
removed, we will inappropriately remove this route from the
default_routes list.

Aside from the code watching the event stream, the set of default routes
is an elaborate boolean value.

Simplify the code by passing around a boolean, and when we get a
route_change event, use that to go looking again at the list of default
routes.

LP: #2004659
2023-02-21 13:30:05 -07:00
Dan Bungert 9d12871f15 many: s/create_task/run_bg_task/
create_task has the following note:
  Important: Save a reference to the result of this function, to avoid a
  task disappearing mid-execution.

Convert existing usage of create_task to run_bg_task, if that
create_task is not actually storing the result.
2023-02-13 14:56:07 -07:00
Olivier Gayot 51b6772175 ui: add a helper to open a confirmation dialog and get the response
The new ConfirmationOverlay object along with the
BaseView.ask_confirmation helper can be used to open a confirmation
dialog and get back the decision from the user.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-05 09:54:51 +01:00
Michael Hudson-Doyle 7aab0b5de4 rewrite Spinner to not require a loop parameter 2022-12-07 14:19:27 +13:00
Michael Hudson-Doyle 85b3cd0724 switch from loop.create_task to asyncio.create_task
mostly done with sed
2022-11-08 10:08:46 +13:00
Olivier Gayot 561fff1d5b
Merge pull request #1336 from ogayot/password-passphrase
Refactor how we handle confirmation fields - use passphrase instead of password where relevant
2022-10-28 14:06:54 +02:00
Dan Bungert 943ea53fbc
Merge pull request #1402 from dbungert/terminology
fix some easier cases of impolite language
2022-08-29 18:00:35 -06:00
Michael Hudson-Doyle 60953951fe
Merge pull request #1394 from CarlosNihelton/style-help-gray
Defaults help text style to gray
2022-08-30 11:34:42 +12:00
Dan Bungert d73772258d fix some easier cases of impolite language 2022-08-29 12:30:39 -06:00
Carlos Nihelton 6d51deedb6
Assign style if a str is passed
Otherwise assign self.help as passed.

Co-authored-by: Dan Bungert <danielbungert@gmail.com>
2022-08-29 13:55:07 -03:00
Carlos Nihelton eb722fef0b
Defaults help text style to gray
Per
https://github.com/canonical/ubuntu-desktop-installer/issues/1073#issuecomment-1224493840.
Custom styles can still be applied.
2022-08-24 11:24:24 -03:00
Olivier Gayot eb69f23ce7 ubuntu-pro: update the view to include magic-attach
We now have the view display the user-code fetched via u-a-c and
automatically validate the contract token when the contract selection
succeeds.

If the magic token expires (i.e., u-a-c times out), a new contract
selection is initiated.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-08-18 16:10:44 +02:00
Olivier Gayot 384e4b62ac ui: move confirmation mechanism in subiquitycore.ui
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-24 17:24:20 +02:00
Olivier Gayot 2ee5550c9e ui: add ability to change button label in SomethingFailed message box
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-15 11:54:32 +02:00
Olivier Gayot c72e7eec87 form: use subclass of BoundFormField that overrides is_in_error
Instead of using isinstance(self.widget, SubFormWidget) in
BoundFormField.is_in_error, we now implement a BoundSubFormField
class that inherits from BoundFormField. It is meant to be instantianted
for subforms fields only.

This class overrides is_in_error() to perform the additional checks in
the forms' sub-fields.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-09 11:28:36 +02:00
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
Olivier Gayot 812bba1de1 Use logger names consistent with directory structure
Refreshed name of loggers to make them consistent with the directory
structure.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-02-25 17:35:45 +01:00
Olivier Gayot 68b9c42fac Fix exception messages not interpolated properly
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-16 11:35:40 +01:00
Michael Hudson-Doyle 83d076975d
Merge pull request #979 from mwhudson/install-wpasupplicant-on-demand
install wpasupplicant when a wifi nic is seen
2021-06-10 12:54:09 +12:00
Michael Hudson-Doyle ef008f4aea address review comments 2021-06-10 12:32:29 +12:00
Michael Hudson-Doyle 7b3bb0278b fix some more assorted small wlan problems 2021-06-09 15:28:06 +12:00
Michael Hudson-Doyle 907e7dd7b0 implement UI for tracking wpasupplicant install state
this should perhaps be in the subiquity package vs subiquitycore somehow
but that seems hard.
2021-06-09 13:00:43 +12:00
Michael Hudson-Doyle d14fd35330 move "enabling wifi turns on dhcp4" behaviour to controller from view 2021-06-02 12:40:50 +12:00
Michael Hudson-Doyle 902c57f7f7 move start_scan error handling into controller
report errors via scan_state field
2021-06-02 12:28:44 +12:00
Michael Hudson-Doyle 4850cee5ce NetworkConfigureWLANStretchy.update_link should only care about updates for its nic
this was very confusing to debug!
2021-06-02 12:28:44 +12:00
Michael Hudson-Doyle c325e76e9e fix the wlan view calls to controller methods to pass just the nic name 2021-06-02 12:28:42 +12:00
Michael Hudson-Doyle fac0eeed43 fix crash when trying to view nic info
fixes half of https://bugs.launchpad.net/subiquity/+bug/1912955
2021-01-27 09:35:09 +13:00
Michael Hudson-Doyle 9b414df0eb add a helper to wait and show a dialog if needed
use this in snaplist view. cancellation with asyncio is mindbending!
2020-09-18 21:51:14 +12:00
Michael Hudson-Doyle f4066d97d7 convert controller api methods to take strings and trigger updates for affected nics
this is going to work better in the client/server world
2020-09-03 22:52:31 +12:00
Michael Hudson-Doyle 04426cec15 make network view use a plain-old-data view of a nic
The network view code used to crawl all over the network model object,
which isn't really going to work with the upcoming client/server split.
So this adds a much better defined interface between the view and
controller.
2020-09-03 11:12:38 +12:00
Michael Hudson-Doyle 6b26b668be fix formatting of error message 2020-07-22 12:27:04 +12:00
Michael Hudson-Doyle a9dd3757f1
Merge pull request #761 from mwhudson/still-better-i18n
more work towards being able to provide good translations
2020-05-21 12:38:51 +12:00
Dimitri John Ledkov e2fe2a0693
Merge pull request #773 from xnox/snap-create-user-error
console_conf: fix showing error messages, when snap create-user fails
2020-05-21 01:02:31 +01:00
Michael Hudson-Doyle 7bcfcba99b Merge branch 'master' into still-better-i18n 2020-05-21 11:15:32 +12:00
Michael Hudson-Doyle b85f8118b7 update the network view when wlan dialod is saved 2020-05-19 11:53:03 +12:00
Michael Hudson-Doyle 7236771d2f correctly enable dhcp4 when configuring a ssid for a wlan interface 2020-05-19 11:53:03 +12:00
Dimitri John Ledkov 6de8970560 console_conf: fix showing error messages, when snap create-user fails 2020-05-18 12:42:14 +01:00
Dimitri John Ledkov da1477ba01 network: fix wifi screen
WiFi screen was broken since NetDev refactor. Unbreak it.
2020-05-18 12:00:42 +01: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 3060a03bd6 make some things slightly better 2020-05-08 15:06:24 +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 5dc2895481 add the ability to remove a particular overlay, not just the top one 2020-05-01 12:46:45 +12:00
Michael Hudson-Doyle 6007b4dc41 do not crash in a terminal < 76 columns wide
for https://bugs.launchpad.net/ubuntu-z-systems/+bug/1874314
2020-04-28 21:32:46 +12:00
Michael Hudson-Doyle 9ff059eae7 put zdev rows directly in a listbox, not in a pile in a listbox
this required adding TableListRow.set_contents.

it fixes (partly by accident) a crash when a row becomes unselectable
after a refresh (https://bugs.launchpad.net/subiquity/+bug/1874114), it
also makes the home and end keys do something sane.

really this view should not rebuild every row on any change, but that's
something for another day.
2020-04-22 15:36:06 +12:00