Example #1
0
	def _CreateButtons (self,
						setting: UISettingsShared.SettingStandardWrapper,
						currentValue: typing.Any,
						showDialogArguments: typing.Dict[str, typing.Any],
						returnCallback: typing.Callable[[], None] = None,
						*args, **kwargs):

		buttons = super()._CreateButtons(setting, currentValue, showDialogArguments, returnCallback = returnCallback, *args, **kwargs)  # type: typing.List[UISettings.DialogButton]

		for valueIndex in range(len(self.Values)):  # type: int
			def CreateValueButtonCallback (value: typing.Any) -> typing.Callable:

				# noinspection PyUnusedLocal
				def ValueButtonCallback (dialog: ui_dialog.UiDialog) -> None:
					self._ShowDialogInternal(setting, value, showDialogArguments, returnCallback = returnCallback)

				return ValueButtonCallback

			valueButtonArguments = {
				"responseID": 50000 + valueIndex * -5,
				"sortOrder": -(500 + valueIndex * -5),
				"callback": CreateValueButtonCallback(self.Values[valueIndex]),
				"text": self._GetValueText(self.Values[valueIndex]),
			}

			if currentValue == self.Values[valueIndex]:
				valueButtonArguments["selected"] = True

			valueButton = UISettings.ChoiceDialogButton(**valueButtonArguments)
			buttons.append(valueButton)

		return buttons
