+ support of unicode names for sketch constraints

This commit is contained in:
wmayer
2015-09-24 03:17:47 +02:00
parent 35327386e7
commit 92b330bbcb
4 changed files with 13 additions and 10 deletions

View File

@@ -318,10 +318,13 @@ PyObject* SketchObjectPy::delConstraint(PyObject *args)
PyObject* SketchObjectPy::renameConstraint(PyObject *args)
{
int Index;
char* Name;
if (!PyArg_ParseTuple(args, "is", &Index, &Name))
char* utf8Name;
if (!PyArg_ParseTuple(args, "iet", &Index, "utf-8", &utf8Name))
return 0;
std::string Name = utf8Name;
PyMem_Free(utf8Name);
if (this->getSketchObjectPtr()->Constraints.getSize() <= Index) {
std::stringstream str;
str << "Not able to rename a constraint with the given index: " << Index;
@@ -329,7 +332,7 @@ PyObject* SketchObjectPy::renameConstraint(PyObject *args)
return 0;
}
if (strcmp(Name, "") != 0) {
if (!Name.empty()) {
if (!Sketcher::PropertyConstraintList::validConstraintName(Name)) {
std::stringstream str;