From 2563db4174f9b0e4cadd05b27e3b219a7a3d85b6 Mon Sep 17 00:00:00 2001 From: uhz Date: Wed, 8 Feb 2017 15:08:35 +0100 Subject: [PATCH] PyQt5 porting --- src/GENERICSOLVERGUI/GENERICSOLVERGUI.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/GENERICSOLVERGUI/GENERICSOLVERGUI.py b/src/GENERICSOLVERGUI/GENERICSOLVERGUI.py index 2edae00..f4e011c 100644 --- a/src/GENERICSOLVERGUI/GENERICSOLVERGUI.py +++ b/src/GENERICSOLVERGUI/GENERICSOLVERGUI.py @@ -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) -- 2.39.2