Example #2
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 #3
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)
Example #4
0
    def _CreateRows(self,
                    setting: UISettingsShared.SettingWrapper,
                    currentValue: typing.Any,
                    showDialogArguments: typing.Dict[str, typing.Any],
                    returnCallback: typing.Callable[[], None] = None,
                    *args,
                    **kwargs) -> typing.List[UISettings.DialogRow]:

        rows = super()._CreateRows(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogRow]

        currentLanguageHandler = LanguageHandlers.GetCurrentLanguageHandler(
        )  # type: LanguageHandlers.LanguageHandlerBase

        editingPronounSetIdentifier = showDialogArguments[
            "editingPronounSetIdentifier"]  # type: str

        editingPronounSetContainer = currentValue.get(
            editingPronounSetIdentifier, None)

        if editingPronounSetContainer is None:
            editingPronounSet = dict()

            editingPronounSetContainer = {
                "Title": "New Pronoun Set",
                "Set": editingPronounSet
            }

            currentValue[
                editingPronounSetIdentifier] = editingPronounSetContainer
        else:
            editingPronounSet = editingPronounSetContainer.get("Set", None)

            if editingPronounSet is None:
                editingPronounSet = dict()
                editingPronounSetContainer["Set"] = editingPronounSet

        editingPronounSetTitle = editingPronounSetContainer[
            "Title"]  # type: str

        def createDeleteSetCallback() -> typing.Callable:
            # noinspection PyUnusedLocal
            def deleteSetCallback(dialog: ui_dialog.UiDialog) -> None:
                try:
                    self._ShowDeleteSetConfirmDialog(
                        editingPronounSetTitle,
                        setting,
                        currentValue,
                        showDialogArguments,
                        returnCallback=returnCallback,
                        *args,
                        **kwargs)
                except:
                    Debug.Log("Failed to run the delete set row callback.",
                              This.Mod.Namespace,
                              Debug.LogLevels.Exception,
                              group=This.Mod.Namespace,
                              owner=__name__)

            return deleteSetCallback

        def createEditTitleCallback() -> typing.Callable:
            # noinspection PyUnusedLocal
            def editTitleCallback(dialog: ui_dialog.UiDialog) -> None:
                try:
                    self._ShowEditTitleDialog(
                        editingPronounSetContainer,
                        setting,
                        currentValue,
                        showDialogArguments=showDialogArguments,
                        returnCallback=returnCallback)
                except:
                    Debug.Log("Failed to run the edit title row callback.",
                              This.Mod.Namespace,
                              Debug.LogLevels.Exception,
                              group=This.Mod.Namespace,
                              owner=__name__)

            return editTitleCallback

        # noinspection PyUnusedLocal
        def createEditPairCallback(
                editingPairIdentifier: str) -> typing.Callable:
            # noinspection PyUnusedLocal
            def editPairCallback(dialog: ui_dialog.UiDialog) -> None:
                try:
                    editingPairValue = editingPronounSet.get(
                        editingPairIdentifier, "")

                    if not isinstance(editingPairValue, str):
                        editingPairValue = ""

                    self._ShowEditPairDialog(
                        editingPronounSet,
                        editingPairIdentifier,
                        editingPairValue,
                        setting,
                        currentValue,
                        showDialogArguments=showDialogArguments,
                        returnCallback=returnCallback)
                except:
                    Debug.Log("Failed to run the edit pair row callback.",
                              This.Mod.Namespace,
                              Debug.LogLevels.Exception,
                              group=This.Mod.Namespace,
                              owner=__name__)

            return editPairCallback

        deleteSetRow = UISettings.DialogRow(
            4,
            createDeleteSetCallback(),
            self._GetDeleteSetRowText(),
            description=self._GetDeleteSetRowDescription(),
            icon=self._GetDeleteSetRowIcon())

        rows.append(deleteSetRow)

        editTitleRow = UISettings.DialogRow(
            5,
            createEditTitleCallback(),
            self._GetEditTitleDialogTitle(),
            description=Language.CreateLocalizationString(
                editingPronounSetTitle),
            icon=self._GetEditTitleRowIcon(),
        )

        rows.append(editTitleRow)

        currentGenderTagPairOptionID = 100  # type: int

        for editablePairIdentifier in currentLanguageHandler.GetCustomPronounSetEditableGenderTagPairs(
        ):  # type: str
            editablePairParts = editablePairIdentifier.split(
                "|")  # type: typing.List[str]

            if len(editablePairParts) != 2:
                continue

            editablePairRowText = editablePairParts[0].capitalize(
            ) + " / " + editablePairParts[1].capitalize()  # type: str

            editablePairValue = editingPronounSet.get(editablePairIdentifier,
                                                      "")

            if isinstance(editablePairValue, str):
                editablePairRowDescription = Language.CreateLocalizationString(
                    editablePairValue.capitalize()
                )  # type: localization.LocalizedString
            else:
                editablePairRowDescription = self._GetEditablePairSpecialAlternativeText(
                )  # type: localization.LocalizedString

            editablePairRow = UISettings.DialogRow(
                currentGenderTagPairOptionID,
                createEditPairCallback(editablePairIdentifier),
                Language.CreateLocalizationString(editablePairRowText),
                description=editablePairRowDescription,
                icon=self._GetEditablePairRowIcon(),
            )

            currentGenderTagPairOptionID += 1

            rows.append(editablePairRow)

        return rows
