X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSalomeApp%2Fpluginsdemo%2Ftubedialog.py;h=3716205b1f186ef76e357e40dedcbff273795f66;hb=7c477e37f63b76012fb8695cd0563b4a086b54ae;hp=ddd3fcff7564c94e174e1f95f9bb5a098a49b371;hpb=6878ef4d7381638ec39d1ca9d03afc21a69401aa;p=modules%2Fgui.git diff --git a/src/SalomeApp/pluginsdemo/tubedialog.py b/src/SalomeApp/pluginsdemo/tubedialog.py index ddd3fcff7..3716205b1 100644 --- a/src/SalomeApp/pluginsdemo/tubedialog.py +++ b/src/SalomeApp/pluginsdemo/tubedialog.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010-2014 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,8 +19,7 @@ # Author : Guillaume Boulant (EDF) import sys -from PyQt4 import QtGui -from PyQt4 import QtCore +from qtsalome import * from tubedialog_ui import TubeDialog_UI @@ -33,27 +32,27 @@ class TubeDialog(TubeDialog_UI): def handleAcceptWith(self,callbackFunction): """This defines the function to be connected to the signal 'accepted()' (click on Ok)""" - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), callbackFunction) + self.buttonBox.accepted.connect(callbackFunction) def handleRejectWith(self,callbackFunction): """This defines the function to be connected to the signal 'rejected()' (click on Cancel)""" - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), callbackFunction) + self.buttonBox.rejected.connect(callbackFunction) def handleApplyWith(self,callbackFunction): """This defines the function to be connected to the signal 'apply()' (click on Apply)""" - button = self.buttonBox.button(QtGui.QDialogButtonBox.Apply) - QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), callbackFunction); + button = self.buttonBox.button(QDialogButtonBox.Apply) + button.clicked.connect(callbackFunction); def accept(self): '''Callback function when dialog is accepted (click Ok)''' self._wasOk = True # We should test here the validity of values - QtGui.QDialog.accept(self) + QDialog.accept(self) def reject(self): '''Callback function when dialog is rejected (click Cancel)''' self._wasOk = False - QtGui.QDialog.reject(self) + QDialog.reject(self) def wasOk(self): return self._wasOk @@ -69,7 +68,7 @@ class TubeDialog(TubeDialog_UI): length=eval(str(self.txtLength.text())) width=eval(str(self.txtWidth.text())) except: - print "pb a la saisie" + print("pb a la saisie") return radius, length, width @@ -83,13 +82,13 @@ class TubeDialogOnTopWithApply(TubeDialog): """ TubeDialog.setupUi(self) # Add a button "Apply" - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel| - QtGui.QDialogButtonBox.Apply| - QtGui.QDialogButtonBox.Ok) + self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel| + QDialogButtonBox.Apply| + QDialogButtonBox.Ok) # Keep the dialog on top of the windows self.setWindowFlags(self.windowFlags() | - QtCore.Qt.WindowStaysOnTopHint) + Qt.WindowStaysOnTopHint) # @@ -104,14 +103,13 @@ def TEST_getData_synchrone(): tubedialog.exec_() if tubedialog.wasOk(): radius, length, width = tubedialog.getData() - print radius, length, width + print(radius, length, width) def main( args ): - a = QtGui.QApplication(sys.argv) + a = QApplication(sys.argv) TEST_getData_synchrone() sys.exit(0) if __name__=="__main__": main(sys.argv) -