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 _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 _ShowDialog(key: str, _connection: int = None) -> None: try: if not isinstance(key, str): raise Exceptions.IncorrectTypeException(key, "key", (str, )) except Exception: Debug.Log("Incorrect types for command.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__) return try: allSettings = Settings.GetAllSettings() for setting in allSettings: # type: SettingsBase.Setting if setting.Key.lower() == key: setting.ShowDialog() return except Exception: commands.cheat_output( "Failed to show dialog for setting '" + key + "'.", _connection) Debug.Log("Failed to show dialog for setting '" + key + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group=This.Mod.Namespace, owner=__name__) return commands.cheat_output("Cannot find setting '" + key + "'.\n", _connection)
def _ShowDialog (key: str, _connection: int = None) -> None: try: allSettings = Settings.GetAllSettings() for setting in allSettings: # type: SettingsBase.Setting if setting.Key.lower() == key: setting.ShowDialog() return except Exception: commands.cheat_output("Failed to show dialog for setting '" + key + "'.", _connection) Debug.Log("Failed to show dialog for setting '" + key + "'.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return commands.cheat_output("Cannot find setting '" + key + "'.\n", _connection)
def _PrintNames (_connection: int = None) -> None: try: allSettings = Settings.GetAllSettings() settingKeysString = "" for setting in allSettings: # type: SettingsBase.Setting if len(settingKeysString) == 0: settingKeysString += setting.Key else: settingKeysString += "\n" + setting.Key commands.cheat_output(settingKeysString + "\n", _connection) except Exception: commands.cheat_output("Failed to print setting names.", _connection) Debug.Log("Failed to print setting names.", This.Mod.Namespace, Debug.LogLevels.Exception, group = This.Mod.Namespace, owner = __name__) return