From: Renaud Nédélec Date: Fri, 20 Jun 2014 11:32:55 +0000 (+0200) Subject: small modifications for cancel action to work correctly X-Git-Tag: V7_8_0a1~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e53c3df090686392c3b5f43af6d012762c13ecfa;p=modules%2Fgeom.git small modifications for cancel action to work correctly --- diff --git a/src/Tools/salome_plugins.py b/src/Tools/salome_plugins.py index ba7e9753e..d75b4a7b1 100644 --- a/src/Tools/salome_plugins.py +++ b/src/Tools/salome_plugins.py @@ -25,6 +25,7 @@ def t_shape_fluid(context): import t_shape_builder import t_shape_dialog import xalome + from PyQt4.QtGui import QMessageBox activeStudy = context.study dialog = t_shape_dialog.TShapeDialog() @@ -33,10 +34,12 @@ def t_shape_fluid(context): # closed using the Ok button, then the data are requested from the # gui and used to create the shape of the tube. dialog.exec_() - r1, r2, h1, h2 = dialog.getData() - shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2) - entry = xalome.addToStudy(activeStudy, shape, "T_shape_fluid" ) - xalome.displayShape(entry) + if dialog.wasOk(): + r1, r2, h1, h2 = dialog.getData() + QMessageBox.about(None, "Building in progress", "building shape, please be patient") + shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2) + entry = xalome.addToStudy(activeStudy, shape, "T_shape_fluid" ) + xalome.displayShape(entry) #if dialog.wasOk(): #radius, length, width = dialog.getData() #shape = tubebuilder.createGeometry(activeStudy, radius, length, width) diff --git a/src/Tools/t_shape_dialog.py b/src/Tools/t_shape_dialog.py index cfffe27af..6ac37c51f 100644 --- a/src/Tools/t_shape_dialog.py +++ b/src/Tools/t_shape_dialog.py @@ -33,6 +33,7 @@ class TShapeDialog(QtGui.QDialog): self.ui = Ui_Dialog() self.ui.setupUi(self) self.show() + self._wasOk = False def accept(self): print "DATA ACCEPTED" @@ -66,13 +67,12 @@ class TShapeDialog(QtGui.QDialog): ## We should test here the validity of values #QtGui.QDialog.accept(self) - #def reject(self): - #'''Callback function when dialog is rejected (click Cancel)''' - #self._wasOk = False - #QtGui.QDialog.reject(self) + def reject(self): + self._wasOk = False + QtGui.QDialog.reject(self) - #def wasOk(self): - #return self._wasOk + def wasOk(self): + return self._wasOk #def setData(self): #pass