Automatic WB switching and Active PartDesign body
This commit is contained in:
parent
b825571562
commit
903855ad82
|
@ -61,10 +61,10 @@ static PyObject * setActivePart(PyObject *self, PyObject *args)
|
|||
ActivePartObject = Item;
|
||||
ActiveGuiDoc = Gui::Application::Instance->getDocument(Item->getDocument());
|
||||
ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*> (ActiveGuiDoc->getViewProvider(Item)) ;
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue,true);
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Underlined,true);
|
||||
|
||||
}else{
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Blue,false);
|
||||
ActiveGuiDoc->signalHighlightObject(*ActiveVp,Gui::Underlined,false);
|
||||
ActivePartObject = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ ViewProviderItemAssembly::~ViewProviderItemAssembly()
|
|||
|
||||
bool ViewProviderItemAssembly::doubleClicked(void)
|
||||
{
|
||||
Gui::Command::assureWorkbench("AssemblyWorkbench");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"AssemblyGui.setActiveAssembly(App.activeDocument().%s)",this->getObject()->getNameInDocument());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <Base/Placement.h>
|
||||
|
||||
#include "Body.h"
|
||||
#include "BodyPy.h"
|
||||
|
||||
|
||||
using namespace PartDesign;
|
||||
|
@ -56,4 +57,13 @@ App::DocumentObjectExecReturn *Body::execute(void)
|
|||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
PyObject *Body::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())){
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new BodyPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
}
|
|
@ -44,10 +44,13 @@ public:
|
|||
App::DocumentObjectExecReturn *execute(void);
|
||||
short mustExecute() const;
|
||||
/// returns the type name of the view provider
|
||||
//const char* getViewProviderName(void) const {
|
||||
// return "PartDesignGui::ViewProviderBody";
|
||||
//}
|
||||
const char* getViewProviderName(void) const {
|
||||
return "PartDesignGui::ViewProviderBody";
|
||||
}
|
||||
//@}
|
||||
|
||||
PyObject *getPyObject(void);
|
||||
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "Workbench.h"
|
||||
#include "ViewProviderPocket.h"
|
||||
#include "ViewProviderBody.h"
|
||||
#include "ViewProviderPad.h"
|
||||
#include "ViewProviderChamfer.h"
|
||||
#include "ViewProviderFillet.h"
|
||||
|
@ -105,6 +106,7 @@ PyMODINIT_FUNC initPartDesignGui()
|
|||
|
||||
PartDesignGui::Workbench ::init();
|
||||
PartDesignGui::ViewProvider ::init();
|
||||
PartDesignGui::ViewProviderBody ::init();
|
||||
PartDesignGui::ViewProviderPocket ::init();
|
||||
PartDesignGui::ViewProviderPad ::init();
|
||||
PartDesignGui::ViewProviderRevolution ::init();
|
||||
|
|
|
@ -44,10 +44,10 @@ ViewProviderBody::~ViewProviderBody()
|
|||
|
||||
bool ViewProviderBody::doubleClicked(void)
|
||||
{
|
||||
std::string Msg("Change ");
|
||||
Msg += this->pcObject->getNameInDocument();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s',0)",this->pcObject->getNameInDocument());
|
||||
// assure the PartDesign workbench
|
||||
Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
Gui::Command::addModule(Gui::Command::Gui,"PartDesignGui");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"PartDesignGui.setActivePart(App.activeDocument().%s)",this->getObject()->getNameInDocument());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <Gui/MenuManager.h>
|
||||
#include <Gui/ToolBarManager.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
|
@ -155,6 +156,8 @@ void Workbench::activated()
|
|||
|
||||
void Workbench::deactivated()
|
||||
{
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"PartDesignGui.setActivePart(None)");
|
||||
|
||||
Gui::Workbench::deactivated();
|
||||
removeTaskWatcher();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user