X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2Fpadder%2Fspadderpy%2Fgui%2Finputdialog.py;h=47abc561aaac76ccbefaf9b7db673883ac61b316;hb=0003e6b4fcc95a0aec695ceef8371dee28baf417;hp=376a90039291f4cfd258687f099285b9b8a7c4db;hpb=a17b36970bc61da1d664453c615754997c925b18;p=modules%2Fsmesh.git diff --git a/src/Tools/padder/spadderpy/gui/inputdialog.py b/src/Tools/padder/spadderpy/gui/inputdialog.py index 376a90039..47abc561a 100644 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@ -33,7 +33,7 @@ from omniORB import CORBA from qtsalome import QIcon, QStandardItemModel, QStandardItem, QMessageBox, pyqtSignal from inputframe_ui import Ui_InputFrame -from inputdata import InputData +from .inputdata import InputData DEBUG_MODE=True GROUPNAME_MAXLENGTH=8 @@ -41,7 +41,7 @@ GROUPNAME_MAXLENGTH=8 class InputDialog(GenericDialog): TBL_HEADER_LABEL=["Input Mesh", "Output group name"] - + inputValidated = pyqtSignal() def __init__(self, parent=None, name="InputDialog", modal=0): @@ -97,7 +97,7 @@ class InputDialog(GenericDialog): icon.addFile(os.path.join(iconfolder,"steelbar.png")) self.__ui.cmbMeshType.setItemIcon(meshTypeIndex, icon) self.MESHTYPE_ICONS[meshTypeIndex] = icon - + # The click on btnSmeshObject (signal clicked() emitted by the # button btnSmeshObject) is connected to the slot # onSelectSmeshObject, etc ... @@ -113,7 +113,10 @@ class InputDialog(GenericDialog): self.__ui.tblListInput.horizontalHeader().setStretchLastSection(True) # Note that the type is not display explicitly in the Qt table # because it is specified using an icon on the text of the - # name item. + # name item. + + # Setup default values for numerical parameters + self.__ui.txtParamNbIter.setValue(3) # Note that PADDER does not support group name longer than 8 # characters. We apply then this limit in the gui field. @@ -228,9 +231,9 @@ class InputDialog(GenericDialog): """ # if the entry already exists, we remove it to replace by a # new one - if self.__dictInputData.has_key(meshName): + if meshName in self.__dictInputData: self.__delInputFromMap(meshName) - + inputData = InputData() inputData.meshName = meshName inputData.meshObject = meshObject @@ -243,11 +246,11 @@ class InputDialog(GenericDialog): else: self.__nbSteelbarMesh += 1 - print inputData - print "meshType = ",inputData.meshType - print "nb concrete mesh ",self.__nbConcreteMesh - print "nb steelbar mesh ",self.__nbSteelbarMesh - + print(inputData) + print("meshType = ",inputData.meshType) + print("nb concrete mesh ",self.__nbConcreteMesh) + print("nb steelbar mesh ",self.__nbSteelbarMesh) + def onDeleteInput(self): """ @@ -267,7 +270,7 @@ class InputDialog(GenericDialog): def __delInputFromMap(self, meshName): """ This function removes the specified entry from the internal - map (for data management purpose) + map (for data management purpose) """ inputData = self.__dictInputData.pop(meshName) if inputData.meshType == InputData.MESHTYPES.CONCRETE: @@ -275,9 +278,9 @@ class InputDialog(GenericDialog): else: self.__nbSteelbarMesh -= 1 - print inputData - print "nb concrete mesh ",self.__nbConcreteMesh - print "nb steelbar mesh ",self.__nbSteelbarMesh + print(inputData) + print("nb concrete mesh ",self.__nbConcreteMesh) + print("nb steelbar mesh ",self.__nbSteelbarMesh) def setData(self, listInputData=[]): @@ -292,7 +295,7 @@ class InputDialog(GenericDialog): meshObject = inputData.meshObject meshType = inputData.meshType groupName = inputData.groupName - + self.__addInputInGui(meshName, meshObject, meshType, groupName) self.__addInputInMap(meshName, meshObject, meshType, groupName) @@ -306,8 +309,8 @@ class InputDialog(GenericDialog): """ # Note that the values() function returns a copy of the list # of values. - return self.__dictInputData.values() - + return list(self.__dictInputData.values()) + def checkData(self): """ This function checks if the data are valid, from the dialog @@ -315,7 +318,7 @@ class InputDialog(GenericDialog): """ if self.__nbConcreteMesh == 0 and self.__nbSteelbarMesh == 0: self.checkDataMessage = "You must define at least one mesh (CONCRETE or STEELBAR)" - return False + return False if self.__nbConcreteMesh > 1: self.checkDataMessage = "You define multiple CONCRETE meshes." self.checkDataMessage += "You should verify first that your version of PADDER support this configuration." @@ -325,6 +328,7 @@ class InputDialog(GenericDialog): return True + #def setParameters(self, # ============================================================================== # Basic use case @@ -339,7 +343,7 @@ def TEST_InputDialog(): dlg=InputDialog() dlg.displayAndWait() if dlg.wasOk(): - print "OK has been pressed" + print("OK has been pressed") def TEST_InputDialog_setData(): import sys @@ -349,7 +353,7 @@ def TEST_InputDialog_setData(): dlg=InputDialog() - from inputdata import InputData + from .inputdata import InputData inputData = InputData() inputData.meshName = "myMesh" inputData.meshObject = None @@ -357,14 +361,14 @@ def TEST_InputDialog_setData(): inputData.groupName = "myGroup" listInputData = [] listInputData.append(inputData) - + dlg.setData2(listInputData) - + dlg.displayAndWait() if dlg.wasOk(): - print "OK has been pressed" + print("OK has been pressed") outputListInputData = dlg.getData2() - print outputListInputData + print(outputListInputData) if __name__ == "__main__":