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