diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 91b8701..c3e274a 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -658,7 +658,7 @@ BOOST_PYTHON_MODULE(mobase) // Kept but deprecated for backward compatibility: .def("onModStateChanged", +[](IModList* modList, const std::function& fn) { - utils::show_depreciation_warning("onModStateChanged", + utils::show_deprecation_warning("onModStateChanged", "onModStateChanged(Callable[[str, IModList.ModStates], None]) is deprecated, " "use onModStateChanged(Callable[[Dict[str, IModList.ModStates], None]) instead."); return modList->onModStateChanged([fn](auto const& map) { diff --git a/src/runner/pythonutils.cpp b/src/runner/pythonutils.cpp index 088d1b6..37445c5 100644 --- a/src/runner/pythonutils.cpp +++ b/src/runner/pythonutils.cpp @@ -9,9 +9,9 @@ namespace utils { - void show_depreciation_warning(std::string_view name, std::string_view message, bool show_once) { + void show_deprecation_warning(std::string_view name, std::string_view message, bool show_once) { - // Contains the list of filename / line number for which a depreciation warning has already been shown. + // Contains the list of filename / line number for which a deprecation warning has already been shown. static std::set> DeprecatedLines; // Find the caller: @@ -27,7 +27,7 @@ namespace utils { return; } - // Register the depreciation: + // Register the deprecation: DeprecatedLines.emplace(filename, lineno); auto path = relative(std::filesystem::path(filename), QCoreApplication::applicationDirPath().toStdWString()); diff --git a/src/runner/pythonutils.h b/src/runner/pythonutils.h index 9d77594..92bb301 100644 --- a/src/runner/pythonutils.h +++ b/src/runner/pythonutils.h @@ -199,15 +199,17 @@ namespace utils { /** - * @brief Show a depreciation warning. + * @brief Show a deprecation warning. + * + * This methods will print a warning in MO2 log containing the location of the call to + * the deprecated function. If show_once is true, the deprecation warning will only be + * logged the first time the function is called at this location. * * @param name Name of the deprecated function. - * @param message Depreciation message. - * @param show_once Only show the message once. - * - * @return a depreciation object. + * @param message Deprecation message. + * @param show_once Only show the message once per call location. */ - void show_depreciation_warning(std::string_view name, std::string_view message = "", bool show_once = true); + void show_deprecation_warning(std::string_view name, std::string_view message = "", bool show_once = true); }