Salome HOME
style: black format
[tools/sat.git] / data / templates / PythonComponent / src / Dialog / EditPointDialog.py
1 from DialogEdit import *
2 from qtsalome import *
3
4
5 class EditPointDialog(DialogEdit):
6     def __init__(
7         self, helpFile, controller, widgetDialogBox, model, oldPoint, pointRange
8     ):
9         """Constructor"""
10
11         # Initializing parent widget
12         DialogEdit.__init__(self, helpFile, controller, widgetDialogBox)
13
14         self._model = model
15
16         # Reading oldX and oldY
17         oldX = ""
18         oldY = ""
19         i = 0
20         while oldPoint[i] != ":":
21             oldX += oldPoint[i]
22             i += 1
23             pass
24         for j in range(i + 1, len(oldPoint)):
25             oldY += oldPoint[j]
26             pass
27         self.pointRange = pointRange
28         self.entryX.setText(oldX)
29         self.entryY.setText(oldY)
30         pass
31
32     def addSpecialWidgets(self):
33         floatValidator = QDoubleValidator(self)
34
35         lX = QLabel("X", self)
36         self.v11.addWidget(lX)
37         lY = QLabel("Y", self)
38         self.v11.addWidget(lY)
39
40         self.entryX = QLineEdit(self)
41         self.entryX.setValidator(floatValidator)
42         self.v12.addWidget(self.entryX)
43         self.entryY = QLineEdit(self)
44         self.entryY.setValidator(floatValidator)
45         self.v12.addWidget(self.entryY)
46         pass
47
48     def execApply(self):
49         pointRange = self.pointRange
50         newX = float(self.newX)
51         newY = float(self.newY)
52         newPoint = newX, newY
53         self.getController().editPoint(self._model, newPoint, pointRange)
54         return
55
56     def retrieveUserEntries(self):
57         self.newX = str(self.entryX.text())
58         self.newY = str(self.entryY.text())
59         pass
60
61     def checkUserEntries(self):
62         if self.newX == "" or self.newY == "":
63             self.errMessage = "All attributes must be filled"
64             return False
65         return True
66
67
68 pass