Switch to PartDesign workbench as soon as a PartDesign feature is edited
This commit is contained in:
parent
ce224298a7
commit
8682b5f490
|
@ -43,6 +43,9 @@ public:
|
|||
void updateData(const App::Property*);
|
||||
|
||||
virtual bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
protected:
|
||||
std::string oldWb;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -85,8 +85,9 @@ bool ViewProviderChamfer::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if(ModNum == 1)
|
||||
// Gui::Command::openCommand("Change chamfer parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
|
@ -103,10 +104,10 @@ bool ViewProviderChamfer::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderChamfer::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -85,8 +85,9 @@ bool ViewProviderDraft::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if(ModNum == 1)
|
||||
// Gui::Command::openCommand("Change draft parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (draftDlg)
|
||||
|
@ -103,10 +104,10 @@ bool ViewProviderDraft::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderDraft::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// and update the draft
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -85,8 +85,9 @@ bool ViewProviderFillet::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if(ModNum == 1)
|
||||
// Gui::Command::openCommand("Change fillet parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
|
@ -103,10 +104,10 @@ bool ViewProviderFillet::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderFillet::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -102,8 +102,9 @@ bool ViewProviderGroove::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if (ModNum == 1)
|
||||
// Gui::Command::openCommand("Change Groove parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
|
@ -120,10 +121,10 @@ bool ViewProviderGroove::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderGroove::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ bool ViewProviderLinearPattern::setEdit(int ModNum)
|
|||
TaskDlgLinearPatternParameters *linearpatternDlg = NULL;
|
||||
|
||||
if (checkDlgOpen(linearpatternDlg)) {
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (linearpatternDlg)
|
||||
Gui::Control().showDialog(linearpatternDlg);
|
||||
|
|
|
@ -46,6 +46,9 @@ bool ViewProviderMirrored::setEdit(int ModNum)
|
|||
TaskDlgMirroredParameters *mirroredDlg = NULL;
|
||||
|
||||
if (checkDlgOpen(mirroredDlg)) {
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (mirroredDlg)
|
||||
Gui::Control().showDialog(mirroredDlg);
|
||||
|
|
|
@ -46,6 +46,9 @@ bool ViewProviderMultiTransform::setEdit(int ModNum)
|
|||
TaskDlgMultiTransformParameters *multitransformDlg = NULL;
|
||||
|
||||
if (checkDlgOpen(multitransformDlg)) {
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (multitransformDlg)
|
||||
Gui::Control().showDialog(multitransformDlg);
|
||||
|
|
|
@ -100,6 +100,9 @@ bool ViewProviderPad::setEdit(int ModNum)
|
|||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
Gui::Control().showDialog(padDlg);
|
||||
|
@ -115,10 +118,10 @@ bool ViewProviderPad::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderPad::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -92,8 +92,9 @@ bool ViewProviderPocket::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if(ModNum == ViewProvider::Default)
|
||||
// Gui::Command::openCommand("Change pocket parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
|
@ -110,10 +111,10 @@ bool ViewProviderPocket::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderPocket::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default ) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ bool ViewProviderPolarPattern::setEdit(int ModNum)
|
|||
TaskDlgPolarPatternParameters *polarpatternDlg = NULL;
|
||||
|
||||
if (checkDlgOpen(polarpatternDlg)) {
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (polarpatternDlg)
|
||||
Gui::Control().showDialog(polarpatternDlg);
|
||||
|
|
|
@ -102,8 +102,9 @@ bool ViewProviderRevolution::setEdit(int ModNum)
|
|||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
//if (ModNum == 1)
|
||||
// Gui::Command::openCommand("Change revolution parameters");
|
||||
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (padDlg)
|
||||
|
@ -120,10 +121,10 @@ bool ViewProviderRevolution::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderRevolution::unsetEdit(int ModNum)
|
||||
{
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// and update the pad
|
||||
//getSketchObject()->getDocument()->recompute();
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ bool ViewProviderScaled::setEdit(int ModNum)
|
|||
TaskDlgScaledParameters *scaledDlg = NULL;
|
||||
|
||||
if (checkDlgOpen(scaledDlg)) {
|
||||
// always change to PartDesign WB, remember where we come from
|
||||
oldWb = Gui::Command::assureWorkbench("PartDesignWorkbench");
|
||||
|
||||
// start the edit dialog
|
||||
if (scaledDlg)
|
||||
Gui::Control().showDialog(scaledDlg);
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "TaskTransformedParameters.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/PartDesign/App/FeatureAdditive.h>
|
||||
|
@ -129,6 +130,9 @@ bool ViewProviderTransformed::setEdit(int ModNum)
|
|||
|
||||
void ViewProviderTransformed::unsetEdit(int ModNum)
|
||||
{
|
||||
// return to the WB we were in before editing the PartDesign feature
|
||||
Gui::Command::assureWorkbench(oldWb.c_str());
|
||||
|
||||
if (ModNum == ViewProvider::Default) {
|
||||
// when pressing ESC make sure to close the dialog
|
||||
Gui::Control().closeDialog();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <Gui/Command.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/ToolBoxManager.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
|
@ -58,6 +59,12 @@ StartGui::Workbench::~Workbench()
|
|||
|
||||
void StartGui::Workbench::activated()
|
||||
{
|
||||
// Ensure that we don't open the Start page multiple times
|
||||
QList<QWidget*> ch = Gui::getMainWindow()->windows();
|
||||
for (QList<QWidget*>::const_iterator c = ch.begin(); c != ch.end(); c++)
|
||||
if ((*c)->windowTitle() == QObject::tr("Start page"))
|
||||
return;
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"import WebGui");
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"from StartPage import StartPage");
|
||||
|
|
Loading…
Reference in New Issue
Block a user