def run (self) -> None: while True: if not self.isAlive() or self._parentTimer is None or not self._parentTimer.isAlive(): break if self.daemon != self._parentTimer.daemon: self.daemon = self._parentTimer.daemon currentlyQueued = len(self._queuedCallbacks) # type: int if currentlyQueued == 0: time.sleep(0.05) else: callback = self._queuedCallbacks[0][0] # type: typing.Callable callbackArguments = self._queuedCallbacks[0][1] # type: tuple callbackKeywordArguments = self._queuedCallbacks[0][2] # type: dict try: callback(*callbackArguments, **callbackKeywordArguments) except Exception: Debug.Log("Failed to call a timer callback. Callback '" + Types.GetFullName(callback) + "'", This.Mod.Namespace, level = Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) self._queuedCallbacks.pop(0) if currentlyQueued >= 10: if not self._reportedBacklog: Debug.Log("A timer's callback thread has developed a backlog. This might mean callbacks are being added faster than they can be dealt with. Last Callback: '" + Types.GetFullName(callback) + "'", This.Mod.Namespace, level = Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) self._reportedBacklog = True
def _ShowURL(urlHex: str, _connection: int = None) -> None: try: if not isinstance(urlHex, str): raise Exceptions.IncorrectTypeException(urlHex, "urlHex", (str, )) except Exception as e: Debug.Log("Incorrect types for command.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=e) return try: url = codecs.decode(urlHex, "hex").decode("utf-8") Generic.ShowOpenBrowserDialog(url) except Exception as e: Debug.Log("Failed to show distribution url.\nURL hex '" + str(urlHex) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=e) return
def InvokeOnAllImportedEvent() -> Events.EventArguments: """ Invokes the on all imported events. On all imported events should be called after every mod's modules have been imported. """ eventArguments = Events.EventArguments() for onAllImportedCallback in OnAllImportedEvent: try: onAllImportedCallback(None, eventArguments) except: Debug.Log("Failed to invoke an on all imported callback at '" + Types.GetFullName(onAllImportedCallback) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__) for onAllImportedLateCallback in OnAllImportedLateEvent: try: onAllImportedLateCallback(None, eventArguments) except: Debug.Log( "Failed to invoke an on all imported late callback at '" + Types.GetFullName(onAllImportedLateCallback) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__) return eventArguments
def _TargetException(exception: BaseException) -> None: originalCallableFullName = Types.GetFullName( information.OriginalCallable) # type: str if originalCallableFullName == Types.GetFullName(log.exception): Debug.Log("Failed to call target function '" + Types.GetFullName(information.TargetFunction) + "'. Original callable: '" + originalCallableFullName + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=exception, logToGame=False) information.OriginalCallable( This.Mod.Namespace, "Failed to call target function '" + Types.GetFullName(information.TargetFunction) + "'. Original callable: '" + originalCallableFullName + "'.", exc=exception) else: if originalCallableFullName == Types.GetFullName( log.Logger.exception): Debug.Log("Failed to call target function '" + Types.GetFullName(information.TargetFunction) + "'. Original callable: '" + originalCallableFullName + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=exception, logToGame=False) information.OriginalCallable( log.Logger(This.Mod.Namespace), "Failed to call target function '" + Types.GetFullName(information.TargetFunction) + "'. Original callable: '" + originalCallableFullName + "'.", exc=exception) else: Debug.Log("Failed to call target function '" + Types.GetFullName(information.TargetFunction) + "'. Original callable: '" + originalCallableFullName + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=exception)
def EnableModAutoLoad (namespace: str) -> None: """ Allows for a mod to be loaded automatically if it was previously disabled. """ for modLoader in _allLoaders: # type: _Loader if modLoader.Mod.Namespace == namespace: if modLoader.Mod.IsLoaded(): Debug.Log("Tried to unblock the automatic load of '" + namespace + "' but it is already loaded.", This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) return modLoader.AutoLoad = True return Debug.Log("Tried to unblock the automatic load of '" + namespace + "' but no such mod exists.", This.Mod.Namespace, Debug.LogLevels.Error, group = This.Mod.Namespace, owner = __name__)
def DisableModAutoLoad (namespace: str) -> None: """ Disable the automatic loading of a mod to allow for it to be manually loaded at another time. """ for modLoader in _allLoaders: # type: _Loader if modLoader.Mod.Namespace == namespace: if modLoader.Mod.IsLoaded(): Debug.Log("Tried to block the automatic load of '" + namespace + "' but it is already loaded.", This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) return modLoader.AutoLoad = False return Debug.Log("Tried to block the automatic load of '" + namespace + "' but no such mod exists.", This.Mod.Namespace, Debug.LogLevels.Error, group = This.Mod.Namespace, owner = __name__)
def _UpdateScriptPaths (self, informationDictionary: dict) -> bool: informationKey = "ScriptPaths" # type: str scriptPathRootKey = "Root" # type: str scriptPathPathKey = "Path" # type: str try: scriptPaths = informationDictionary.get(informationKey, list()) # type: typing.List[str] if not isinstance(scriptPaths, list): raise Exceptions.IncorrectTypeException(scriptPaths, "Root[%s]" % informationKey, (list,)) for index, scriptPath in enumerate(scriptPaths): # type: int, str if not isinstance(scriptPath, str) and not isinstance(scriptPath, dict): raise Exceptions.IncorrectTypeException(scriptPath, "Root[%s][%d]" % (informationKey, index), (str, dict)) if isinstance(scriptPath, dict): if not scriptPathRootKey in scriptPath: raise Exception("Missing dictionary entry '%s' in 'Root[%s][%d]'." % (scriptPathRootKey, informationKey, index)) if not scriptPathPathKey in scriptPath: raise Exception("Missing dictionary entry '%s' in 'Root[%s][%d]'." % (scriptPathPathKey, informationKey, index)) scriptPathRoot = scriptPath[scriptPathRootKey] # type: str if not isinstance(scriptPathRoot, str): raise Exceptions.IncorrectTypeException(scriptPathRoot, "Root[%s][%d][%s]" % (informationKey, index, scriptPathRootKey), (str,)) scriptPathPath = scriptPath[scriptPathPathKey] # type: str if not isinstance(scriptPathPath, str): raise Exceptions.IncorrectTypeException(scriptPathRoot, "Root[%s][%d][%s]" % (informationKey, index, scriptPathPathKey), (str,)) scriptPathRootLower = scriptPathRoot.lower() if scriptPathRootLower == "mods": scriptPathRootValue = Paths.ModsPath elif scriptPathRootLower == "s4": scriptPathRootValue = Paths.UserDataPath elif scriptPathRootLower == "current": scriptPathRootValue = self.Mod.InformationFileDirectoryPath else: raise Exception("'" + scriptPathPath + "' is not a valid path root, valid roots are 'mods', 's4' and 'current'.") scriptPaths[index] = os.path.join(scriptPathRootValue, os.path.normpath(scriptPathPath)) else: scriptPaths[index] = os.path.join(Paths.ModsPath, os.path.normpath(scriptPath)) if not os.path.exists(scriptPaths[index]): raise Exception("'" + scriptPaths[index] + "' does not exist.") self.Mod.ScriptPaths = scriptPaths for scriptPath in self.Mod.ScriptPaths: self.Mod.Modules.extend(_GetArchiveModules(scriptPath)) return True except Exception: Debug.Log("Failed to read mod information file value '%s' for '%s'." % (informationKey, self.Mod.Namespace), This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return False
def _UpdateDistribution (self, informationDictionary: dict) -> bool: informationKey = "Distribution" # type: str try: distributionData = informationDictionary.get(informationKey, None) # type: typing.Optional[typing.Dict[str, dict]] if distributionData is None: return True if not isinstance(distributionData, dict) and distributionData is not None: raise Exceptions.IncorrectTypeException(distributionData, "Root[%s]" % informationKey, (dict, None)) def GetStringValue (targetKey: str) -> typing.Optional[str]: targetValue = distributionData.get(targetKey, None) # type: typing.Optional[str] if not isinstance(targetValue, str) and targetValue is not None: raise Exceptions.IncorrectTypeException(targetValue, "Root[%s][%s]" % (informationKey, targetKey), (str, None)) return targetValue updatesController = GetStringValue("UpdatesController") # type: typing.Optional[str] updatesFileURL = GetStringValue("UpdatesFileURL") # type: typing.Optional[str] downloadURL = GetStringValue("DownloadURL") # type: typing.Optional[str] previewDownloadURL = GetStringValue("PreviewDownloadURL") # type: typing.Optional[str] self.Mod.Distribution = Mods.Distribution(updatesController, updatesFileURL, downloadURL, previewDownloadURL) return True except Exception: Debug.Log("Failed to read mod information file value '%s' for '%s'." % (informationKey, self.Mod.Namespace), This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return False
def _OnExitCallback () -> None: for mod in _allLoaders: # type: _Loader try: if mod.Mod.IsReadyToUnload(This.Mod.Namespace): mod.Unload(cause = LoadingShared.UnloadingCauses.Exiting) except: Debug.Log("Failed to unload the mod '" + mod.Mod.Namespace + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__)
def _ShowList (_connection: int = None) -> None: try: SettingsList.ShowListDialog() except Exception: commands.cheat_output("Failed to show settings list dialog.", _connection) Debug.Log("Failed to show settings list dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return
def RegisterObject(self, objectType: typing.Type[script_object.ScriptObject], interactionReference: typing.Type) -> bool: """ Add the specified interaction to the specified object. This will return false if the interaction could not be registered and true if it could. """ objectInteractionList = getattr(objectType, self.InteractionListAttribute, None) if isinstance(objectInteractionList, (tuple, list)): objectInteractionList += (interactionReference, ) setattr(objectType, self.InteractionListAttribute, objectInteractionList) return True else: if not self.IgnoreMissingAttribute: Debug.Log( "Failed to find valid interaction list with the attribute name '%s' in an object with a type of '%s'" % (self.InteractionListAttribute, Types.GetFullName(interactionReference)), This.Mod.Namespace, Debug.LogLevels.Error, group=This.Mod.Namespace, owner=__name__, lockIdentifier=__name__ + ":ObjectRegistration", lockReference=interactionReference) return False
def _Help(_connection: int = None) -> None: try: helpText = "" for consoleCommand in _consoleCommands: # type: ConsoleCommand if not consoleCommand.ShowHelp: continue if len(helpText) != 0: helpText += "\n" if consoleCommand.HelpInput is not None: helpText += consoleCommand.Alias[ consoleCommand. HelpAliasPosition] + " " + consoleCommand.HelpInput else: helpText += consoleCommand.Alias[ consoleCommand.HelpAliasPosition] commands.cheat_output(helpText + "\n", _connection) except Exception as e: output = commands.CheatOutput(_connection) output("Failed to show help information.") Debug.Log("Failed to show help information.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__, exception=e)
def _Setup() -> None: global _shownPromotions if os.path.exists(_shownPromotionsFilePath): try: with open(_shownPromotionsFilePath) as shownPromotionsFile: shownPromotions = json.JSONDecoder().decode( shownPromotionsFile.read()) if not isinstance(shownPromotions, list): raise Exceptions.IncorrectTypeException( shownPromotions, "Root", (list, )) for shownPromotionIndex in range( len(shownPromotions)): # type: int if not isinstance(shownPromotions[shownPromotionIndex], str): raise Exceptions.IncorrectTypeException( shownPromotions[shownPromotionIndex], "Root[%d]" % shownPromotionIndex, (str, )) _shownPromotions = shownPromotions except Exception as e: Debug.Log("Failed to read shown promotions file.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__, exception=e)
def InvokeModUnloadedEvent(mod: Mods.Mod, exiting: bool) -> ModUnloadedEventArguments: """ Invokes the mod unloaded event. Should be triggered every time a mod is unloaded. :param mod: A reference the mod in question. :type mod: Mods.Mod :param exiting: Whether or not the mod is unloading because the application is closing. :type exiting: bool :rtype: None """ eventArguments = ModUnloadedEventArguments( mod, exiting) # type: ModUnloadedEventArguments for modUnloadedCallback in ModUnloadedEvent: try: modUnloadedCallback(sys.modules[__name__], eventArguments) except: Debug.Log("Failed to invoke a mod unloaded callback at '" + Types.GetFullName(modUnloadedCallback) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__) return eventArguments
def Load(self, *args) -> bool: """ Load persistent data from the file path specified when initiating this object, if it exists. :rtype: None """ operationSuccess = True # type: bool persistenceInformation = self.PersistenceInformation # type: str persistentDataContainerString = "{}" # type: str if os.path.exists(self.FilePath): try: with open(self.FilePath) as persistentFile: persistentDataContainerString = persistentFile.read() except Exception: Debug.Log("Failed to read from '" + Paths.StripUserDataPath(self.FilePath) + "'.\n" + persistenceInformation, self.HostNamespace, Debug.LogLevels.Error, group=self.HostNamespace, owner=__name__) loadSuccessful = super().Load( persistentDataContainerString) # type: bool if not loadSuccessful: return False return operationSuccess
def _Setup () -> None: for mod in Mods.GetAllMods(): # type: Mods.Mod modLoader = _Loader(mod) # type: _Loader modLoader.GetInformation() registeredMods = "" # type: str for mod in Mods.GetAllMods(): # type: Mods.Mod if not mod.ReadInformation: continue if registeredMods != "": registeredMods += "\n" versionString = str(mod.Version) if versionString == mod.VersionDisplay: registeredMods += "%s, v%s" % (mod.Namespace, versionString) else: registeredMods += "%s, v%s (%s)" % (mod.Namespace, versionString, mod.VersionDisplay) Debug.Log("Registered mods:\n" + registeredMods, This.Mod.Namespace, Debug.LogLevels.Info, group = This.Mod.Namespace, owner = __name__) _CheckInstallation() LoadingEvents.ModLoadedEvent += _ModLoadedCallback atexit.register(_OnExitCallback) _PatchOnLoadingScreenAnimationFinished()
def DialogCallback (dialogReference: ui_dialog.UiDialogOkCancel) -> None: try: if dialogReference.response == ui_dialog.ButtonType.DIALOG_RESPONSE_OK: return confirmDialogCallback = None # type: typing.Optional[typing.Callable] confirmDialogText = None # type: typing.Optional[typing.Callable] if dialogReference.response == everythingResponseID: confirmDialogCallback = ConfirmDialogEverythingCallback confirmDialogText = ConfirmDialogEverythingText.GetCallableLocalizationString() elif dialogReference.response == settingsResponseID: confirmDialogCallback = ConfirmDialogSettingsCallback confirmDialogText = ConfirmDialogSettingsText.GetCallableLocalizationString() confirmDialogArguments = { "title": ConfirmDialogTitle.GetCallableLocalizationString(mod.Name), "text": confirmDialogText, "text_ok": ConfirmDialogYesButton.GetCallableLocalizationString(), "text_cancel": ConfirmDialogNoButton.GetCallableLocalizationString() } # type: typing.Dict[str, ...] Dialogs.ShowOkCancelDialog(callback = confirmDialogCallback, queue = False, **confirmDialogArguments) except Exception as e: Debug.Log("Failed to run the callback for the reset dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__, exception = e)
def ResetSettings (mod: Mods.Mod) -> bool: """ Resets all settings in this mod. :return: Returns true if successful or false if not. :rtype: bool """ try: for module in mod.Modules: # type: str OnReset = None # type: typing.Optional[typing.Callable] try: OnReset = getattr(sys.modules[module], "_OnResetSettings") except Exception: pass if isinstance(OnReset, types.FunctionType): if len(inspect.signature(OnReset).parameters) == 0: OnReset() except Exception as e: Debug.Log("Failed to reset all settings.", mod.Namespace, Debug.LogLevels.Exception, group = mod.Namespace, owner = __name__, exception = e) return False return True
def ConfirmDialogEverythingCallback (dialogReference: ui_dialog.UiDialogOkCancel) -> None: try: if dialogReference.response == ui_dialog.ButtonType.DIALOG_RESPONSE_OK: ResetEverything(mod) return except Exception as e: Debug.Log("Failed to run the confirm dialog everything callback for the reset dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__, exception = e)
def Save(self) -> bool: """ Saves the currently stored persistent data to the file path specified when initiating this object. If the directory the save file is in doesn't exist one will be created. :rtype: None """ operationSuccess = True # type: bool persistenceInformation = self.PersistenceInformation # type: str saveSuccessful, persistentDataContainerString = super().Save( ) # type: bool, str try: if not os.path.exists(os.path.dirname(self.FilePath)): os.makedirs(os.path.dirname(self.FilePath)) with open(self.FilePath, mode="w+") as persistentFile: persistentFile.write(persistentDataContainerString) except Exception: Debug.Log("Failed to read to '" + Paths.StripUserDataPath(self.FilePath) + "'.\n" + persistenceInformation, self.HostNamespace, Debug.LogLevels.Error, group=self.HostNamespace, owner=__name__) operationSuccess = False if not saveSuccessful: return False return operationSuccess
def _SaveGetData(self) -> typing.Tuple[bool, dict]: """ :return: The first value indicates if this method completed without incident. The second is the save data. :rtype: typing.Tuple[bool, dict] """ operationSuccess = True # type: bool persistenceInformation = self.PersistenceInformation # type: str persistentData = copy.deepcopy( self._loadedData) # type: typing.Dict[str, typing.Any] for persistentKey, persistentValueStorage in self._storage.items( ): # type: str, Persistent.Value try: if self._alwaysSaveValues or persistentValueStorage.IsSet: persistentData[ persistentKey] = persistentValueStorage.Save() except Exception: Debug.Log( "Failed to save value of '" + persistentKey + "'. This entry may be reset the next time this persistent data is loaded.\n" + persistenceInformation, self.HostNamespace, Debug.LogLevels.Warning, group=self.HostNamespace, owner=__name__) persistentData.pop(persistentKey, None) operationSuccess = False return operationSuccess, persistentData
def Load(self, persistentDataContainerString: str, *args) -> bool: """ Load persistent data from the file path specified when initiating this object, if it exists. :param persistentDataContainerString: The persistent data container dictionary as a json encoded string. :type persistentDataContainerString: str :rtype: None """ operationSuccess = True # type: bool persistenceInformation = self.PersistenceInformation # type: str if not isinstance(persistentDataContainerString, str): raise Exceptions.IncorrectTypeException( persistentDataContainerString, "persistentDataContainerString", (str, )) try: persistentDataContainer = json.JSONDecoder().decode( persistentDataContainerString) except Exception: Debug.Log( "Could not decode the persistent data container string.\n" + persistenceInformation, self.HostNamespace, Debug.LogLevels.Warning, group=self.HostNamespace, owner=__name__) persistentDataContainer = {} if not isinstance(persistentDataContainer, dict): Debug.Log( "Could not convert persistent data container string to a dictionary.\n" + persistenceInformation, self.HostNamespace, Debug.LogLevels.Warning, group=self.HostNamespace, owner=__name__) persistentDataContainer = {} loadSuccessful = super().Load(persistentDataContainer) # type: bool if not loadSuccessful: return False return operationSuccess
def _OnUnload (cause: LoadingShared.UnloadingCauses) -> None: if cause: pass try: Save() except Exception: Debug.Log("Failed to save settings.", This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__)
def __init_subclass__ (cls, *args, **kwargs): try: super().__init_subclass__(*args, **kwargs) AboutModInteractions.append(cls) except Exception as e: Debug.Log("Failed to initialize new sub class for '" + cls.__name__ + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) raise e
def _Reset (_connection: int = None) -> None: try: Resetting.ShowResetDialog(This.Mod) except Exception as e: output = commands.CheatOutput(_connection) output("Failed to show reset dialog.") Debug.Log("Failed to show reset dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__, exception = e)
def _OnLoadCallback (owner: Persistence.Persistent, eventArguments: Events.EventArguments) -> None: for setting in AllSettings: # type: Setting try: # noinspection PyProtectedMember setting._OnLoad() except Exception: Debug.Log("Failed to notify the setting '" + setting.Key + "' of a load event.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) _InvokeOnLoadWrapperEvent()
def _CheckUpdatesDistribution() -> None: try: _CheckUpdates() except Exception: Debug.Log("Failed to check for updates.", This.Mod.Namespace, Debug.LogLevels.Warning, group=This.Mod.Namespace, owner=__name__)
def _CheckInstallation () -> None: for modLoader in _allLoaders: # type: _Loader if not modLoader.Mod.IsLoadable(This.Mod.Namespace): continue if not modLoader.Mod.ReadInformation: continue if not modLoader.Mod.RequiredModsInstalled(): Debug.Log("One or more required mod for '%s' is not installed." % modLoader.Mod.Namespace, This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) modLoader.Disable(cascade = False, warningList = _invalidSetupMods) continue if modLoader.Mod.IncompatibleModsInstalled(): Debug.Log("One or more incompatible mod for '%s' is installed." % modLoader.Mod.Namespace, This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) modLoader.Disable(cascade = False, warningList = _invalidSetupMods) continue for modCompatibility in modLoader.Mod.Compatibility: # type: Mods.Compatibility if modCompatibility.LowestVersion is None and modCompatibility.HighestVersion is None: continue for checkingModLoader in _allLoaders: # type: _Loader if not checkingModLoader.Mod.ReadInformation: continue if checkingModLoader.Mod.Namespace == modCompatibility.Namespace: if modCompatibility.LowestVersion is not None and modCompatibility.LowestVersion > checkingModLoader.Mod.Version: Debug.Log("Mod '%s' (%s) is too old for the mod '%s' (%s)." % (checkingModLoader.Mod.Namespace, str(checkingModLoader.Mod.Version), modLoader.Mod.Namespace, str(modLoader.Mod.Version)), This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) modLoader.Disable(cascade = False, warningList = _invalidSetupMods) return if modCompatibility.HighestVersion is not None and modCompatibility.HighestVersion < checkingModLoader.Mod.Version: Debug.Log("Mod '%s' (%s) is too new for the mod '%s' (%s)." % (checkingModLoader.Mod.Namespace, str(checkingModLoader.Mod.Version), modLoader.Mod.Namespace, str(modLoader.Mod.Version)), This.Mod.Namespace, Debug.LogLevels.Warning, group = This.Mod.Namespace, owner = __name__) modLoader.Disable(cascade = False, warningList = _invalidSetupMods) return break _CheckInstallationLoop()
def DialogCallback(dialogReference: ui_dialog.UiDialogOkCancel) -> None: try: if returnCallback is not None: returnCallback() except Exception: Debug.Log("Failed to run the callback for the about mod dialog.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__)
def _InvokeOnLoadWrapperEvent () -> Events.EventArguments: eventArguments = Events.EventArguments() # type: Events.EventArguments for updateCallback in _onUpdateWrapper: # type: typing.Callable[[types.ModuleType, Events.EventArguments], None] try: updateCallback(sys.modules[__name__], eventArguments) except: Debug.Log("Failed to run the 'OnLoadWrapper' callback '" + Types.GetFullName(updateCallback) + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return eventArguments