Multi-pane Dialog

Multi-pane Choose Option Dialog

class CommonMultiPaneChooseOptionDialog(mod_identity, title_identifier, description_identifier, title_tokens=(), description_tokens=(), on_close=CommonFunctionUtils.noop)

Bases: sims4communitylib.dialogs.option_dialogs.common_option_dialog.CommonOptionDialog

A container for multiple choose option dialogs.

Note

To see an example dialog, run the command s4clib_testing.show_multi_pane_choose_option_dialog in the in-game console.

Warning

This dialog does not currently work with CommonChooseSimOptionDialog or CommonChooseSimsOptionDialog.

Example usage:
def _on_option_chosen_in_dialog_one(option_identifier: str, choice: str):
    pass

def _on_option_chosen_in_dialog_two(option_identifier: str, choice: str):
    pass

def _on_submit(chosen_options: Dict[int, Any]):
    pass

# LocalizedStrings within other LocalizedStrings
title_tokens = (
    CommonLocalizationUtils.create_localized_string(
        CommonStringId.TESTING_SOME_TEXT_FOR_TESTING,
        text_color=CommonLocalizedStringColor.GREEN
    ),
)
description_tokens = (
    CommonLocalizationUtils.create_localized_string(
        CommonStringId.TESTING_TEST_TEXT_WITH_SIM_FIRST_AND_LAST_NAME,
        tokens=(CommonSimUtils.get_active_sim_info(),),
        text_color=CommonLocalizedStringColor.BLUE
    ),
)

sub_dialog_one = CommonChooseObjectOptionDialog(
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    title_tokens=title_tokens,
    description_tokens=description_tokens,
    per_page=2
)

sub_dialog_one.add_option(
    CommonDialogObjectOption(
        'Option 1',
        'Value 1',
        CommonDialogOptionContext(
            CommonStringId.TESTING_SOME_TEXT_FOR_TESTING,
            CommonStringId.TESTING_TEST_BUTTON_ONE,
            icon=CommonIconUtils.load_checked_square_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_one
    )
)

sub_dialog_one.add_option(
    CommonDialogObjectOption(
        'Option 2',
        'Value 2',
        CommonDialogOptionContext(
            CommonStringId.TESTING_SOME_TEXT_FOR_TESTING,
            CommonStringId.TESTING_TEST_BUTTON_TWO,
            icon=CommonIconUtils.load_arrow_navigate_into_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_one
    )
)

sub_dialog_one.add_option(
    CommonDialogObjectOption(
        'Option 3',
        'Value 3',
        CommonDialogOptionContext(
            CommonLocalizationUtils.create_localized_string('Value 3'),
            CommonStringId.TESTING_TEST_BUTTON_TWO,
            icon=CommonIconUtils.load_arrow_navigate_into_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_one
    )
)

sub_dialog_two = CommonChooseObjectOptionDialog(
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    title_tokens=title_tokens,
    description_tokens=description_tokens,
    per_page=2
)

sub_dialog_two.add_option(
    CommonDialogObjectOption(
        'Option 4',
        'Value 4',
        CommonDialogOptionContext(
            CommonStringId.TESTING_SOME_TEXT_FOR_TESTING,
            CommonStringId.TESTING_TEST_BUTTON_ONE,
            icon=CommonIconUtils.load_checked_square_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_two
    )
)

sub_dialog_two.add_option(
    CommonDialogObjectOption(
        'Option 5',
        'Value 5',
        CommonDialogOptionContext(
            CommonStringId.TESTING_SOME_TEXT_FOR_TESTING,
            CommonStringId.TESTING_TEST_BUTTON_TWO,
            icon=CommonIconUtils.load_arrow_navigate_into_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_two
    )
)

sub_dialog_two.add_option(
    CommonDialogObjectOption(
        'Option 6',
        'Value 6',
        CommonDialogOptionContext(
            CommonLocalizationUtils.create_localized_string('Value 3'),
            CommonStringId.TESTING_TEST_BUTTON_TWO,
            icon=CommonIconUtils.load_arrow_navigate_into_icon()
        ),
        on_chosen=_on_option_chosen_in_dialog_two
    )
)

option_dialog = CommonMultiPaneChooseOptionDialog(
    ModInfo.get_identity(),
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    CommonStringId.TESTING_TEST_TEXT_WITH_STRING_TOKEN,
    title_tokens=title_tokens,
    description_tokens=description_tokens
)

option_dialog.add_sub_dialog(sub_dialog_one)
option_dialog.add_sub_dialog(sub_dialog_two)

option_dialog.show(
    on_submit=_on_submit,
    sim_info=CommonSimUtils.get_active_sim_info()
)
Parameters:
  • mod_identity (CommonModIdentity) – The identity of the mod creating the dialog. See CommonModIdentity for more information.
  • title_identifier (Union[int, str, LocalizedString, CommonStringId]) – A decimal identifier of the title text.
  • description_identifier (Union[int, str, LocalizedString, CommonStringId]) – A decimal identifier of the description text.
  • title_tokens (Iterator[Any], optional) – An iterator of Tokens to format into the title. Default is an empty collection.
  • description_tokens (Iterator[Any], optional) – An iterator of Tokens to format into the description. Default is an empty collection.
  • on_close (Callable[[], None], optional) – A callback invoked upon the dialog closing. Default is CommonFunctionUtils.noop.
add_sub_dialog(sub_dialog, *dialog_arguments, **dialog_keyword_arguments)

Add a sub dialog.

Parameters:
  • sub_dialog (CommonChooseOptionDialog) – An instance of a choose option dialog.
  • dialog_arguments (Any, optional) – Arguments to pass to the sub dialog when building it.
  • dialog_keyword_arguments (Any, optional) – Keyword arguments to pass to the sub dialog when building it.
build_dialog(on_submit=CommonFunctionUtils.noop, sim_info=None)

Build the dialog and invoke the callbacks upon the player submitting their selections.

Parameters:
  • on_submit (Callable[[Dict[int, Tuple[Any]]], Any], optional) – A callback invoked upon the player submitting the dialog and the choices within it. Default is CommonFunctionUtils.noop. Each choice is mapped as follows The key is the dialog index starting at 0. The value is the choice made within that sub dialog. Default is CommonFunctionUtils.noop.
  • sim_info (SimInfo, optional) – The SimInfo of the Sim that will appear in the dialog image. The default Sim is the active Sim. Default is None.
log_identifier

A string identifier for the log used by instances of the class.

Note

This is the message identifier that will appear when logging messages.

Returns:The identifier of the log
Return type:str
show(on_submit=CommonFunctionUtils.noop, sim_info=None)

Show the dialog and invoke the callbacks upon the player submitting their selections.

Parameters:
  • on_submit (Callable[[Dict[int, Tuple[Any]]], Any], optional) – A callback invoked upon the player submitting the dialog and the choices within it. Each choice is mapped as follows: The key is the index of the dialog a value belongs to, starting at 0. The value is the choice made within that dialog. Default is CommonFunctionUtils.noop.
  • sim_info (SimInfo, optional) – The SimInfo of the Sim that will appear in the dialog image. The default Sim is the active Sim. Default is None.