]> SALOME platform Git repositories - tools/sat.git/blob - data/templates/PythonComponent/src/Dialog/CreatePolylineDialog.py
Salome HOME
Debian/Trixie: sat generate a lot of warnings: https://github.com/SalomePlatform...
[tools/sat.git] / data / templates / PythonComponent / src / Dialog / CreatePolylineDialog.py
1 from Dialog import Dialog
2 from qtsalome import *
3
4 class CreatePolylineDialog( Dialog ) :
5
6    def __init__( self, helpFile, controller, widgetDialogBox  ) :
7        """Constructor"""
8
9        #Initializing parent widget
10        Dialog.__init__( self, helpFile, controller, widgetDialogBox )
11
12        #Setting default name
13        nbPolylines = controller.getNbPolylines()
14        self.entryName.setText( "polyline_" + str(nbPolylines+1) )
15        pass
16
17    def addSpecialWidgets( self ) :
18
19        intValidator = QIntValidator( self )
20
21        lNbPoints = QLabel( "Number of points", self )
22        self.v11.addWidget( lNbPoints )
23
24        self.entryNbPoints = QLineEdit( self )
25        self.entryNbPoints.setValidator( intValidator )
26        self.entryNbPoints.setText( "10" )
27        self.v12.addWidget( self.entryNbPoints )
28        pass
29
30    def execApply( self ) :
31        name = self.name
32        nbPoints = int( self.nbPoints )
33        self.getController().createPolyline( name, nbPoints )
34        self.reInitializeDialog()
35        return
36
37
38    def retrieveUserEntries( self ) :
39        self.name = str( self.entryName.text() )
40        self.nbPoints = str( self.entryNbPoints.text() )
41        pass
42
43    def checkUserEntries( self ) :
44        if self.name == "" or self.nbPoints == "" :
45           self.errMessage = 'All attributes must be filled'
46           return False
47        if int( self.nbPoints ) > 10 :
48           self.errMessage = 'The number of points must not exceed 10'
49           return False
50        return True
51
52    def reInitializeDialog( self ) :
53        nbPolylines = self.getController().getNbPolylines()
54        self.entryName.setText( "polyline_" + str(nbPolylines+1) )
55        self.entryNbPoints.setText( "10" )
56        pass
57
58 pass