Example #1
0
def _VisitModPage(_connection: int = None) -> None:
    try:
        Generic.ShowOpenBrowserDialog(Websites.GetNOMainModURL(This.Mod))
    except:
        output = commands.CheatOutput(_connection)
        output("Failed to show the mod page with the open browser dialog.")

        Debug.Log("Failed to show the mod page with the open browser dialog.",
                  This.Mod.Namespace,
                  Debug.LogLevels.Exception,
                  group=This.Mod.Namespace,
                  owner=__name__)
Example #2
0
def _SupportNeonOcean(_connection: int = None) -> None:
    try:
        Generic.ShowOpenBrowserDialog(Websites.GetNOSupportURL())
    except:
        output = commands.CheatOutput(_connection)
        output("Failed to show the support site with the open browser dialog.")

        Debug.Log(
            "Failed to show the support site with the open browser dialog.",
            This.Mod.Namespace,
            Debug.LogLevels.Exception,
            group=This.Mod.Namespace,
            owner=__name__)
Example #3
0
def _ShowPreviewUpdateNotification(mod: Mods.Mod,
                                   version: Version.Version) -> None:
    updateURL = Websites.GetNOSupportModPreviewPostsURL(mod)  # type: str

    showUpdateResponseCommand = collections.make_immutable_slots_class(
        ("command", "arguments"))

    showUpdateResponseArguments = [
        collections.make_immutable_slots_class(("arg_value", "arg_type"))
    ]

    showUpdateResponseArguments[0] = showUpdateResponseArguments[0]({
        "arg_value":
        codecs.encode(bytearray(updateURL, "utf-8"), "hex").decode("utf-8"),
        "arg_type":
        ui_dialog.CommandArgType.ARG_TYPE_STRING
    })

    showUpdateResponseCommand = showUpdateResponseCommand({
        "command":
        This.Mod.Namespace.lower() + ".distribution.show_url",
        "arguments":
        showUpdateResponseArguments
    })

    showUpdateResponse = ui_dialog.UiDialogResponse(
        text=UpdateNotificationButton.GetCallableLocalizationString(),
        ui_request=ui_dialog.UiDialogResponse.UiDialogUiRequest.SEND_COMMAND,
        response_command=showUpdateResponseCommand)

    notificationArguments = {
        "title":
        UpdateNotificationTitle.GetCallableLocalizationString(mod.Name),
        "text":
        UpdateNotificationReleaseText.GetCallableLocalizationString(
            str(version)),
        "ui_responses": (showUpdateResponse, )
    }

    Notifications.ShowNotification(queue=True, **notificationArguments)

    modShownPreviewVersions = _shownPreviewVersions.get(mod)  # type: list

    if modShownPreviewVersions is None:
        modShownPreviewVersions = list()
        _shownPreviewVersions[mod] = modShownPreviewVersions

    if not version in modShownPreviewVersions:
        modShownPreviewVersions.append(version)
Example #4
0
 def _GetDescriptionDocumentationURL(
     self, setting: UISettingsShared.SettingStandardWrapper
 ) -> typing.Optional[str]:
     return Websites.GetNODocumentationModSettingURL(
         setting.Setting, This.Mod)