Example #5
0
    def _CreateRows(self,
                    setting: UISettingsShared.SettingWrapper,
                    currentValue: typing.Any,
                    showDialogArguments: typing.Dict[str, typing.Any],
                    returnCallback: typing.Callable[[], None] = None,
                    *args,
                    **kwargs) -> typing.List[UISettings.DialogRow]:

        rows = super()._CreateRows(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogRow]

        currentLanguageHandler = LanguageHandlers.GetCurrentLanguageHandler(
        )  # type: LanguageHandlers.LanguageHandlerBase

        def generateNewValidSetID() -> str:
            newSetID = uuid.uuid4()  # type: uuid.UUID
            newSetIDString = str(newSetID)  # type: str

            if not newSetIDString in currentValue:
                return newSetIDString
            else:
                return generateNewValidSetID()

        def createNewSetCallback() -> typing.Callable:
            # noinspection PyUnusedLocal
            def selectionCallback(dialog: ui_dialog.UiDialog) -> None:
                newSetIDString = generateNewValidSetID()

                newPronounSetSet = currentLanguageHandler.GetCustomPronounSetStandardValues(
                )  # type: typing.Dict[str, str]

                currentValue[newSetIDString] = {
                    "Title": "New Pronoun Set",
                    "Set": newPronounSetSet
                }

                setting.Set(currentValue)

                self._ShowDialogInternal(setting,
                                         currentValue,
                                         showDialogArguments,
                                         returnCallback=returnCallback)

            return selectionCallback

        def editSetCallback(
                editingPronounSetIdentifier: str) -> typing.Callable:
            # noinspection PyUnusedLocal
            def editPronounSetCallback() -> None:
                self.ShowDialog(setting,
                                returnCallback=returnCallback,
                                **showDialogArguments)

            # noinspection PyUnusedLocal
            def selectionCallback(dialog: ui_dialog.UiDialog) -> None:
                if hasattr(setting.Setting, "EditPronounSetDialog"):
                    setting.Setting.EditPronounSetDialog().ShowDialog(
                        setting,
                        editPronounSetCallback,
                        editingPronounSetIdentifier=editingPronounSetIdentifier
                    )
                else:
                    Debug.Log(
                        "Cannot edit pronoun set as the custom pronoun set setting has no EditPronounSetDialog attribute.",
                        This.Mod.Namespace,
                        Debug.LogLevels.Warning,
                        group=This.Mod.Namespace,
                        owner=__name__)
                    self._ShowDialogInternal(setting,
                                             currentValue,
                                             showDialogArguments,
                                             returnCallback=returnCallback)

            return selectionCallback

        newSetRow = UISettings.DialogRow(
            10,
            createNewSetCallback(),
            self._GetNewSetRowText(),
            description=self._GetNewSetRowDescription(),
            icon=self._GetNewSetRowIcon(),
        )

        rows.append(newSetRow)

        currentAdditionalSetOptionID = 100  # type: int

        for pronounSetIdentifier, pronounSet in PronounSets.GetCustomPronounSets(
        ).items():
            pronounSetTitle = pronounSet.get(
                "Title", None)  # type: typing.Optional[str]

            if pronounSetTitle is None:
                continue

            pronounSetRow = UISettings.DialogRow(
                currentAdditionalSetOptionID,
                editSetCallback(pronounSetIdentifier),
                Language.CreateLocalizationString(pronounSetTitle),
                description=self._GetCustomSetRowDescription(),
                icon=self._GetCustomSetRowIcon(),
            )

            currentAdditionalSetOptionID += 1

            rows.append(pronounSetRow)

        return rows
Example #6
0
    def _CreateRows(self,
                    setting: UISettingsShared.SettingStandardWrapper,
                    currentValue: typing.Any,
                    showDialogArguments: typing.Dict[str, typing.Any],
                    returnCallback: typing.Callable[[], None] = None,
                    *args,
                    **kwargs) -> typing.List[UISettings.DialogRow]:

        rows = super()._CreateRows(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogRow]

        defaultValue = self.DefaultSetting.Get()  # type: bool

        allMods = Mods.GetAllMods()  # type: typing.List[Mods.Mod]
        for modIndex in range(len(allMods)):  # type: int
            if allMods[modIndex].Distribution.UpdatesController is None:
                continue

            if allMods[modIndex].Distribution.UpdatesFileURL is None:
                continue

            if allMods[modIndex].Distribution.DownloadURL is None:
                continue

            modEnabled = defaultValue  # type: bool

            if allMods[modIndex].Namespace in currentValue:
                modEnabled = currentValue[allMods[modIndex].Namespace]

            def CreateModButtonCallback(mod: Mods.Mod,
                                        lastValue: bool) -> typing.Callable:

                # noinspection PyUnusedLocal
                def ModButtonCallback(dialog: ui_dialog.UiDialog) -> None:
                    if lastValue:
                        currentValue[mod.Namespace] = False
                        self._ShowDialogInternal(setting,
                                                 currentValue,
                                                 showDialogArguments,
                                                 returnCallback=returnCallback)
                    else:
                        currentValue[mod.Namespace] = True
                        self._ShowDialogInternal(setting,
                                                 currentValue,
                                                 showDialogArguments,
                                                 returnCallback=returnCallback)

                return ModButtonCallback

            rowArguments = {
                "optionID": (50000 + modIndex + -1),
                "callback":
                CreateModButtonCallback(allMods[modIndex], modEnabled),
                "text":
                self._GetKeyText(setting, allMods[modIndex], modEnabled),
                "description":
                self._GetValueText(setting, allMods[modIndex], modEnabled),
                "icon":
                resources.ResourceKeyWrapper(self._GetEnabledButtonIconKey())
                if modEnabled else resources.ResourceKeyWrapper(
                    self._GetDisabledButtonIconKey())
            }

            rows.append(UISettings.DialogRow(**rowArguments))

        return rows
