# -*- coding: iso-8859-1 -*-
-# 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-__author__="gboulant"
-__date__ ="$31 mars 2010 17:09:53$"
+from qtsalome import *
+from salome.gui.genericdialog import GenericDialog
+from salome.gui.mytestdialog_ui import Ui_MyTestDialog
-from mytestdialog_ui import Ui_MyTestDialog
-from genericdialog import GenericDialog
class MyTestDialog(GenericDialog):
"""
return name
-from PyQt4.QtCore import SIGNAL
class MyTestDialogWithSignals(MyTestDialog):
"""
This class is to illustrate the usage of the GenericDialog in the
case where the dialog windows is not modal. In such a case, the
controller must be warn of close events using Qt signals.
"""
+
+ inputValidated = pyqtSignal()
+
def __init__(self, parent=None, name="MyTestDialogWithSignals"):
MyTestDialog.__init__(self, parent, name)
# has been validated so that it can process the event
MyTestDialog.accept(self)
if self.wasOk():
- self.emit(SIGNAL('inputValidated()'))
+ self.inputValidated.emit()
def TEST_MyTestDialog_modal():
import sys
- from PyQt4.QtCore import QObject, SIGNAL, SLOT
- from PyQt4.QtGui import QApplication
+ from qtsalome import QApplication
app = QApplication(sys.argv)
- QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+ app.lastWindowClosed.connect(app.quit)
dlg=MyTestDialog()
dlg.setData("A default name")
dlg.displayAndWait()
if dlg.wasOk():
name = dlg.getData()
- print "The name has been modified to",name
+ print("The name has been modified to",name)
class DialogListener:
def onProcessEvent(self):
- print "onProcessEvent(): OK has been pressed"
+ print("onProcessEvent(): OK has been pressed")
import sys
sys.exit(0)
def TEST_MyTestDialog_non_modal():
import sys
- from PyQt4.QtCore import QObject, SIGNAL, SLOT
- from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)
- QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+ app.lastWindowClosed.connect(app.quit)
dlg=MyTestDialogWithSignals()
# This dialog window will emit a inputValidated() signal when the
# connect this signal to a local slot so that the event can be
# processed.
dlgListener = DialogListener()
- app.connect(dlg, SIGNAL('inputValidated()'), dlgListener.onProcessEvent)
+ dlg.inputValidated.connect(dlgListener.onProcessEvent)
# This connect instruction means that the signal inputValidated()
# emited by the dlg Qt object will raise a call to the slot
# dlgListener.onProcessEvent