def icon(self) -> Any: if super().icon is not None: return super().icon if self.value is True: return CommonIconUtils.load_checked_square_icon() return CommonIconUtils.load_unchecked_square_icon()
def _settings_human(self, on_close: Callable[[], Any] = None) -> None: def _on_close() -> None: if on_close is not None: on_close() def _reopen(): self._settings_human(on_close=on_close) option_dialog = CommonChooseObjectOptionDialog( CommonStringId.CUSTOM_GENDER_SETTINGS, CGSStringId.CGS_CUSTOM_GENDER_SETTINGS_DESCRIPTION, mod_identity=self.mod_identity, on_close=_on_close) option_dialog.add_option( CommonDialogActionOption( CommonDialogOptionContext( CGSStringId.GLOBAL_SETTINGS_NAME, CGSStringId.GLOBAL_SETTINGS_DESCRIPTION), on_chosen=CGSGlobalSettingsDialog(self._sim_info, on_close=_reopen).open)) def _set_to_vanilla_gender_chosen(): if CommonGenderUtils.is_male(self._sim_info): CommonSimGenderOptionUtils.update_gender_options_to_vanilla_male( self._sim_info) else: CommonSimGenderOptionUtils.update_gender_options_to_vanilla_female( self._sim_info) _reopen() option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext( CGSStringId.CGS_SET_TO_VANILLA_GENDER_OPTIONS_NAME, CGSStringId.CGS_SET_TO_VANILLA_GENDER_OPTIONS_DESCRIPTION, icon=CommonIconUtils.load_arrow_right_icon()), on_chosen=_set_to_vanilla_gender_chosen)) def _on_gender_chosen(): CommonGenderUtils.swap_gender(self._sim_info, update_gender_options=False) _reopen() current_gender_string = CGSStringId.MALE if CommonGenderUtils.is_female(self._sim_info): current_gender_string = CGSStringId.FEMALE option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext( CGSStringId.CGS_SWAP_GENDER_NAME, CGSStringId.CGS_SWAP_GENDER_DESCRIPTION, title_tokens=(current_gender_string, ), icon=CommonIconUtils.load_arrow_right_icon()), on_chosen=_on_gender_chosen)) def _on_physical_frame_chosen(): value = not CommonSimGenderOptionUtils.has_masculine_frame( self._sim_info) CommonSimGenderOptionUtils.update_body_frame(self._sim_info, value) _reopen() current_body_frame = CommonStringId.FEMININE if CommonSimGenderOptionUtils.has_masculine_frame(self._sim_info): current_body_frame = CommonStringId.MASCULINE option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext( CommonStringId.PHYSICAL_FRAME, CGSStringId.CGS_CURRENT, description_tokens=(current_body_frame, ), icon=CommonIconUtils.load_arrow_right_icon()), on_chosen=_on_physical_frame_chosen)) current_clothing = CommonStringId.FEMININE if CommonSimGenderOptionUtils.prefers_menswear(self._sim_info): current_clothing = CommonStringId.MASCULINE def _on_clothing_preference_chosen(): value = not CommonSimGenderOptionUtils.prefers_menswear( self._sim_info) CommonSimGenderOptionUtils.update_clothing_preference( self._sim_info, value) _reopen() option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext( CommonStringId.CLOTHING_PREFERENCE, CGSStringId.CGS_CURRENT, description_tokens=(current_clothing, ), icon=CommonIconUtils.load_arrow_right_icon()), on_chosen=_on_clothing_preference_chosen)) def _on_toggle_breasts_chosen(option_identifier: str, has_breasts: bool): self.log.format(option_identifier=option_identifier, has_breasts=has_breasts) def _on_acknowledged(_): _reopen() CommonSimGenderOptionUtils.update_has_breasts( self._sim_info, has_breasts) CommonOkDialog( CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_NAME, CGSStringId.CGS_SETTING_SAVE_RELOAD_ALERT_DESCRIPTION).show( on_acknowledged=_on_acknowledged) has_vanilla_breasts = False if CommonGenderUtils.is_female(self._sim_info): has_vanilla_breasts = not CommonTraitUtils.has_trait( self._sim_info, CommonTraitId.BREASTS_FORCE_OFF) option_dialog.add_option( CommonDialogToggleOption( 'ToggleBreasts', CommonTraitUtils.has_trait(self._sim_info, CommonTraitId.BREASTS_FORCE_ON) or has_vanilla_breasts, CommonDialogOptionContext( CGSStringId.CGS_TOGGLE_BREASTS_NAME, CGSStringId.CGS_TOGGLE_BREASTS_DESCRIPTION), on_chosen=_on_toggle_breasts_chosen)) option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext( CGSStringId.CGS_PREGNANCY_OPTIONS_NAME, CGSStringId.CGS_PREGNANCY_OPTIONS_DESCRIPTION, icon=CommonIconUtils.load_arrow_navigate_into_icon()), on_chosen=lambda *_, **__: self. _pregnancy_options(on_close=_reopen))) title = CGSStringId.CGS_TOGGLE_CAN_USE_TOILET_STANDING_NAME if CommonSimGenderOptionUtils.uses_toilet_standing(self._sim_info): title = CommonLocalizationUtils.create_localized_string( title, text_color=CommonLocalizedStringColor.GREEN) icon = CommonIconUtils.load_checked_square_icon() else: icon = CommonIconUtils.load_unchecked_square_icon() text = CGSStringId.CGS_TOGGLE_CAN_USE_TOILET_STANDING_DESCRIPTION def _on_toilet_usage_chosen(): value = not CommonSimGenderOptionUtils.uses_toilet_standing( self._sim_info) CommonSimGenderOptionUtils.update_toilet_usage( self._sim_info, value) _reopen() option_dialog.add_option( CommonDialogActionOption(CommonDialogOptionContext(title, text, icon=icon), on_chosen=_on_toilet_usage_chosen)) option_dialog.show(sim_info=self._sim_info)