diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp
index 47ebbd742..fdb7fef3c 100644
--- a/src/Gui/Tree.cpp
+++ b/src/Gui/Tree.cpp
@@ -1052,7 +1052,6 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o
default:
break;
}
-
jt->second->setFont(0,f);
}
diff --git a/src/Mod/Assembly/App/Item.cpp b/src/Mod/Assembly/App/Item.cpp
index 0a52687e8..b41a0a327 100644
--- a/src/Mod/Assembly/App/Item.cpp
+++ b/src/Mod/Assembly/App/Item.cpp
@@ -28,6 +28,7 @@
#include
#include "Item.h"
+#include "ItemPy.h"
using namespace Assembly;
@@ -62,4 +63,13 @@ App::DocumentObjectExecReturn *Item::execute(void)
return App::DocumentObject::StdReturn;
}
+PyObject *Item::getPyObject(void)
+{
+ if (PythonObject.is(Py::_None())){
+ // ref counter is set to 1
+ PythonObject = Py::Object(new ItemPy(this),true);
+ }
+ return Py::new_reference_to(PythonObject);
+}
+
}
\ No newline at end of file
diff --git a/src/Mod/Assembly/App/Item.h b/src/Mod/Assembly/App/Item.h
index 50ada9aee..8119b4b36 100644
--- a/src/Mod/Assembly/App/Item.h
+++ b/src/Mod/Assembly/App/Item.h
@@ -71,9 +71,11 @@ public:
return "AssemblyGui::ViewProviderItem";
}
//@}
+
+ PyObject *getPyObject(void);
};
-} //namespace PartDesign
+} //namespace Assembly
-#endif // PART_Item_H
+#endif // ASSEMBLY_Item_H
diff --git a/src/Mod/Assembly/Gui/AppAssemblyGui.cpp b/src/Mod/Assembly/Gui/AppAssemblyGui.cpp
index 7185b7ace..e68b00481 100644
--- a/src/Mod/Assembly/Gui/AppAssemblyGui.cpp
+++ b/src/Mod/Assembly/Gui/AppAssemblyGui.cpp
@@ -27,6 +27,7 @@
#endif
#include
+#include
#include
#include
#include "Workbench.h"
@@ -67,6 +68,9 @@ void AssemblyGuiExport initAssemblyGui()
(void) Py_InitModule("AssemblyGui", AssemblyGui_Import_methods); /* mod name, table ptr */
Base::Console().Log("Loading GUI of Assembly module... done\n");
+ // directly load the module for usage in commands
+ Base::Interpreter().runString("import AssemblyGui");
+
// instanciating the commands
CreateAssemblyCommands();
CreateAssemblyConstraintCommands();
diff --git a/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp b/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp
index ef5fda285..f2218e0b3 100644
--- a/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp
+++ b/src/Mod/Assembly/Gui/AppAssemblyGuiPy.cpp
@@ -47,27 +47,29 @@ Gui::ViewProviderDocumentObject *ActiveVp =0;
static PyObject * setActiveAssembly(PyObject *self, PyObject *args)
{
PyObject *object=0;
- if (PyArg_ParseTuple(args,"|O",&(Assembly::ItemPy::Type), &object)) {
+ if (PyArg_ParseTuple(args,"|O!",&(Assembly::ItemPy::Type), &object)&& object) {
Assembly::Item* Item = static_cast(object)->getItemPtr();
// Should be set!
assert(Item);
// get the gui document of the Assembly Item
- Gui::Document* GuiDoc = Gui::Application::Instance->getDocument(Item->getDocument());
- Gui::ViewProviderDocumentObject* vp = dynamic_cast (GuiDoc->getViewProvider(Item)) ;
if(ActiveAsmObject){
- GuiDoc->signalHighlightObject(*vp,Gui::HiglightMode::None);
+ ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::None);
ActiveAsmObject = 0;
}
ActiveAsmObject = Item;
- //Gui::ViewProvider* vp = Gui::Application::Instance -> getViewProvider(ActiveAsmObject);
- //PyErr_SetString(PyExc_Exception, "empty shape");
-
+ ActiveGuiDoc = Gui::Application::Instance->getDocument(Item->getDocument());
+ ActiveVp = dynamic_cast (ActiveGuiDoc->getViewProvider(Item)) ;
+ ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue);
+
+ }else{
+ ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::None);
+ ActiveAsmObject = 0;
}
- return 0;
+ Py_Return;
}