def _on_submit(_dialog: CommonUiMultiPicker) -> bool:
            try:
                if not _dialog.accepted:
                    self.log.debug('Dialog cancelled.')
                    return on_submit(dict(), CommonChoiceOutcome.CANCEL)

                made_choices: bool = CommonDialogUtils.get_chosen_items(_dialog)
                if not made_choices:
                    self.log.debug('No choices made. Cancelling dialog.')
                    return on_submit(dict(), CommonChoiceOutcome.CANCEL)
                self.log.debug('Choices made, combining choices.')
                index = 0
                dialog_choices: Dict[int, Tuple[Any]] = dict()
                for _sub_dialog_submit_id in _dialog._picker_dialogs:
                    _sub_dialog_submit = _dialog._picker_dialogs[_sub_dialog_submit_id]
                    sub_dialog_choices: List[Any] = list()
                    for choice in CommonDialogUtils.get_chosen_items(_sub_dialog_submit):
                        sub_dialog_choices.append(choice)
                    dialog_choices[index] = tuple(sub_dialog_choices)
                    index += 1

                self.log.format_with_message('Choices were made, submitting.', choice=made_choices)
                result = on_submit(dialog_choices, CommonChoiceOutcome.CHOICE_MADE)
                self.log.format_with_message('Finished handling choice.', result=result)
                return result
            except Exception as ex:
                self.log.error('Error occurred on submitting a value.', exception=ex)
            return False
Exemplo n.º 2
0
 def _on_chosen(dialog: UiSimPicker):
     if not dialog.accepted:
         self.log.debug('Dialog cancelled.')
         return on_chosen(None, CommonChoiceOutcome.CANCEL)
     choices = tuple(CommonDialogUtils.get_chosen_items(dialog))
     self.log.format_with_message('Choice made.', choice=choices)
     result = on_chosen(choices, CommonChoiceOutcome.CHOICE_MADE)
     self.log.format_with_message('Finished handling choice.', result=result)
     return result
 def _on_chosen(dialog: UiObjectPicker):
     if not dialog.accepted:
         self.log.debug('Dialog cancelled.')
         return on_chosen(tuple(), CommonChoiceOutcome.CANCEL)
     self.log.debug('Choices not made.')
     choices = CommonDialogUtils.get_chosen_items(dialog)
     self.log.format_with_message('Choose Object Choice made.',
                                  choice=pformat(choices))
     result = on_chosen(choices, CommonChoiceOutcome.CHOICE_MADE)
     self.log.format_with_message(
         'Finished handling choose objects _build_dialog._on_chosen.',
         result=result)
     return result
Exemplo n.º 4
0
 def _on_chosen(dialog: UiObjectPicker) -> bool:
     try:
         if not dialog.accepted:
             self.log.debug('Dialog cancelled.')
             return on_chosen(tuple(), CommonChoiceOutcome.CANCEL)
         self.log.debug('Choices not made.')
         choices = CommonDialogUtils.get_chosen_items(dialog)
         self.log.format_with_message('Choose Object Choice made.',
                                      choice=pformat(choices))
         result = on_chosen(choices, CommonChoiceOutcome.CHOICE_MADE)
         self.log.format_with_message(
             'Finished handling choose objects _build_dialog._on_chosen.',
             result=result)
         return result
     except Exception as ex:
         self.log.error('Error occurred on choosing a value.',
                        exception=ex)
     return False
Exemplo n.º 5
0
 def _on_chosen(dialog: UiPurchasePicker) -> bool:
     try:
         self.log.format_with_message(
             'Choice made.', picked_results=dialog.picked_results)
         if not dialog.accepted:
             self.log.debug('Dialog cancelled.')
             return on_chosen(None, CommonChoiceOutcome.CANCEL)
         self.log.debug(
             'Dialog accepted, checking if choices were made.')
         choices = CommonDialogUtils.get_chosen_items(dialog)
         self.log.format_with_message('Purchase Objects choice made.',
                                      choice=choices)
         result = on_chosen(choices, CommonChoiceOutcome.CHOICE_MADE)
         self.log.format_with_message(
             'Finished handling purchase objects _on_chosen.',
             result=result)
         return result
     except Exception as ex:
         self.log.error('Error occurred on choosing a value.',
                        exception=ex)
     return False