(data: DataModel)
| 549 | |
| 550 | |
| 551 | def confirmation(data: DataModel): |
| 552 | list_widget = KeyValueBullet(prompt=_("Would you like to continue?"), |
| 553 | choices=[_("Save and continue"), |
| 554 | _("Change master channel settings"), |
| 555 | _("Change slave channel settings"), |
| 556 | _("Change middleware settings")], |
| 557 | choices_id=["continue", "master", "slave", "middleware"]) |
| 558 | |
| 559 | while True: |
| 560 | print() |
| 561 | print_wrapped(_('You have chosen to enable the following ' |
| 562 | 'modules for profile "{profile}".') |
| 563 | .format(profile=data.profile)) |
| 564 | print() |
| 565 | master_name = data.get_instance_display_name(data.config['master_channel']) |
| 566 | print_wrapped(_("Master channel: {channel_name}") |
| 567 | .format(channel_name=master_name)) |
| 568 | print() |
| 569 | print_wrapped(ngettext("Slave channel:", "Slave channels:", |
| 570 | len(data.config['slave_channels']))) |
| 571 | for i in data.config['slave_channels']: |
| 572 | print_wrapped('- ' + data.get_instance_display_name(i)) |
| 573 | |
| 574 | num_middlewares = len(data.config.get('middlewares', [])) |
| 575 | if num_middlewares > 0: |
| 576 | print() |
| 577 | print_wrapped(ngettext("Middleware:", "Middlewares:", num_middlewares)) |
| 578 | for i in data.config['middlewares']: |
| 579 | print_wrapped('- ' + data.get_instance_display_name(i)) |
| 580 | print() |
| 581 | |
| 582 | outcome = list_widget.launch()[1] |
| 583 | |
| 584 | if outcome == "master": |
| 585 | choose_master_channel(data) |
| 586 | elif outcome == "slave": |
| 587 | choose_slave_channels(data) |
| 588 | elif outcome == "middleware": |
| 589 | choose_middlewares(data) |
| 590 | else: # "continue" |
| 591 | break |
| 592 | |
| 593 | data.save_config() |
| 594 | print() |
| 595 | print(_("Configuration is saved.")) |
| 596 | |
| 597 | |
| 598 | def main(): |
no test coverage detected