]> SALOME platform Git repositories - tools/sat.git/blob - data/templates/PythonComponent/src/Dialog/EditPointDialog.py
Salome HOME
aaf8f4609502cdda7c960c9b1a2d5add3203f7e6
[tools/sat.git] / data / templates / PythonComponent / src / Dialog / EditPointDialog.py
1 from DialogEdit import *
2 from PyQt4.QtGui import *
3 from PyQt4.QtCore import *
4
5 class EditPointDialog( DialogEdit ) :
6
7    def __init__( self, helpFile, controller, widgetDialogBox, model, oldPoint, pointRange  ) :
8        """Constructor"""
9
10        #Initializing parent widget
11        DialogEdit.__init__( self, helpFile, controller, widgetDialogBox )
12
13        self._model = model
14
15        #Reading oldX and oldY
16        oldX = ""
17        oldY = ""
18        i = 0
19        while oldPoint[i] != ':' :
20           oldX += oldPoint[i]
21           i += 1
22           pass
23        for j in range( i+1, len(oldPoint) ) :
24           oldY += oldPoint[j]
25           pass
26        self.pointRange = pointRange
27        self.entryX.setText( oldX )
28        self.entryY.setText( oldY )
29        pass
30
31    def addSpecialWidgets( self ) :
32        floatValidator = QDoubleValidator( self )
33
34        lX = QLabel( "X", self )
35        self.v11.addWidget( lX )
36        lY = QLabel( "Y", self )
37        self.v11.addWidget( lY )
38
39        self.entryX = QLineEdit( self )
40        self.entryX.setValidator( floatValidator )
41        self.v12.addWidget( self.entryX )
42        self.entryY = QLineEdit( self )
43        self.entryY.setValidator( floatValidator )
44        self.v12.addWidget( self.entryY )
45        pass
46
47    def execApply( self ) :
48        pointRange = self.pointRange
49        newX = float( self.newX )
50        newY = float( self.newY )
51        newPoint = newX, newY
52        self.getController().editPoint( self._model, newPoint, pointRange )
53        return
54
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 pass