mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Move the storage for deprecated lines in show_depreciation_warnings().
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
// Contains the list of filename / line number for which a depreciation warning has already been shown.
|
||||
static std::set<std::pair<std::string, int>> g_DeprecatedLines;
|
||||
|
||||
namespace utils {
|
||||
|
||||
void show_depreciation_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.
|
||||
static std::set<std::pair<std::string, int>> DeprecatedLines;
|
||||
|
||||
// Find the caller:
|
||||
auto inspect = bpy::import("inspect");
|
||||
@@ -23,12 +23,12 @@ namespace utils {
|
||||
auto lineno = bpy::extract<int>(callable_frame[-1].attr("lineno"));
|
||||
|
||||
// Only show once if requested:
|
||||
if (show_once && g_DeprecatedLines.contains({ filename, lineno })) {
|
||||
if (show_once && DeprecatedLines.contains({ filename, lineno })) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the depreciation:
|
||||
g_DeprecatedLines.emplace(filename, lineno);
|
||||
DeprecatedLines.emplace(filename, lineno);
|
||||
|
||||
auto path = relative(std::filesystem::path(filename), QCoreApplication::applicationDirPath().toStdWString());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user