1 from pyqtside import QtGui, QtCore
2 from pyqtside.uic import loadUiGen
3 from utils import completeResPath
5 class PlotSettings(QtGui.QDialog):
7 QtGui.QDialog.__init__(self)
8 loadUiGen(completeResPath("PlotSettings.ui"), self)
12 self.legendPositionComboBox.addItem("Bottom")
13 self.legendPositionComboBox.addItem("Right")
19 def onShowLegend(self, index):
21 self.legendPositionComboBox.setEnabled(True)
23 self.legendPositionComboBox.setEnabled(False)
26 def onChangeColor(self):
27 col = QtGui.QColorDialog.getColor()
30 r, g, b = [c/255.0 for c in col.getRgb()[:3]]
33 def setSelectedCurveName(self, name):
35 self.selectedCurvePanel.setTitle("Selected curve : " + name)
36 self.selectedCurvePanel.show()
38 self.selectedCurvePanel.hide()
40 def setRGB(self, r, g, b):
44 self.colorCurve.setIcon(QtGui.QIcon(self.drawColorPixmap(int(r*255), int(g*255), int(b*255))))
47 return self._r, self._g, self._b
49 def drawColorPixmap(self, r, g, b):
50 pix = QtGui.QPixmap( 16, 16 )
51 color = QtGui.QColor(r, g, b)
56 xminText = unicode(self.axisXMinEdit.text())
57 xmaxText = unicode(self.axisXMaxEdit.text())
58 yminText = unicode(self.axisYMinEdit.text())
59 ymaxText = unicode(self.axisYMaxEdit.text())
60 if (yminText == "" or ymaxText == "") :
61 QtGui.QMessageBox.critical(self, "Plot settings", "A field \"YMin\" or \"YMax\" is empty")
64 xmin = float(xminText)
66 QtGui.QMessageBox.critical(self, "Plot settings", "It is not possible to convert XMin")
68 xmax = float(xmaxText)
70 QtGui.QMessageBox.critical(self, "Plot settings", "It is not possible to convert XMax")
72 ymin = float(yminText)
74 QtGui.QMessageBox.critical(self, "Plot settings", "It is not possible to convert YMin")
76 ymax = float(ymaxText)
78 QtGui.QMessageBox.critical(self, "Plot settings", "It is not possible to convert YMax")
79 if ((xmax-xmin) == 0) :
80 QtGui.QMessageBox.critical(self, "Plot settings", "XMax is is equal to XMin.")
82 if ((ymax-ymin) == 0) :
83 QtGui.QMessageBox.critical(self, "Plot settings", "YMax is is equal to YMin.")
85 if ((xmax-xmin) < 0) :
86 QtGui.QMessageBox.warning(self, "Plot settings", "XMax is less than XMin.")
87 if ((ymax-ymin) < 0) :
88 QtGui.QMessageBox.warning(self, "Plot settings", "YMax is less than YMin.")
89 super(PlotSettings, self).accept()