fixes in highlight code
This commit is contained in:
parent
26afb6ee77
commit
72b49dbc6b
|
@ -1052,7 +1052,6 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
jt->second->setFont(0,f);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <Base/Placement.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
}
|
|
@ -71,9 +71,11 @@ public:
|
|||
return "AssemblyGui::ViewProviderItem";
|
||||
}
|
||||
//@}
|
||||
|
||||
PyObject *getPyObject(void);
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
} //namespace Assembly
|
||||
|
||||
|
||||
#endif // PART_Item_H
|
||||
#endif // ASSEMBLY_Item_H
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user