Example #7
0
    def _CreateButtons(self,
                       setting: UISettingsShared.SettingStandardWrapper,
                       currentValue: typing.Any,
                       showDialogArguments: typing.Dict[str, typing.Any],
                       returnCallback: typing.Callable[[], None] = None,
                       *args,
                       **kwargs) -> typing.List[UISettings.DialogButton]:

        buttons = super()._CreateButtons(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogButton]

        defaultValue = self.DefaultSetting.Get()  # type: bool

        allModsEnabledSelected = True  # type: bool
        noModsEnabledSelected = True  # type: bool

        if len(currentValue) == 0:
            if defaultValue:
                noModsEnabledSelected = False
            else:
                allModsEnabledSelected = False
        else:
            for settingValue in currentValue.values():  # type: str
                if settingValue is False:
                    allModsEnabledSelected = False
                elif settingValue is True:
                    noModsEnabledSelected = False

            if allModsEnabledSelected and noModsEnabledSelected:
                noModsEnabledSelected = False

        allModsEnabledButtonArguments = {
            "responseID":
            50000,
            "sortOrder":
            -500,
            "callback":
            self._CreateChangeAllButtonCallback(True,
                                                setting,
                                                currentValue,
                                                showDialogArguments,
                                                returnCallback=returnCallback,
                                                *args,
                                                **kwargs),
            "text":
            self._GetAllModsEnabledButtonText(),
            "selected":
            allModsEnabledSelected
        }

        allModsEnabledButton = UISettings.ChoiceDialogButton(
            **allModsEnabledButtonArguments)
        buttons.append(allModsEnabledButton)

        noModsEnabledButtonArguments = {
            "responseID":
            50005,
            "sortOrder":
            -495,
            "callback":
            self._CreateChangeAllButtonCallback(False,
                                                setting,
                                                currentValue,
                                                showDialogArguments,
                                                returnCallback=returnCallback,
                                                *args,
                                                **kwargs),
            "text":
            self._GetNoModsEnabledButtonText(),
            "selected":
            noModsEnabledSelected
        }

        noModsEnabledButton = UISettings.ChoiceDialogButton(
            **noModsEnabledButtonArguments)
        buttons.append(noModsEnabledButton)

        return buttons
