Events_Loop::loop()->send(aMessage);
}
+const char* toString(ModelAPI_ExecState theExecState)
+{
+#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
+ switch (theExecState) {
+ TO_STRING(ModelAPI_StateDone)
+ TO_STRING(ModelAPI_StateMustBeUpdated)
+ TO_STRING(ModelAPI_StateExecFailed)
+ TO_STRING(ModelAPI_StateInvalidArgument)
+ TO_STRING(ModelAPI_StateNothing)
+ default: return "Unknown ExecState.";
+ }
+#undef TO_STRING
+}
+
+QString ModuleBase_IModule::getFeatureError(const FeaturePtr& theFeature)
+{
+ QString anError;
+ if (!theFeature.get() || !theFeature->data()->isValid() || theFeature->isAction())
+ return anError;
+
+ // to be removed later, this error should be got from the feature
+ if (theFeature->data()->execState() == ModelAPI_StateDone ||
+ theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
+ return anError;
+
+ // set error indication
+ anError = QString::fromStdString(theFeature->error());
+ if (anError.isEmpty()) {
+ bool isDone = ( theFeature->data()->execState() == ModelAPI_StateDone
+ || theFeature->data()->execState() == ModelAPI_StateMustBeUpdated );
+ if (!isDone)
+ anError = toString(theFeature->data()->execState());
+ }
+
+ return anError;
+}
+
ModuleBase_Operation* ModuleBase_IModule::getNewOperation(const std::string& theFeatureId)
{
return new ModuleBase_OperationFeature(theFeatureId.c_str(), this);
/// \param theStdActions - a map of standard actions\r
virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions) {}\r
\r
+ //! Returns the feature error if the current state of the feature in the module is not correct\r
+ //! If the feature is correct, it returns an empty value\r
+ //! \return string value\r
+ virtual QString getFeatureError(const FeaturePtr& theFeature);\r
+\r
signals:\r
void operationLaunched();\r
\r
return aAction;
}
-bool NewGeom_Module::isNestedFeature(const QAction* theAction)
+bool NewGeom_Module::isFeatureOfNested(const QAction* theAction)
{
return dynamic_cast<const NewGeom_NestedButton*>(theAction);
}
-QAction* NewGeom_Module::addNestedFeature(const QString& theWBName,
- const ActionInfo& theInfo,
- const QList<QAction*>& theNestedActions)
+QAction* NewGeom_Module::addFeatureOfNested(const QString& theWBName,
+ const ActionInfo& theInfo,
+ const QList<QAction*>& theNestedActions)
{
int aMenu = createMenu(theWBName, -1, -1, 50);
int aTool = createTool(theWBName, theWBName);
virtual QAction* addFeature(const QString& theWBName,
const ActionInfo& theInfo);
- virtual QAction* addNestedFeature(const QString& theWBName,
+ virtual QAction* addFeatureOfNested(const QString& theWBName,
const ActionInfo& theInfo,
const QList<QAction*>& theNestedActions);
//! it is created by addNestedFeature().
//! \param theId - an action of a feature
//! returns boolean result
- virtual bool isNestedFeature(const QAction* theAction);
+ virtual bool isFeatureOfNested(const QAction* theAction);
virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
const QString& theTip, const QIcon& theIcon,
#include <ModelAPI_Session.h>
#include <GeomValidators_DifferentShapes.h>
#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeString.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomDataAPI_Point.h>
#include <XGUI_ObjectsBrowser.h>
#include <XGUI_SelectionMgr.h>
#include <XGUI_DataModel.h>
+#include <XGUI_ErrorMgr.h>
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
Events_Loop* aLoop = Events_Loop::loop();
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_FAILED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SOLVER_REPAIRED));
mySelectionFilters.Append(new PartSet_GlobalFilter(myWorkshop));
mySelectionFilters.Append(new PartSet_FilterInfinite(myWorkshop));
myMenuMgr->updateViewerMenu(theStdActions);
}
+QString PartSet_Module::getFeatureError(const FeaturePtr& theFeature)
+{
+ QString anError = ModuleBase_IModule::getFeatureError(theFeature);
+
+ if (anError.isEmpty())
+ anError = sketchMgr()->getFeatureError(theFeature);
+
+ if (anError.isEmpty()) {
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+ XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
+
+ if (anOpMgr->isValidationLocked()) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (anOpMgr->currentOperation());
+ if (!aFOperation || theFeature == aFOperation->feature())
+ anError = "Validation is locked by the current operation";
+ }
+ }
+ return anError;
+}
void PartSet_Module::activeSelectionModes(QIntList& theModes)
{
foreach(ObjectPtr aObj, aObjects)
aDisplayer->redisplay(aObj, false);
aDisplayer->updateViewer();
+ } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_FAILED) ||
+ theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)) {
+ CompositeFeaturePtr aSketch = sketchMgr()->activeSketch();
+ if (aSketch.get()) {
+ if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_REPAIRED)) {
+ // it should be moved out, validating is called to update error string of the sketch feature
+ if (sketchMgr()->activeSketch().get()) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+ bool aValid = aFactory->validate(sketchMgr()->activeSketch());
+ }
+ }
+
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ aWorkshop->errorMgr()->updateActions(aSketch);
+ }
}
}
/// \param theStdActions - a map of standard actions
virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
+ //! Returns the feature error if the current state of the feature in the module is not correct
+ //! If the feature is correct, it returns an empty value
+ //! \return string value
+ virtual QString getFeatureError(const FeaturePtr& theFeature);
+
public slots:
/// SLOT, that is called by no more widget signal emitted by property panel
/// Set a specific flag to restart the sketcher operation
return anError;
}
+QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
+{
+ QString anError = "";
+ if (!theFeature.get() || !theFeature->data()->isValid())
+ return anError;
+
+ CompositeFeaturePtr aSketch = activeSketch();
+ if (aSketch.get() && aSketch == theFeature) {
+ AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
+ anError = aAttributeString->value().c_str();
+ if (anError.isEmpty()) {
+ if (isNestedCreateOperation(getCurrentOperation()) &&
+ aSketch->numberOfSubs() == 1) {
+ AttributePtr aFeaturesAttr = aSketch->attribute(SketchPlugin_Sketch::FEATURES_ID());
+ anError = std::string("Attribute \"" + aFeaturesAttr->id() + "\" is not initialized.").c_str();
+ }
+ }
+ }
+ else if (myIsResetCurrentValue) { // this flag do not allow commit of the current operation
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (getCurrentOperation());
+ if (aFOperation) {
+ FeaturePtr aFeature = aFOperation->feature();
+ if (aFeature.get() && aFeature == theFeature && isNestedCreateOperation(aFOperation))
+ anError = "Please input value in Property Panel. It is not initialized.";
+ }
+ }
+ return anError;
+}
const QStringList& PartSet_SketcherMgr::sketchOperationIdList()
{
/// \return boolean value
bool sketchSolverError();
+ //! Returns the feature error if the current state of the feature in the sketch is not correct
+ //! If the feature is correct, it returns an empty value
+ //! Incorrect states: the feature is sketch, the solver error value
+ //! The feature value is reset, this is the flag of sketch mgr
+ //! \return string value
+ QString getFeatureError(const FeaturePtr& theFeature);
+
/// Returns list of strings which contains id's of sketch operations
static const QStringList& sketchOperationIdList();
}
} catch (...) {
// Events_Error::send(SketchSolver_Error::SOLVESPACE_CRASH(), this);
+ getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::SOLVESPACE_CRASH());
if (myPrevSolved) {
+ // the error message should be changed before sending the message
sendMessage(EVENT_SOLVER_FAILED);
myPrevSolved = false;
}
- getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::SOLVESPACE_CRASH());
return false;
}
if (aResult == SLVS_RESULT_OKAY) { // solution succeeded, store results into correspondent attributes
aConstrIter->second->refresh();
myFeatureStorage->blockEvents(false);
if (!myPrevSolved) {
+ getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
+ // the error message should be changed before sending the message
sendMessage(EVENT_SOLVER_REPAIRED);
myPrevSolved = true;
- getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue("");
}
} else if (!myConstraints.empty()) {
// Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);
+ getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::CONSTRAINTS());
if (myPrevSolved) {
+ // the error message should be changed before sending the message
sendMessage(EVENT_SOLVER_FAILED);
myPrevSolved = false;
}
- getWorkplane()->string(SketchPlugin_Sketch::SOLVER_ERROR())->setValue(SketchSolver_Error::CONSTRAINTS());
}
aResolved = true;
#include "XGUI_ErrorMgr.h"
#include "XGUI_OperationMgr.h"
+#include "XGUI_ModuleConnector.h"
+#include "XGUI_Workshop.h"
+#include "XGUI_ActionsMgr.h"
#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_IModule.h>
#include <ModuleBase_ModelWidget.h>
#include <ModuleBase_OperationFeature.h>
const QString INVALID_VALUE = "invalid_action";
-XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent /*= 0*/)
+XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop)
: ModuleBase_IErrorMgr(theParent),
myErrorDialog(0),
- myErrorLabel(0)
+ myErrorLabel(0),
+ myWorkshop(theWorkshop)
{
}
}
-bool XGUI_ErrorMgr::canProcessClick(QAction* theAction, const FeaturePtr& theFeature)
+void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature)
{
- QString aData = theAction->data().toString();
+ QString anError = myWorkshop->module()->getFeatureError(theFeature);
- bool isActionEnabled = theAction->data() != INVALID_VALUE;
+ //update Ok Action and header of property panel if the current operation started for the feature
+ XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (workshop()->operationMgr()->currentOperation());
+ if (aFOperation && aFOperation->feature() == theFeature) {
+ QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
+ updateActionState(anOkAction, theFeature);
+ }
+ //update AcceptAll action
+ if (workshop()->isFeatureOfNested(theFeature)) {
+ QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ bool anEnabled = anError.isEmpty();
+ anAcceptAllAction->setEnabled(anEnabled);
+ anAcceptAllAction->setToolTip(anError);
+ }
+}
- QString anError = getFeatureError(theFeature);
+bool XGUI_ErrorMgr::canProcessClick(QAction* theAction, const FeaturePtr& theFeature)
+{
+ QString anError = myWorkshop->module()->getFeatureError(theFeature);
+ bool isActionEnabled = anError.isEmpty();
if (!isActionEnabled && !anError.isEmpty()) {
if (!myErrorDialog) {
myErrorDialog = new QDialog(QApplication::desktop(), Qt::Popup);
return isActionEnabled;
}
-void XGUI_ErrorMgr::updateActionState(QAction* theAction, const FeaturePtr& theFeature,
- const bool theEnabled)
+void XGUI_ErrorMgr::updateActionState(QAction* theAction, const FeaturePtr& theFeature/*,
+ const bool theEnabled*/)
{
+ QString anError = myWorkshop->module()->getFeatureError(theFeature);
+ bool anEnabled = anError.isEmpty();
+
bool isActionEnabled = theAction->data() != INVALID_VALUE;
- if (theEnabled != isActionEnabled) {
+ if (anEnabled != isActionEnabled) {
// update enable state of the button
- theAction->setIcon(theEnabled ? QIcon(":pictures/button_ok.png"): QIcon(":pictures/button_ok_error.png"));
- if (theEnabled)
+ theAction->setIcon(anEnabled ? QIcon(":pictures/button_ok.png"): QIcon(":pictures/button_ok_error.png"));
+ if (anEnabled)
theAction->setData("");
else
theAction->setData(INVALID_VALUE);
// update controls error information
QWidget* aWidget = myPropertyPanel->headerWidget();
if (aWidget)
- aWidget->setToolTip(getFeatureError(theFeature));
+ aWidget->setToolTip(anError);
}
}
-const char* toString(ModelAPI_ExecState theExecState)
+/*const char* toString(ModelAPI_ExecState theExecState)
{
#define TO_STRING(__NAME__) case __NAME__: return #__NAME__;
switch (theExecState) {
default: return "Unknown ExecState.";
}
#undef TO_STRING
-}
+}*/
/*void XGUI_ErrorMgr::onValidationStateChanged()
{
}
}*/
-QString XGUI_ErrorMgr::getFeatureError(const FeaturePtr& theFeature) const
+/*QString XGUI_ErrorMgr::getFeatureError(const FeaturePtr& theFeature) const
{
QString anError;
// get feature
}
return anError;
-}
+}*/
void XGUI_ErrorMgr::onWidgetChanged()
{
//aWidget->setStyleSheet(anError.isEmpty() ? "" : "background-color:pink;");
}
}
+
+XGUI_Workshop* XGUI_ErrorMgr::workshop() const
+{
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ return aConnector->workshop();
+}
#include <ModuleBase_IErrorMgr.h>
#include <ModelAPI_Feature.h>
+class XGUI_Workshop;
+class ModuleBase_IWorkshop;
class QAction;
class QDialog;
class QLabel;
{
Q_OBJECT
public:
- XGUI_ErrorMgr(QObject* theParent = 0);
+ XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop);
/// Virtual destructor
virtual ~XGUI_ErrorMgr();
- /// It updates the action state according to the given parameter
- /// \param theAction an action to be changed
- /// \param theFeature an feature that corresponds to the action
- /// \param theEnabled an enable state
- void updateActionState(QAction* theAction, const FeaturePtr& theFeature,
- const bool theEnabled);
+ void updateActions(const FeaturePtr& theFeature);
/// Return true if the feature has no error. If there is an error and the action
/// is not valid, the dialog with the error information is shown.
virtual void onWidgetChanged();
private:
+ /// It updates the action state according to the given parameter
+ /// \param theAction an action to be changed
+ /// \param theFeature an feature that corresponds to the action
+ void updateActionState(QAction* theAction, const FeaturePtr& theFeature);
+
/// Returns the feature error message
/// \param theFeature a feature
/// \return the error message
- QString getFeatureError(const FeaturePtr& theFeature) const;
+ //QString getFeatureError(const FeaturePtr& theFeature) const;
+
+ /// Returns casted workshop
+ XGUI_Workshop* workshop() const;
private:
+ ModuleBase_IWorkshop* myWorkshop;
QDialog* myErrorDialog; /// contains the error message
QLabel* myErrorLabel; /// contains an error information
};
// Author: Natalia ERMOLAEVA
#include "XGUI_OperationMgr.h"
+#include "XGUI_ModuleConnector.h"
+#include "XGUI_Workshop.h"
+#include "XGUI_ErrorMgr.h"
#include "ModuleBase_Operation.h"
#include "ModuleBase_IWorkshop.h"
{
if (!hasOperation())
return;
- ModuleBase_Operation* anOperation = currentOperation();
- if(anOperation) {
- bool aCanCommit = myWorkshop->module()->canCommitOperation();
- setApplyEnabled(!myIsValidationLock && aCanCommit && anOperation->isValid());
+ //ModuleBase_Operation* anOperation = currentOperation();
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (currentOperation());
+ if(aFOperation && aFOperation->feature().get()) {
+ //bool aCanCommit = myWorkshop->module()->canCommitOperation();
+ //setApplyEnabled(!myIsValidationLock && aCanCommit && anOperation->isValid());
+ setApplyEnabled(myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty());
}
}
void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled)
{
myIsApplyEnabled = theEnabled;
- emit validationStateChanged(theEnabled);
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (currentOperation());
+ if (aFOperation) {
+ workshop()->errorMgr()->updateActions(aFOperation->feature());
+ }
+ //emit validationStateChanged(theEnabled);
}
void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation)
{
- if (theOperation)
- emit nestedStateChanged(theOperation->getDescription()->operationId().toStdString(),
- theOperation->isValid());
+ XGUI_ErrorMgr* anErrorMgr = workshop()->errorMgr();
+ if (theOperation) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ if (aFOperation)
+ anErrorMgr->updateActions(aFOperation->feature());
+ //emit nestedStateChanged(theOperation->getDescription()->operationId().toStdString(),
+ // theOperation->isValid());
+ }
else {
foreach(ModuleBase_Operation* anOperation, myOperations) {
- emit nestedStateChanged(anOperation->getDescription()->operationId().toStdString(),
- anOperation->isValid());
+ if (anOperation)
+ updateApplyOfOperations(anOperation);
+ //emit nestedStateChanged(anOperation->getDescription()->operationId().toStdString(),
+ // anOperation->isValid());
}
}
}
void XGUI_OperationMgr::onOperationCommitted()
{
+ // apply state for all features from the stack of operations should be updated
updateApplyOfOperations();
ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
return isAccepted;
}
+XGUI_Workshop* XGUI_OperationMgr::workshop() const
+{
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ return aConnector->workshop();
+}
+
class QKeyEvent;
class ModuleBase_IWorkshop;
+class XGUI_Workshop;
/**\class XGUI_OperationMgr
* \ingroup GUI
void operationAborted(ModuleBase_Operation* theOperation);
/// Signal is emitted after the apply enable state changed.
- void validationStateChanged(bool);
+ //void validationStateChanged(bool);
/// Signal is emitted after the model is modified. It is emitted for all active operations.
/// \param theFeatureKind a feature id
/// \param theState validity of the operation with the feature kind
- void nestedStateChanged(const std::string& theFeatureKind, const bool theState);
+ //void nestedStateChanged(const std::string& theFeatureKind, const bool theState);
/// Signal is emitted after the current operation is filled with existing preselection.
void operationActivatedByPreselection();
/// Slot called on operation resume
void onOperationResumed();
+private:
+ XGUI_Workshop* workshop() const;
+
private:
typedef QList<ModuleBase_Operation*> Operations; ///< definition for a list of operations
Operations myOperations; ///< a stack of started operations. The active operation is on top,
//! Creates a feature (command) in SALOME desktop
//! \param theWBName - name of toolbar (workbench)
//! \param theInfo - information about action (icon, text, etc)
- virtual QAction* addNestedFeature(const QString& theWBName,
+ virtual QAction* addFeatureOfNested(const QString& theWBName,
const ActionInfo& theInfo,
const QList<QAction*>& theNestedActions) = 0;
//! Returns true if the feature action is a nested action, in other words,
- //! it is created by addNestedFeature().
+ //! it is created by addFeatureOfNested().
//! \param theId - an action of a feature
//! returns boolean result
- virtual bool isNestedFeature(const QAction* theAction) = 0;
+ virtual bool isFeatureOfNested(const QAction* theAction) = 0;
//! Creates a command in Edit menu of SALOME desktop
//! \param theId - an id of the feature
myOperationMgr = new XGUI_OperationMgr(this, 0);
myActionsMgr = new XGUI_ActionsMgr(this);
myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop());
- myErrorMgr = new XGUI_ErrorMgr(this);
myContextMenuMgr = new XGUI_ContextMenuMgr(this);
connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
SLOT(onContextMenuCommand(const QString&, bool)));
ModuleBase_IWorkshop* aWorkshop = moduleConnector();
myOperationMgr->setWorkshop(aWorkshop);
+ myErrorMgr = new XGUI_ErrorMgr(this, aWorkshop);
myEventsListener = new XGUI_WorkshopListener(aWorkshop);
connect(myOperationMgr, SIGNAL(operationStarted(ModuleBase_Operation*)),
}
//******************************************************
-void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
+/*void XGUI_Workshop::onValidationStateChanged(bool theEnabled)
{
XGUI_OperationMgr* anOperationMgr = operationMgr();
if (anOperationMgr) {
myErrorMgr->updateActionState(anAction, aFOperation->feature(), theEnabled);
}
}
-}
+}*/
//******************************************************
}
}
+//******************************************************
+bool XGUI_Workshop::isFeatureOfNested(const FeaturePtr& theFeature)
+{
+ bool aHasNested = false;
+ std::string aFeatureKind = theFeature->getKind();
+ if (isSalomeMode()) {
+ XGUI_SalomeConnector* aSalomeConnector = salomeConnector();
+ if (aSalomeConnector->isFeatureOfNested(actionsMgr()->action(aFeatureKind.c_str())))
+ aHasNested = true;
+ } else {
+ AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
+ AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str());
+ if (aCommand && aCommand->button()->additionalButtonWidget())
+ aHasNested = true;
+ }
+ return aHasNested;
+}
+
//******************************************************
void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
{
connect(myPropertyPanel, SIGNAL(noMoreWidgets()), myModule, SLOT(onNoMoreWidgets()));
connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QKeyEvent*)));
- connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
- this, SLOT(onValidationStateChanged(bool)));
+ //connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
+ // this, SLOT(onValidationStateChanged(bool)));
}
//******************************************************
/// \param theUpdateViewer a boolean flag to update viewer immediately
void deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer);
+ /// Returns true if the action of the feature is created to contain Accept/Cancel button
+ /// \param theFeature a feature
+ bool isFeatureOfNested(const FeaturePtr& theFeature);
+
signals:
/// Emitted when selection happens in Salome viewer
void salomeViewerSelection();
/// Listens the corresponded signal from operation manager and send it with the Ok
/// action to operation manager.
/// \param theEnabled an enabled state for the action
- void onValidationStateChanged(bool theEnabled);
+ //void onValidationStateChanged(bool theEnabled);
//connect(myOperationMgr, SIGNAL(validationStateChanged(bool)),
// aOkAct, SLOT(setEnabled(bool)));
myUpdatePrefs(false)
{
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
- connect(anOperationMgr, SIGNAL(nestedStateChanged(const std::string&, const bool)),
- this, SLOT(onNestedStateChanged(const std::string&, const bool)));
+ //connect(anOperationMgr, SIGNAL(nestedStateChanged(const std::string&, const bool)),
+ // this, SLOT(onNestedStateChanged(const std::string&, const bool)));
}
//******************************************************
aLoop->registerListener(this, Events_LongOp::eventID());
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_ERROR_CHANGED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED));
XGUI_Displayer* aDisplayer = workshop()->displayer();
aDisplayer->enableUpdateViewer(true);
aDisplayer->updateViewer();
+ } else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_ERROR_CHANGED)) {
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::set<ObjectPtr> aObjects = aUpdMsg->objects();
+ std::set<ObjectPtr>::const_iterator aIt;
+ for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+ workshop()->errorMgr()->updateActions(ModelAPI_Feature::feature(*aIt));
+ }
} else {
//Show error dialog if error message received.
std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);
}
}
}
- anOperationMgr->onValidateOperation();
+ //anOperationMgr->onValidateOperation();
//if (myObjectBrowser)
// myObjectBrowser->processEvent(theMsg);
//}
}
-void XGUI_WorkshopListener::onNestedStateChanged(const std::string& theFeatureId, const bool theState)
+/*void XGUI_WorkshopListener::onNestedStateChanged(const std::string& theFeatureId, const bool theState)
{
XGUI_Workshop* aWorkshop = workshop();
//one button is used for all features, which can have nested actions, so it is obtained from
// the action manager
- QAction* anAcceptAllAction = aWorkshop->actionsMgr()->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
- bool aActionToBeUpdated = false;
+ //bool aActionToBeUpdated = aWorkshop->isFeatureOfNested(theFeatureId);
if (aWorkshop->isSalomeMode()) {
XGUI_SalomeConnector* aSalomeConnector = aWorkshop->salomeConnector();
XGUI_ActionsMgr* anActionsMgr = aWorkshop->actionsMgr();
- if (aSalomeConnector->isNestedFeature(anActionsMgr->action(theFeatureId.c_str())))
+ if (aSalomeConnector->isFeatureOfNested(anActionsMgr->action(theFeatureId.c_str())))
aActionToBeUpdated = true;
} else {
AppElements_MainMenu* aMenuBar = aWorkshop->mainWindow()->menuObject();
aActionToBeUpdated = true;
}
if (aActionToBeUpdated) {
+ QAction* anAcceptAllAction = aWorkshop->actionsMgr()->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
anAcceptAllAction->setEnabled(theState);
}
-}
+}*/
bool XGUI_WorkshopListener::event(QEvent * theEvent)
{
XGUI_SalomeConnector* aSalomeConnector = aWorkshop->salomeConnector();
QAction* aAction;
if (isColumnButton) {
- aAction = aSalomeConnector->addNestedFeature(aWchName, aFeatureInfo, aNestedActList);
+ aAction = aSalomeConnector->addFeatureOfNested(aWchName, aFeatureInfo, aNestedActList);
} else {
//Issue #650: in the SALOME mode the tooltip should be same as text
aFeatureInfo.toolTip = aFeatureInfo.text;
/// Updates Apply All button state of the feature to the state if the feature has the button
/// \param theFeatureId an index of the feature, the action is searched, which state is to be changed
/// \param theState an action enable state
- void onNestedStateChanged(const std::string& theFeatureId, const bool theState);
+ //void onNestedStateChanged(const std::string& theFeatureId, const bool theState);
protected:
/// Procedure to process postponed events