Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)