Salome HOME
Copyright update 2022
[modules/gui.git] / tools / CurvePlot / src / python / test / TestDesktop.py
index 142fcf64f54d1befd02367d44f2793651c8ef48c..7ab9510a7995d8b537ca3511d07b71c15ea5b8c4 100644 (file)
@@ -1,30 +1,27 @@
 # -*- coding: utf-8 -*-
-#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2022  CEA/DEN, EDF R&D
 #
-#  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
 #
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
 #
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 # Author : A. Bruneton
 #
 
-from pyqtside.QtCore import SIGNAL, SLOT, Slot, Qt, QTimer
-from pyqtside.QtGui import QMainWindow,QMenu
+from pyqtside.QtCore import Qt, QTimer, pyqtSlot
+from pyqtside.QtWidgets import QMainWindow,QMenu
 import numpy as np
 
 import curveplot
@@ -70,15 +67,15 @@ class TestDesktop(QMainWindow):
         self.createMenus()
         self.createView()
         
-        self.connect(self.curveSameFigAction,SIGNAL("activated()"),self.curveSameFig)
-        self.connect(self.curveNewFigAction,SIGNAL("activated()"),self.curveNewFig)
-        self.connect(self.itemDelAction,SIGNAL("activated()"),self.itemDel)
-        self.connect(self.cpsAction,SIGNAL("activated()"),self.clearPlotSet)
-        self.connect(self.plotTableAction,SIGNAL("activated()"),self.plotTable)
-        self.connect(self.addPSAction,SIGNAL("activated()"),self.addPS)
-        self.connect(self.addTabAction,SIGNAL("activated()"),self.addTab)
-        self.connect(self.memAction,SIGNAL("activated()"),self.memPrint)
-        self.connect(self.perfTestAction,SIGNAL("activated()"),self.perfTest)
+        self.curveSameFigAction.triggered.connect(self.curveSameFig)
+        self.curveNewFigAction.triggered.connect(self.curveNewFig)
+        self.itemDelAction.triggered.connect(self.itemDel)
+        self.cpsAction.triggered.connect(self.clearPlotSet)
+        self.plotTableAction.triggered.connect(self.plotTable)
+        self.addPSAction.triggered.connect(self.addPS)
+        self.addTabAction.triggered.connect(self.addTab)
+        self.memAction.triggered.connect(self.memPrint)
+        self.perfTestAction.triggered.connect(self.perfTest)
 
     def generateID(self):
         self._currID += 1
@@ -152,7 +149,7 @@ class TestDesktop(QMainWindow):
 #       y = x
       return x, y
        
-    @Slot()  
+    @pyqtSlot()
     def curveSameFig(self):
       x, y = self.__generateRandomData()
       _, ps_id = curveplot.AddCurve(x, y, x_label="the x axis", y_label="the y axis", append=True)
@@ -164,13 +161,13 @@ class TestDesktop(QMainWindow):
       x, y = self.__generateRandomData()
       curveplot.AddCurve(x, y, x_label="the x axis", y_label="the y axis", append=False)
     
-    @Slot()
+    @pyqtSlot()
     def itemDel(self):
       curveplot.DeleteCurrentItem()
       if self.cnt >= 0:
         QTimer.singleShot(self.timeLap, self, SLOT("memPrint()"))
 
-    @Slot()
+    @pyqtSlot()
     def perfTest(self):
       lx, ly = [], []
       nC = 200
@@ -195,7 +192,7 @@ class TestDesktop(QMainWindow):
       
     def addTab(self):
       pass
-#      from PyQt4.QtGui import QPushButton
+#      from PyQt5.QtWidgets import QPushButton
 #      self.qp = QPushButton("Hi!")
 #      self._sgPyQt.createView("Dummy", self.qp)  
       
@@ -213,7 +210,7 @@ class TestDesktop(QMainWindow):
       cont.plotCurveFromTable(t, y_col_index=1, append=False)
       cont.plotCurveFromTable(t, y_col_index=2, append=True)
     
-    @Slot()
+    @pyqtSlot()
     def memPrint(self):
       i, t = curveplot.GetAllPlotSets()
       print(list(zip(i, t)))
@@ -224,4 +221,4 @@ class TestDesktop(QMainWindow):
       print("** Used memory: %.2f Mb" % m)
       if self.cnt >= 0 and self.cnt < self.MAX_CNT:
         self.cnt += 1
-        QTimer.singleShot(self.timeLap, self, SLOT("curveSameFig()"))
+        QTimer.singleShot(self.timeLap, self.curveSameFig)