Now with more Property properties!

This commit is contained in:
Ian Rees 2015-04-25 23:43:15 +12:00
parent 070198ecf2
commit 74c9a3dc4e

View File

@ -286,17 +286,23 @@ void PropertyEnumeration::setEnums(const char **plEnums)
void PropertyEnumeration::setValue(const char *value) void PropertyEnumeration::setValue(const char *value)
{ {
aboutToSetValue();
_enum.setValue(value); _enum.setValue(value);
hasSetValue();
} }
void PropertyEnumeration::setValue(long value) void PropertyEnumeration::setValue(long value)
{ {
aboutToSetValue();
_enum.setValue(value); _enum.setValue(value);
hasSetValue();
} }
void PropertyEnumeration::setValue(const Enumeration &source) void PropertyEnumeration::setValue(const Enumeration &source)
{ {
aboutToSetValue();
_enum = source; _enum = source;
hasSetValue();
} }
long PropertyEnumeration::getValue(void) const long PropertyEnumeration::getValue(void) const
@ -393,13 +399,17 @@ void PropertyEnumeration::setPyObject(PyObject *value)
if (PyInt_Check(value)) { if (PyInt_Check(value)) {
long val = PyInt_AsLong(value); long val = PyInt_AsLong(value);
if (_enum.isValid()) { if (_enum.isValid()) {
aboutToSetValue();
_enum.setValue(val, true); _enum.setValue(val, true);
hasSetValue();
} }
} }
else if (PyString_Check(value)) { else if (PyString_Check(value)) {
const char* str = PyString_AsString (value); const char* str = PyString_AsString (value);
if (_enum.contains(str)) { if (_enum.contains(str)) {
aboutToSetValue();
_enum.setValue(PyString_AsString (value)); _enum.setValue(PyString_AsString (value));
hasSetValue();
} }
else { else {
std::stringstream out; std::stringstream out;