Salome HOME
PyQt5 porting
[samples/genericsolver.git] / src / GENERICSOLVERGUI / GENERICSOLVERGUI.py
index 2edae0025398a2bfaed9a413a8a879fa8df3369e..f4e011cea26d18434563c04eb29f595a1f16e553 100644 (file)
@@ -24,7 +24,7 @@ import traceback
 import os
 import logging
 
-from PyQt4 import QtCore, QtGui
+from PyQt5 import QtCore, QtGui, QtWidgets
 
 import salome
 import SALOME
@@ -316,7 +316,7 @@ def viewClosed( viewID ):
 def CreateCase():
     logger.debug("GENERICSOLVERGUI.CreateCase : enter")
     default_case_name = str( sgPyQt.stringSetting( "GENERICSOLVER", "def_case_name",
-                                                   GUIcontext.DEFAULT_CASE_NAME ).trimmed() )
+                                                   GUIcontext.DEFAULT_CASE_NAME ).strip() )
     global __id__
     try:
         if sgPyQt.action( GUIcontext.OPTION_3_ID ).isChecked():
@@ -324,10 +324,10 @@ def CreateCase():
             name, ok = QtGui.QInputDialog.getText(sgPyQt.getDesktop(),
                                                   "Create case",
                                                   "Enter case name:",
-                                                  QtGui.QLineEdit.Normal,
+                                                  QtWidgets.QLineEdit.Normal,
                                                   default_case_name )
             if not ok: return
-            name = str( name.trimmed() )
+            name = str( name.strip() )
         elif sgPyQt.action( GUIcontext.OPTION_2_ID ).isChecked():
             # generate object name
             __id__  = __id__ + 1
@@ -356,7 +356,7 @@ def CreateCase():
         ed.setAttributeValue(varL, "AttributeReal", 1.5)
         varI = ed.createItem(case, "I", typeId = GUIcontext.VARIABLE_ID)
         ed.setAttributeValue(varI, "AttributeReal", 2.e-6)
-        
+
         inputVarList = [study_exchange_vars.Variable("E"),
                         study_exchange_vars.Variable("F"),
                         study_exchange_vars.Variable("L"),
@@ -397,7 +397,7 @@ def RunSOLVER():
         error = exc.details.text
 
     solver_engine.Finalize()
-    
+
     if error is not None:
         QtGui.QMessageBox.critical(sgPyQt.getDesktop(), "Error", error)
     elif param_output.returnCode != 0:
@@ -436,12 +436,12 @@ def SetValue():
     sobj = ed.study.FindObjectID(entry)
     assert sobj
     oldvalue = ed.getAttributeValue(sobj, "AttributeReal", 0.0)
-    name, ok = QtGui.QInputDialog.getText(sgPyQt.getDesktop(),
+    name, ok = QtWidgets.QInputDialog.getText(sgPyQt.getDesktop(),
                                           "Set a value",
                                           "Enter new value:",
-                                          QtGui.QLineEdit.Normal,
+                                          QtWidgets.QLineEdit.Normal,
                                           str(oldvalue) )
-    value = float( name.trimmed() )
+    value = float( name.strip() )
     if not ok or not value: return
     ed.setAttributeValue(sobj, "AttributeReal", value)
     salome.sg.updateObjBrowser(0)