+ implement hexagon sketch

This commit is contained in:
wmayer
2014-06-03 14:54:27 +02:00
parent c05801d6ed
commit 5917d21395
6 changed files with 92 additions and 8 deletions

View File

@@ -778,6 +778,21 @@ PythonCommand::PythonCommand(const char* name,PyObject * pcPyCommand, const char
// check if the "GetResources()" method returns a Dict object
if (!PyDict_Check(_pcPyResourceDict))
throw Base::Exception("PythonCommand::PythonCommand(): Method GetResources() of the Python command object returns the wrong type (has to be Py Dictonary)");
// check for command type
std::string cmdType = getResource("CmdType");
if (!cmdType.empty()) {
int type = 0;
if (cmdType.find("AlterDoc") != std::string::npos)
type += int(AlterDoc);
if (cmdType.find("Alter3DView") != std::string::npos)
type += int(Alter3DView);
if (cmdType.find("AlterSelection") != std::string::npos)
type += int(AlterSelection);
if (cmdType.find("ForEdit") != std::string::npos)
type += int(ForEdit);
eType = type;
}
}
const char* PythonCommand::getResource(const char* sName) const
@@ -796,7 +811,7 @@ const char* PythonCommand::getResource(const char* sName) const
void PythonCommand::activated(int iMsg)
{
if (Activation == "") {
if (Activation.empty()) {
try {
Interpreter().runMethodVoid(_pcPyCommand, "Activated");
}

View File

@@ -36,6 +36,14 @@
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getInEdit">
<Documentation>
<UserDocu>
getInEdit()
Returns the current object in edit mode or None if there is no such object
</UserDocu>
</Documentation>
</Methode>
<Methode Name="resetEdit">
<Documentation>
<UserDocu>

View File

@@ -119,6 +119,19 @@ PyObject* DocumentPy::setEdit(PyObject *args)
Py_Return;
}
PyObject* DocumentPy::getInEdit(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
ViewProvider* vp = getDocumentPtr()->getInEdit();
if (vp) {
return vp->getPyObject();
}
Py_Return;
}
PyObject* DocumentPy::resetEdit(PyObject *args)
{
if (!PyArg_ParseTuple(args, ";No arguments allowed")) // convert args: Python->C