fixes in highlight code
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#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();
|
||||
|
||||
@@ -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<Assembly::ItemPy*>(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<Gui::ViewProviderDocumentObject*> (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<Gui::ViewProviderDocumentObject*> (ActiveGuiDoc->getViewProvider(Item)) ;
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue);
|
||||
|
||||
}else{
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::None);
|
||||
ActiveAsmObject = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user