]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Mon, 23 Jun 2014 15:25:17 +0000 (19:25 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 23 Jun 2014 15:25:17 +0000 (19:25 +0400)
Undoes the modification of the isEdit state of operation using. The default value of the feature is set after the operation is started

src/ModuleBase/ModuleBase_IOperation.cpp
src/ModuleBase/ModuleBase_IOperation.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_OperationDescription.cpp
src/ModuleBase/ModuleBase_OperationDescription.h
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_Workshop.cpp

index 30af6ccc1ea61c1f5bcf0b0cbefdf095872dab9a..bcc697dcb048ab34fac3bb08b823eff1b45696ec 100644 (file)
@@ -42,7 +42,7 @@ bool ModuleBase_IOperation::isGranted(ModuleBase_IOperation* /*theOperation*/) c
   return false;
 }
 
-void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentation,
+/*void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentation,
                                             QList<ModuleBase_ModelWidget*> theWidgets)
 {
   QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
@@ -50,7 +50,7 @@ void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentat
     QObject::connect(*anIt, SIGNAL(valuesChanged()),  this, SLOT(storeCustomValue()));
   }
   getDescription()->setModelWidgets(theXmlRepresentation, theWidgets);
-}
+}*/
 
 boost::shared_ptr<ModelAPI_Document> ModuleBase_IOperation::document() const
 {
index 5c753c728067ff1a0978a2405291262957a908d3..77e01083c30ebab40f8cec01fac58e127cd3fc8e 100644 (file)
@@ -19,7 +19,7 @@
 
 class ModelAPI_Document;
 class ModuleBase_OperationDescription;
-class ModuleBase_ModelWidget;
+//class ModuleBase_ModelWidget;
 
 /*!
  \class ModuleBase_IOperation
@@ -73,8 +73,8 @@ public:
   /// Sets a list of model widgets, according to the operation feature xml definition
   /// \param theXmlRepresentation an xml feature definition
   /// \param theWidgets a list of widgets
-  void setModelWidgets(const std::string& theXmlRepresentation,
-                       QList<ModuleBase_ModelWidget*> theWidgets);
+  //void setModelWidgets(const std::string& theXmlRepresentation,
+  //                     QList<ModuleBase_ModelWidget*> theWidgets);
 
 signals:
   void started(); /// the operation is started
index 223bf59e266815888905f0783e28dc2794c41b39..4b7e3c78ccb1285010f50f907e8dc8ec1127f8ff 100644 (file)
@@ -104,11 +104,11 @@ FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
   if (aFeature) { // TODO: generate an error if feature was not created
     aFeature->execute();
     // Init default values
-    QList<ModuleBase_ModelWidget*> aWidgets = getDescription()->modelWidgets();
+    /*QList<ModuleBase_ModelWidget*> aWidgets = getDescription()->modelWidgets();
     QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
     for (; anIt != aLast; anIt++) {
       (*anIt)->storeValue(aFeature);
-    }
+    }*/
   }
 
   if (theFlushMessage)
index a97d11816255062a457e60fcce1b6a5084d75d7f..ffffe6922f00a1db053f1977304e176cdd7fec70 100644 (file)
@@ -32,7 +32,7 @@ void ModuleBase_OperationDescription::setDescription(const QString& theDescripti
   myDescription = theDescription;
 }
 
