]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
[MEDCalc] Parameter widget dynamically updating when scripting.
authorabn <adrien.bruneton@cea.fr>
Wed, 3 Aug 2016 15:19:03 +0000 (17:19 +0200)
committerabn <adrien.bruneton@cea.fr>
Wed, 3 Aug 2016 15:19:03 +0000 (17:19 +0200)
idl/MEDEventListener.idl
src/MEDCalc/gui/PresentationController.cxx
src/MEDCalc/gui/WorkspaceController.cxx
src/MEDCalc/gui/dialogs/WidgetPresentationParameters.ui
src/MEDCalc/tui/medevents.py
src/MEDCalc/tui/medpresentation.py

index 60c6b11e7d3a17ba909456d4672e6c6f9da21310..d53d6b1f3dbe4066ace61622b6979752ce542a98 100644 (file)
@@ -35,6 +35,7 @@ module MEDCALC
     EVENT_ADD_DATASOURCE,
     EVENT_ADD_PRESENTATION,
     EVENT_REMOVE_PRESENTATION,
+    EVENT_MODIFY_PRESENTATION,
     EVENT_PLAY_TEST,
     EVENT_QUIT_SALOME,
     EVENT_ERROR,
index 359ed79ce77031aeb7e88d5cbee090e02d23a7d9..44acb921eac52bbd25acfe734980da0917f80103 100644 (file)
@@ -749,6 +749,11 @@ PresentationController::processWorkspaceEvent(const MEDCALC::MedEvent* event)
   else if ( event->type == MEDCALC::EVENT_REMOVE_PRESENTATION ) {
       updateTreeViewForPresentationRemoval(event->presentationId);
   }
+  else if ( event->type == MEDCALC::EVENT_MODIFY_PRESENTATION ) {
+      // Update parameter widget if shown:
+      if(_currentWidgetHelper)
+        _currentWidgetHelper->udpateWidget();
+  }
 }
 
 void
index f135d38fcf99ef9e1509e0f8d856731e384275fa..dd59a244776e709b9d1a9052e1951f3ac087960f 100644 (file)
@@ -314,6 +314,9 @@ void WorkspaceController::processMedEvent(const MEDCALC::MedEvent* event) {
   else if ( event->type == MEDCALC::EVENT_REMOVE_PRESENTATION ) {
     emit workspaceSignal(event); // forward to PresentationController
   }
+  else if ( event->type == MEDCALC::EVENT_MODIFY_PRESENTATION ) {
+      emit workspaceSignal(event); // forward to PresentationController
+  }
   else if ( event->type == MEDCALC::EVENT_PLAY_TEST ) {
     emit workspaceSignal(event); // forward to TestController
   }
@@ -323,7 +326,9 @@ void WorkspaceController::processMedEvent(const MEDCALC::MedEvent* event) {
   else if ( event->type == MEDCALC::EVENT_ERROR ) {
       std::string msg(event->msg);
       QMessageBox::warning(_salomeModule->getApp()->desktop(), "Error", QString::fromStdString(msg));
-    }
+  }
+  else
+    STDLOG("WorkspaceController::processMedEvent(): Unhandled event!!!");
 }
 
 /*!
index d1c47f0c2bfcfb6367ac184fc5109bf226d0406d..c5557a3da4d6f22b4be862c8954f0c1f1f22828b 100644 (file)
        </widget>
       </item>
       <item row="2" column="1">
-       <widget class="QSpinBox" name="spinBox"/>
+       <widget class="QSpinBox" name="spinBox">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>30</number>
+        </property>
+       </widget>
       </item>
       <item row="2" column="2">
        <spacer name="horizontalSpacer">
index 42a3f55c166da4e93675fb88c1993e2c86b8d312..2e17a37100f72789bad4db8f17573d8b4490aa74 100644 (file)
@@ -126,3 +126,6 @@ def notifyGui_termination():
   
 def notifyGui_error(msg):
   __notifyGui(MEDCALC.EVENT_ERROR, msg=msg)
+  
+def notifyGui_modifyPresentation(presId):
+  __notifyGui(MEDCALC.EVENT_MODIFY_PRESENTATION, presentationId=presId)
index 40cad1ece84c9a55666e9f646b1c24e239430c07..b85d3d442cfe913b66127103d1443e0ae57dfc04 100644 (file)
@@ -19,7 +19,7 @@
 
 import medcalc
 import MEDCALC, SALOME
-from medcalc.medevents import notifyGui_addPresentation, notifyGui_removePresentation, notifyGui_error
+from medcalc.medevents import notifyGui_addPresentation, notifyGui_removePresentation, notifyGui_error, notifyGui_modifyPresentation
 
 __manager = medcalc.medcorba.factory.getPresentationManager()
 
@@ -156,6 +156,7 @@ GetVectorFieldParameters = lambda pres_id: __GetGENERICParameters("VectorField",
 
 def __UpdateGENERIC(tag, presentation_id, params):
   exec "__manager.update%s(presentation_id, params)" % tag
+  notifyGui_modifyPresentation(presentation_id)
 
 UpdateMeshView = lambda pres_id, params: __UpdateGENERIC("MeshView", pres_id, params)
 UpdateScalarMap = lambda pres_id, params: __UpdateGENERIC("ScalarMap", pres_id, params)