From 5a07078335c27182bbf113fbce3d69e08bd5203f Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 27 Jan 2016 19:00:36 +0300 Subject: [PATCH] PyQt4/PyQt5 support. --- src/Tools/geom_plugins.py | 2 +- src/Tools/t_shape/t_shape_dialog.py | 13 ++++++------- src/Tools/t_shape/t_shape_progress.py | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Tools/geom_plugins.py b/src/Tools/geom_plugins.py index 395961595..d9f72d4ab 100644 --- a/src/Tools/geom_plugins.py +++ b/src/Tools/geom_plugins.py @@ -26,7 +26,7 @@ def t_shape_fluid(context): from salome.geom.t_shape import t_shape_dialog from salome.geom.t_shape import t_shape_progress import xalome - from PyQt4.QtGui import QMessageBox + from qtsalome import QMessageBox activeStudy = context.study dialog = t_shape_dialog.TShapeDialog() diff --git a/src/Tools/t_shape/t_shape_dialog.py b/src/Tools/t_shape/t_shape_dialog.py index c385efd0c..7ee76c238 100644 --- a/src/Tools/t_shape/t_shape_dialog.py +++ b/src/Tools/t_shape/t_shape_dialog.py @@ -20,15 +20,14 @@ # Author : Renaud Nédélec (OpenCascade S.A.S) import sys -from PyQt4 import QtGui -from PyQt4 import QtCore +from qtsalome import * from t_shape_dialog_ui import Ui_Dialog -class TShapeDialog(QtGui.QDialog): +class TShapeDialog(QDialog): def __init__(self): - QtGui.QDialog.__init__(self, None, QtCore.Qt.Tool) + QDialog.__init__(self, None, Qt.Tool) # Set up the user interface from Designer. self.ui = Ui_Dialog() self.ui.setupUi(self) @@ -43,7 +42,7 @@ class TShapeDialog(QtGui.QDialog): def accept(self): self._wasOk = True - QtGui.QDialog.accept(self) + QDialog.accept(self) def getData(self): r1 = self.ui.dsb_bigRadius.value() @@ -58,7 +57,7 @@ class TShapeDialog(QtGui.QDialog): def reject(self): self._wasOk = False - QtGui.QDialog.reject(self) + QDialog.reject(self) def wasOk(self): return self._wasOk @@ -70,7 +69,7 @@ class TShapeDialog(QtGui.QDialog): def main( args ): import sys - app = QtGui.QApplication(sys.argv) + app = QApplication(sys.argv) Dialog = TShapeDialog() ui = Ui_Dialog() ui.setupUi(Dialog) diff --git a/src/Tools/t_shape/t_shape_progress.py b/src/Tools/t_shape/t_shape_progress.py index 38f804502..96415d1ac 100644 --- a/src/Tools/t_shape/t_shape_progress.py +++ b/src/Tools/t_shape/t_shape_progress.py @@ -20,15 +20,14 @@ # Author : Renaud Nédélec (OpenCascade S.A.S) from salome.geom.t_shape import t_shape_builder -from PyQt4.QtGui import QProgressDialog -from PyQt4 import QtCore +from qtsalome import * class t_shape_progress(QProgressDialog): _totSteps = 0 _nmaxSteps = 27 def __init__(self, parent=None): - QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, QtCore.Qt.Tool) + QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, Qt.Tool) self.show() def run(self, activeStudy, r1, r2, h1, h2, thickness): -- 2.30.2