-void ModuleBase_OperationDescription::setModelWidgets(const std::string& theXmlRepresentation,
+/*void ModuleBase_OperationDescription::setModelWidgets(const std::string& theXmlRepresentation,
                                                       const QList<ModuleBase_ModelWidget*>& theWidgets)
 {
   myWidgets.clear();
@@ -40,14 +40,24 @@ void ModuleBase_OperationDescription::setModelWidgets(const std::string& theXmlR
   for (; anIt != aLast; anIt++)
     myWidgets.push_back(*anIt);
   myXmlRepresentation = theXmlRepresentation;
-}
+}*/
 
-const QList<ModuleBase_ModelWidget*>& ModuleBase_OperationDescription::modelWidgets() const
+/*const QList<ModuleBase_ModelWidget*>& ModuleBase_OperationDescription::modelWidgets() const
 {
   return myWidgets;
+}*/
+
+const QString& ModuleBase_OperationDescription::xmlRepresentation() const
+{
+  return myXmlRepresentation;
+}
+
+void ModuleBase_OperationDescription::setXmlRepresentation(const QString& theXMLRepresentation)
+{
+  myXmlRepresentation = theXMLRepresentation;
 }
 
 bool ModuleBase_OperationDescription::hasXmlRepresentation() const
 {
-  return !myWidgets.empty() || !myXmlRepresentation.empty();
+  return /*!myWidgets.empty() || */!myXmlRepresentation.isEmpty();
 }
index 11b4abc10ea04da657d78db2a62db5bc5592a280..79a7301109a410d96fe4b4833591e3091bcc0584 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <memory>
 
-class ModuleBase_ModelWidget;
+//class ModuleBase_ModelWidget;
 
 /*!
  * \class ModuleBase_OperationDescription
@@ -50,12 +50,20 @@ public:
 
   /// Sets a list of model widgets, according to the operation feature xml definition
   /// \param theWidgets a list of widgets
-  void setModelWidgets(const std::string& theXmlRepresentation,
-                       const QList<ModuleBase_ModelWidget*>& theWidgets);
+  //void setModelWidgets(const std::string& theXmlRepresentation,
+  //                     const QList<ModuleBase_ModelWidget*>& theWidgets);
 
   /// Sets a list of model widgets, according to the operation feature xml definition
   /// \param theWidgets a list of widgets
-  const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
+  //const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
+
+   /// Returns XML representation of the operation's widget.
+   /// \return XML QString
+  const QString& xmlRepresentation() const;
+
+  /// Sets XML representation of the operation's widget.
+  /// \param theXMLRepresentation - XML QString
+  void setXmlRepresentation(const QString& theXMLRepresentation);
 
   /// Returns true if there are no model widgets
   /// \return the boolean value
@@ -65,8 +73,8 @@ private:
   //!< Next fields could be extracted into a subclass;
   QString myOperationId; /// the operation identifier
   QString myDescription; /// the short description of the opertaion
-  std::string myXmlRepresentation; /// the xml definition
-  QList<ModuleBase_ModelWidget*> myWidgets; /// the list of operation widgets
+  QString myXmlRepresentation; /// the xml definition
+  //QList<ModuleBase_ModelWidget*> myWidgets; /// the list of operation widgets
 };
 
 #endif //ModuleBase_OperationDescription_H
index 30be9bac2624eb525150753b32132c3845c611d1..ab790298fc07287dc497e4b0cfb7f01a319c72f5 100644 (file)
@@ -364,16 +364,17 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   std::string aXmlCfg = aWdgReader.featureWidgetCfg(aFeatureKind);
   std::string aDescription = aWdgReader.featureDescription(aFeatureKind);
 
-  QString aXmlRepr = QString::fromStdString(aXmlCfg);
-  ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
-                                                               myWorkshop->moduleConnector());
-  QWidget* aContent = myWorkshop->propertyPanel()->contentWidget();
-  qDeleteAll(aContent->children());
-  aFactory.createWidget(aContent);
+  //QString aXmlRepr = QString::fromStdString(aXmlCfg);
+  //ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
+  //                                                             myWorkshop->moduleConnector());
+  //QWidget* aContent = myWorkshop->propertyPanel()->contentWidget();
+  //qDeleteAll(aContent->children());
+  //aFactory.createWidget(aContent);
 
   anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
+  anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
 
-  anOperation->setModelWidgets(aXmlRepr.toStdString(), aFactory.getModelWidgets());
+  //anOperation->setModelWidgets(aXmlRepr.toStdString(), aFactory.getModelWidgets());
 
   // connect the operation
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
index affbac1a123ca886387a6dc4ffebcf035fc63bda..00446f23b3a6b27ecd8f8ddc700de89199ae0432 100644 (file)
@@ -281,8 +281,7 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
   //An operation passed by message. Start it, process and commit.
   const Config_PointerMessage* aPartSetMsg = dynamic_cast<const Config_PointerMessage*>(theMessage);
   if (aPartSetMsg) {
-    // TODO: Clear previous content
-    //myPropertyPanel->cleanContent();
+    myPropertyPanel->cleanContent();
     ModuleBase_Operation* anOperation =
         (ModuleBase_Operation*)(aPartSetMsg->pointer());
 
@@ -312,16 +311,25 @@ void XGUI_Workshop::onOperationStarted()
     connectWithOperation(aOperation);
 
     showPropertyPanel();
-    // TODO: Clear previous content
-    /*
     QString aXmlRepr = aOperation->getDescription()->xmlRepresentation();
     ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(), myModuleConnector);
     QWidget* aContent = myPropertyPanel->contentWidget();
     qDeleteAll(aContent->children());
     aFactory.createWidget(aContent);
-    myPropertyPanel->setModelWidgets(aFactory.getModelWidgets());
-    */
-    myPropertyPanel->setModelWidgets(aOperation->getDescription()->modelWidgets());
+    
+    QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
+    QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
+    ModuleBase_ModelWidget* aWidget;
+    for (; anIt != aLast; anIt++) {
+      aWidget = *anIt;
+      QObject::connect(aWidget, SIGNAL(valuesChanged()),  aOperation, SLOT(storeCustomValue()));
+      // Init default values
+      if (!aOperation->isEditOperation()) {
+        aWidget->storeValue(aOperation->feature());
+      }
+    }
+
+    myPropertyPanel->setModelWidgets(aWidgets);
     myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
   }
   updateCommandStatus();