Example #1
0
        def ChangeAllButtonCallback(dialog: ui_dialog.UiDialog) -> None:

            # noinspection PyUnusedLocal
            def ChangeAllButtonConfirmCallback(
                    confirmDialog: ui_dialog.UiDialog) -> None:
                if confirmDialog.response == ui_dialog.ButtonType.DIALOG_RESPONSE_OK:
                    newValue = dict()

                    for mod in Mods.GetAllMods():  # type: Mods.Mod
                        newValue[mod.Namespace] = selectedModValue

                    setting.Set(newValue)

                    self._ShowDialogInternal(setting,
                                             newValue,
                                             showDialogArguments,
                                             returnCallback=returnCallback,
                                             *args,
                                             **kwargs)
                elif confirmDialog.response == ui_dialog.ButtonType.DIALOG_RESPONSE_CANCEL:
                    self._ShowDialogInternal(setting,
                                             currentValue,
                                             showDialogArguments,
                                             returnCallback=returnCallback,
                                             *args,
                                             **kwargs)

            UISettings.ShowPresetConfirmDialog(ChangeAllButtonConfirmCallback)
Example #2
0
        def SetValueButtonCallback(dialog: ui_dialog.UiDialog) -> None:

            # noinspection PyUnusedLocal
            def SetValueButtonConfirmCallback(
                    confirmDialog: ui_dialog.UiDialog) -> None:
                if confirmDialog.response == ui_dialog.ButtonType.DIALOG_RESPONSE_OK:
                    setting.Set(newValue)
                    self._ShowDialogInternal(setting,
                                             newValue,
                                             showDialogArguments,
                                             returnCallback=returnCallback,
                                             *args,
                                             **kwargs)
                else:
                    self._ShowDialogInternal(setting,
                                             currentValue,
                                             showDialogArguments,
                                             returnCallback=returnCallback,
                                             *args,
                                             **kwargs)

            UISettings.ShowPresetConfirmDialog(SetValueButtonConfirmCallback)