Misc Classes¶
Execution Result¶
- class CommonExecutionResult(result, reason=None, success_override=None, tooltip_text=None, tooltip_tokens=(), icon=None, influenced_by_active_mood=False, hide_tooltip=False)¶
Bases:
TestResultThe result of executing something.
Note
This class can be used in place of TestResult
- Parameters:
result (Any) – The result of execution. This value can be any type.
reason (Union[str, None], optional) – The reason for the success or failure of the execution result. Default is None.
success_override (bool) – If True, the execution will be indicated as being a success. If False, the execution will be indicated as being a failure. If None, the execution success will be indicated by whether result is set or not, if result is a bool, success is True and failure is False. Default is None.
tooltip_text (Union[int, str, LocalizedString, CommonStringId, CommonLocalizedStringSeparator], optional) – The text that will be displayed. If not specified, then no tooltip will be displayed. Default is None.
tooltip_tokens (Iterator[Any], optional) – A collection of objects to format into the localized tooltip. (They can be anything. LocalizedString, str, int, SimInfo, just to name a few). Default is an empty collection.
icon (Any, optional) – The icon to display. Default is None.
influenced_by_active_mood (bool, optional) – Indicate whether or not the result was influenced by a Sims active mood. Default is False.
hide_tooltip (bool, optional) – If True, no tooltip will be shown to the Player, even if a tooltip is specified. If False, a tooltip will be shown to the Player and if not specified, will be created from the reason (Assuming a reason is specified). Default is False.
- property is_failure¶
False, if the result of execution is a failure. False, if not.
- property is_success¶
True, if the result of execution is successful. False, if not.
- reverse_result()¶
Create a CommonExecutionResult that has a reversed result of this one, but with the same reason and tooltip information.
Note
This function works best when the result value has an opposite, such as a boolean.
- Returns:
This CommonExecutionResult, but with a reversed result value.
- Return type:
- property tooltip_text¶
The text of the tooltip.
- property tooltip_tokens¶
The tokens of the tooltip.
Test Result¶
- class CommonTestResult(result, reason=None, tooltip_text=None, tooltip_tokens=(), icon=None, influenced_by_active_mood=False, hide_tooltip=False)¶
Bases:
CommonExecutionResultThe result of testing something.
Note
This class can be used in place of TestResult and CommonExecutionResult
- Parameters:
result (bool) – A value that indicates whether the test was successful or not. If True, the test was successful. If False, the test was not successful.
reason (Union[str, None], optional) – The reason for the success or failure of the test result. Default is None.
tooltip_text (Union[int, str, LocalizedString, CommonStringId, CommonLocalizedStringSeparator], optional) – The text that will be displayed. If not specified, then no tooltip will be displayed. Default is None.
tooltip_tokens (Iterator[Any], optional) – A collection of objects to format into the localized tooltip. (They can be anything. LocalizedString, str, int, SimInfo, just to name a few). Default is an empty collection.
icon (Any, optional) – The icon to display. Default is None.
influenced_by_active_mood (bool, optional) – Indicate whether or not the result was influenced by a Sims active mood. Default is False.
hide_tooltip (bool, optional) – If True, no tooltip will be shown to the Player, even if a tooltip is specified. If False, a tooltip will be shown to the Player and if not specified, will be created from the reason (Assuming a reason is specified). Default is False.
- classmethod convert_from_vanilla(test_result)¶
Convert a vanilla TestResult into a CommonTestResult.
- Parameters:
test_result (TestResult) – An instance of TestResult
- Returns:
The specified TestResult translated to CommonTestResult.
- Return type:
- reverse_result()¶
Create a CommonTestResult that has a reversed result of this one, but with the same reason and tooltip information.
Note
This function works best when the result value has an opposite, such as a boolean.
- Returns:
This CommonTestResult, but with a reversed result value.
- Return type: