# -*- 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
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
# 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)
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
for _ in range(nC):
x, y = self.__generateRandomData(1000)
lx.append(x); ly.append(y)
- print "Done generating"
+ print("Done generating")
from time import time
t0 = time()
curveplot.LockRepaint()
for i in range(nC):
curveplot.AddCurve(lx[i], ly[i], append=True)
curveplot.UnlockRepaint()
- print "Elapsed: %.2f" % ( time() - t0)
+ print("Elapsed: %.2f" % ( time() - t0))
def clearPlotSet(self):
curveplot.ClearPlotSet()
def addPS(self):
# Also a test for unicode!
- curveplot.AddPlotSet(u'ça m embête')
+ curveplot.AddPlotSet('ça m embête')
def addTab(self):
pass
-# from PyQt4.QtGui import QPushButton
+# from PyQt5.QtWidgets import QPushButton
# self.qp = QPushButton("Hi!")
# self._sgPyQt.createView("Dummy", self.qp)
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 zip(i, t)
+ print(list(zip(i, t)))
new_id = curveplot.CopyCurve(curve_id=0, plot_set_id=1)
- print "created curve: %d" % new_id
+ print("created curve: %d" % new_id)
import resource
m = resource.getrusage(resource.RUSAGE_SELF)[2]*resource.getpagesize()/1e6
- print "** Used memory: %.2f Mb" % m
+ 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)