def ShowStatusNotification (targetSimInfo: sim_info.SimInfo) -> None: # TODO create quick glance notification, only show the times? if not isinstance(targetSimInfo, sim_info.SimInfo): raise Exceptions.IncorrectTypeException(targetSimInfo, "targetSimInfo", (sim_info.SimInfo,)) targetDotInformation = Dot.GetDotInformation(targetSimInfo) # type: typing.Optional[Dot.DotInformation] if targetDotInformation is None: Debug.Log("Attempted to show a dot app status notification on a sim missing a dot information object.\nSim ID: %s" % targetSimInfo.id, This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) return if not targetDotInformation.Enabled: Debug.Log("Attempted to show a dot app status notification on a sim its not enabled for.\nSim ID: %s" % targetSimInfo.id, This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) return dotCycle = targetDotInformation.GetCurrentCycle() # type: typing.Optional[Dot.DotCycle] if dotCycle is None: ShowErrorNotification(targetSimInfo) return text = Language.MakeLocalizationStringCallable(_BuildStatusText(targetSimInfo, dotCycle)) notificationArguments = { "owner": targetSimInfo, "title": StatusNotificationTitle.GetCallableLocalizationString(), "text": text, "icon": lambda *args, **kwargs: shared_messages.IconInfoData(icon_resource = resources.ResourceKeyWrapper(CycleUIResources.DotAppIconKey)), "secondary_icon": lambda *args, **kwargs: shared_messages.IconInfoData(obj_instance = targetSimInfo), } Notifications.ShowNotification(queue = False, **notificationArguments)
def ShowInvalidInputNotification(inputString: str, modName: str) -> None: if services.current_zone() is None: Debug.Log("Tried to show setting dialog before a zone was loaded.\n" + str.join("", traceback.format_stack()), This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__) return notificationArguments = { "title": InvalidInputNotificationTitle.GetCallableLocalizationString(modName), "text": InvalidInputNotificationText.GetCallableLocalizationString( inputString), "expand_behavior": ui_dialog_notification.UiDialogNotification. UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification. UiDialogNotificationUrgency.URGENT } Notifications.ShowNotification(queue=False, **notificationArguments)
def ShowMissedPillNotification(targetSimInfo: sim_info.SimInfo, missedPills: int) -> None: """ Show a notification indicating that the target sim forgot to take this many pills. """ if not isinstance(targetSimInfo, sim_info.SimInfo): raise Exceptions.IncorrectTypeException(targetSimInfo, "targetSimInfo", (sim_info.SimInfo, )) if not isinstance(missedPills, int): raise Exceptions.IncorrectTypeException(missedPills, "missedPills", (int, )) notificationArguments = { "owner": targetSimInfo, "title": MissedPillNotificationTitle.GetCallableLocalizationString(), "text": MissedPillNotificationText.GetCallableLocalizationString( targetSimInfo, missedPills), "icon": lambda *args, **kwargs: shared_messages.IconInfoData(obj_instance= targetSimInfo), "urgency": ui_dialog_notification.UiDialogNotification. UiDialogNotificationUrgency.URGENT, } Notifications.ShowNotification(queue=False, **notificationArguments)
def ShowReproductiveInfoNotifications(targetSimInfo: sim_info.SimInfo) -> None: if not isinstance(targetSimInfo, sim_info.SimInfo): raise Exceptions.IncorrectTypeException(targetSimInfo, "targetSimInfo", (sim_info.SimInfo, )) targetSimSystem = Reproduction.GetSimSystem( targetSimInfo ) # type: typing.Optional[ReproductionShared.ReproductiveSystem] if targetSimSystem is None: return notificationText = targetSimSystem.GetDebugNotificationString() notificationArguments = { "title": Language.MakeLocalizationStringCallable( Language.CreateLocalizationString("")), "text": Language.MakeLocalizationStringCallable( Language.CreateLocalizationString(notificationText)), } Notifications.ShowNotification(queue=False, **notificationArguments) Debug.Log( "Collected and reported debug info from a sim's reproductive system by request.\n\n%s" % notificationText, This.Mod.Namespace, Debug.LogLevels.Info, group=This.Mod.Namespace, owner=__name__)
def _ShowSavingFirstTimeNotification() -> None: notificationArguments = { "title": SavingFirstTimeNotificationTitle.GetCallableLocalizationString(), "text": SavingFirstTimeNotificationText.GetCallableLocalizationString(), } # type: typing.Dict[str, typing.Any] Notifications.ShowNotification(queue=True, **notificationArguments)
def _ShowCommitFailureDialog () -> None: notificationArguments = { "title": FailureNotificationsTitle.GetCallableLocalizationString(), "text": FailureNotificationsCommitText.GetCallableLocalizationString(), "expand_behavior": ui_dialog_notification.UiDialogNotification.UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification.UiDialogNotificationUrgency.URGENT } # type: typing.Dict[str, typing.Any] Notifications.ShowNotification(queue = True, **notificationArguments)
def _ShowMismatchGameTickWarningDialog (savingIdentifiers: typing.List[str]) -> None: identifiersText = "\n".join(savingIdentifiers) notificationArguments = { "title": WarningNotificationsTitle.GetCallableLocalizationString(), "text": WarningNotificationsMismatchGameTickText.GetCallableLocalizationString(identifiersText), "expand_behavior": ui_dialog_notification.UiDialogNotification.UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification.UiDialogNotificationUrgency.URGENT } # type: typing.Dict[str, typing.Any] Notifications.ShowNotification(queue = True, **notificationArguments)
def ShowFertilityNotificationsEnabledNotification (targetSimInfo: sim_info.SimInfo) -> None: if not isinstance(targetSimInfo, sim_info.SimInfo): raise Exceptions.IncorrectTypeException(targetSimInfo, "targetSimInfo", (sim_info.SimInfo,)) notificationArguments = { "owner": targetSimInfo, "title": FertilityNotificationsEnabledNotificationTitle.GetCallableLocalizationString(), "text": FertilityNotificationsEnabledNotificationText.GetCallableLocalizationString(), "icon": lambda *args, **kwargs: shared_messages.IconInfoData(icon_resource = resources.ResourceKeyWrapper(CycleUIResources.DotAppIconKey)), "secondary_icon": lambda *args, **kwargs: shared_messages.IconInfoData(obj_instance = targetSimInfo), } Notifications.ShowNotification(queue = False, **notificationArguments)
def _ShowUnsupportedLanguageNotification() -> None: notificationArguments = { "title": UnsupportedLanguageNotificationTitle.GetCallableLocalizationString(), "text": UnsupportedLanguageNotificationText.GetCallableLocalizationString(), "expand_behavior": ui_dialog_notification.UiDialogNotification. UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification. UiDialogNotificationUrgency.URGENT } # type: typing.Dict[str, ...] Notifications.ShowNotification(queue=True, **notificationArguments)
def _ShowInvalidLanguageNotification() -> None: notificationArguments = { "title": InvalidLanguageNotificationTitle.GetCallableLocalizationString(), "text": InvalidLanguageNotificationText.GetCallableLocalizationString(), "expand_behavior": ui_dialog_notification.UiDialogNotification. UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification. UiDialogNotificationUrgency.URGENT } Notifications.ShowNotification(**notificationArguments)
def _ShowGameSTBLPackageReadErrorNotification() -> None: notificationArguments = { "title": GameSTBLPackageReadErrorNotificationTitle. GetCallableLocalizationString(), "text": GameSTBLPackageMissingNotificationText.GetCallableLocalizationString(), "expand_behavior": ui_dialog_notification.UiDialogNotification. UiDialogNotificationExpandBehavior.FORCE_EXPAND, "urgency": ui_dialog_notification.UiDialogNotification. UiDialogNotificationUrgency.URGENT } # type: typing.Dict[str, ...] Notifications.ShowNotification(queue=True, **notificationArguments)
def ShowPositiveTestResultNotification( targetSimInfo: sim_info.SimInfo) -> None: if not isinstance(targetSimInfo, sim_info.SimInfo): raise Exceptions.IncorrectTypeException(targetSimInfo, "targetSimInfo", (sim_info.SimInfo, )) notificationArguments = { "title": PositiveTestResultNotificationTitle.GetCallableLocalizationString(), "text": PositiveTestResultNotificationText.GetCallableLocalizationString( targetSimInfo), "icon": lambda *args, **kwargs: shared_messages.IconInfoData(obj_instance= targetSimInfo) } Notifications.ShowNotification(queue=False, **notificationArguments)
def _ShowWriteFailureDialog (self, exception: Exception) -> None: Notifications.ShowNotification(queue = True, title = self.WriteFailureNotificationTitle.GetCallableLocalizationString(), text = self.WriteFailureNotificationText.GetCallableLocalizationString(FormatException(exception)), expand_behavior = ui_dialog_notification.UiDialogNotification.UiDialogNotificationExpandBehavior.FORCE_EXPAND, urgency = ui_dialog_notification.UiDialogNotification.UiDialogNotificationUrgency.URGENT)