Example #8
0
    def _CreateRows(self,
                    setting: UISettingsShared.SettingWrapper,
                    currentValue: typing.Any,
                    showDialogArguments: typing.Dict[str, typing.Any],
                    returnCallback: typing.Callable[[], None] = None,
                    *args,
                    **kwargs) -> typing.List[UISettings.DialogRow]:

        rows = super()._CreateRows(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogRow]

        currentLanguageHandler = LanguageHandlers.GetCurrentLanguageHandler(
        )  # type: typing.Optional[typing.Type[LanguageHandlers.LanguageHandlerBase]]

        def createSelectionCallback(rowValue: str) -> typing.Callable:
            # noinspection PyUnusedLocal
            def selectionCallback(dialog: ui_dialog.UiDialog) -> None:
                self._ShowDialogInternal(setting,
                                         rowValue,
                                         showDialogArguments,
                                         returnCallback=returnCallback)

            return selectionCallback

        defaultSelectionValue = ""  # type: str
        defaultRowSelected = True if currentValue == defaultSelectionValue else False  # type: bool
        defaultRow = UISettings.DialogRow(
            10,
            createSelectionCallback(defaultSelectionValue),
            self._GetDefaultRowText(),
            description=self._GetSelectedRowDescription()
            if defaultRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if defaultRowSelected else self._GetNotSelectedRowIcon(),
        )

        femaleSelectionValue = "0"  # type: str
        femaleRowSelected = True if currentValue == femaleSelectionValue else False  # type: bool
        femaleRow = UISettings.DialogRow(
            11,
            createSelectionCallback(femaleSelectionValue),
            self._GetFemaleRowText(),
            description=self._GetSelectedRowDescription()
            if femaleRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if femaleRowSelected else self._GetNotSelectedRowIcon(),
        )

        maleSelectionValue = "1"  # type: str
        maleRowSelected = True if currentValue == maleSelectionValue else False  # type: bool
        maleRow = UISettings.DialogRow(
            12,
            createSelectionCallback(maleSelectionValue),
            self._GetMaleRowText(),
            description=self._GetSelectedRowDescription()
            if maleRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if maleRowSelected else self._GetNotSelectedRowIcon(),
        )

        rows.append(defaultRow)
        rows.append(femaleRow)
        rows.append(maleRow)

        currentAdditionalSetOptionID = 100  # type: int

        for pronounSetIdentifier, pronounSet in PronounSets.GetAllPronounSets(
                currentLanguageHandler).items():
            pronounSetTitle = pronounSet.get(
                "Title", None)  # type: typing.Optional[str]

            if pronounSetTitle is None:
                continue

            pronounSetSelected = True if currentValue == pronounSetIdentifier else False  # type: bool
            pronounSetRow = UISettings.DialogRow(
                currentAdditionalSetOptionID,
                createSelectionCallback(pronounSetIdentifier),
                Language.CreateLocalizationString(pronounSetTitle),
                description=self._GetSelectedRowDescription() if
                pronounSetSelected else self._GetNotSelectedRowDescription(),
                icon=self._GetSelectedRowIcon()
                if pronounSetSelected else self._GetNotSelectedRowIcon(),
            )

            currentAdditionalSetOptionID += 1

            rows.append(pronounSetRow)

        return rows
Example #9
0
    def _CreateRows(self,
                    setting: UISettingsShared.SettingWrapper,
                    currentValue: typing.Any,
                    showDialogArguments: typing.Dict[str, typing.Any],
                    returnCallback: typing.Callable[[], None] = None,
                    *args,
                    **kwargs) -> typing.List[UISettings.DialogRow]:

        rows = super()._CreateRows(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogRow]

        def _createSelectionCallback(rowValue: str) -> typing.Callable:
            # noinspection PyUnusedLocal
            def selectionCallback(dialog: ui_dialog.UiDialog) -> None:
                self._ShowDialogInternal(setting,
                                         rowValue,
                                         showDialogArguments,
                                         returnCallback=returnCallback)

            return selectionCallback

        defaultSelectionValue = ""  # type: str
        defaultRowSelected = True if currentValue == defaultSelectionValue else False  # type: bool
        defaultRow = UISettings.DialogRow(
            10,
            _createSelectionCallback(defaultSelectionValue),
            self._GetDefaultRowText(),
            description=self._GetSelectedRowDescription()
            if defaultRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if defaultRowSelected else self._GetNotSelectedRowIcon(),
        )

        femaleSelectionValue = "0"  # type: str
        femaleRowSelected = True if currentValue == femaleSelectionValue else False  # type: bool
        femaleRow = UISettings.DialogRow(
            11,
            _createSelectionCallback(femaleSelectionValue),
            self._GetFemaleRowText(),
            description=self._GetSelectedRowDescription()
            if femaleRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if femaleRowSelected else self._GetNotSelectedRowIcon(),
        )

        maleSelectionValue = "1"  # type: str
        maleRowSelected = True if currentValue == maleSelectionValue else False  # type: bool
        maleRow = UISettings.DialogRow(
            12,
            _createSelectionCallback(maleSelectionValue),
            self._GetMaleRowText(),
            description=self._GetSelectedRowDescription()
            if maleRowSelected else self._GetNotSelectedRowDescription(),
            icon=self._GetSelectedRowIcon()
            if maleRowSelected else self._GetNotSelectedRowIcon(),
        )

        rows.append(defaultRow)
        rows.append(femaleRow)
        rows.append(maleRow)

        return rows
Example #10
0
    def _CreateButtons(self,
                       setting: UISettingsShared.SettingWrapper,
                       currentValue: typing.Any,
                       showDialogArguments: typing.Dict[str, typing.Any],
                       returnCallback: typing.Callable[[], None] = None,
                       *args,
                       **kwargs) -> typing.List[UISettings.DialogButton]:

        buttons = super()._CreateButtons(
            setting,
            currentValue,
            showDialogArguments,
            returnCallback=returnCallback,
            *args,
            **kwargs)  # type: typing.List[UISettings.DialogButton]

        settingValue = setting.Get(
            ignoreOverride=True)  # type: typing.Union[float, int]

        realTimeValue = 0.0032  # type: float
        realTimeSelected = False  # type: bool

        if realTimeValue == settingValue:
            realTimeSelected = True

        realTimeButtonArguments = {
            "responseID":
            50000,
            "sortOrder":
            -500,
            "callback":
            self._CreateSetValueButtonCallback(realTimeValue,
                                               setting,
                                               currentValue,
                                               showDialogArguments,
                                               returnCallback=returnCallback,
                                               *args,
                                               **kwargs),
            "text":
            self._GetRealTimeButtonText(),
            "selected":
            realTimeSelected
        }

        realTimeButton = UISettings.ChoiceDialogButton(
            **realTimeButtonArguments)
        buttons.append(realTimeButton)

        yearLength112Value = 0.0105  # type: float
        yearLength112Selected = False  # type: bool

        if yearLength112Value == settingValue:
            yearLength112Selected = True

        yearLength112ButtonArguments = {
            "responseID":
            50001,
            "sortOrder":
            -499,
            "callback":
            self._CreateSetValueButtonCallback(yearLength112Value,
                                               setting,
                                               currentValue,
                                               showDialogArguments,
                                               returnCallback=returnCallback,
                                               *args,
                                               **kwargs),
            "text":
            self._GetYearLength112ButtonText(),
            "selected":
            yearLength112Selected
        }

        yearLength112Button = UISettings.ChoiceDialogButton(
            **yearLength112ButtonArguments)
        buttons.append(yearLength112Button)

        defaultValue = setting.GetDefault()  # type: float
        defaultSelected = False  # type: bool

        if defaultValue == settingValue:
            defaultSelected = True

        defaultButtonArguments = {
            "responseID":
            50100,
            "sortOrder":
            -400,
            "callback":
            self._CreateSetValueButtonCallback(defaultValue,
                                               setting,
                                               currentValue,
                                               showDialogArguments,
                                               returnCallback=returnCallback,
                                               *args,
                                               **kwargs),
            "text":
            self._GetDefaultButtonText(),
            "selected":
            defaultSelected
        }

        defaultButton = UISettings.ChoiceDialogButton(**defaultButtonArguments)
        buttons.append(defaultButton)

        return buttons