From 70172ddda6716b703cc44f6e7dabcc88649f5dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Sat, 2 May 2020 15:34:06 +0200 Subject: [PATCH] Add possibility to create GuessedString from python. --- src/runner/pythonrunner.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 31fd0f1..a2e0e09 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -1125,7 +1125,9 @@ BOOST_PYTHON_MODULE(mobase) .value("USER", MOBase::GUESS_USER) ; - bpy::class_, boost::noncopyable>("GuessedString", bpy::no_init) + bpy::class_, boost::noncopyable>("GuessedString") + .def(bpy::init<>()) + .def(bpy::init()) .def("update", static_cast& (GuessedValue::*)(const QString&)>(&GuessedValue::update), bpy::return_self<>()) @@ -1136,6 +1138,7 @@ BOOST_PYTHON_MODULE(mobase) // Methods to simulate the assignment operator: .def("reset", +[](GuessedValue* gv) { *gv = GuessedValue(); }, bpy::return_self<>()) .def("reset", +[](GuessedValue* gv, const QString& value, EGuessQuality eq) { *gv = GuessedValue(value, eq); }, bpy::return_self<>()) + .def("reset", +[](GuessedValue* gv, const GuessedValue& other) { *gv = other; }, bpy::return_self<>()) // Use an intermediate lambda to avoid having to register the std::function conversion: .def("setFilter", +[](GuessedValue* gv, bpy::object fn) { gv->setFilter(fn); })