1 from Dialog import Dialog
4 class CreatePolylineDialog( Dialog ) :
6 def __init__( self, helpFile, controller, widgetDialogBox ) :
9 #Initializing parent widget
10 Dialog.__init__( self, helpFile, controller, widgetDialogBox )
13 nbPolylines = controller.getNbPolylines()
14 self.entryName.setText( "polyline_" + str(nbPolylines+1) )
17 def addSpecialWidgets( self ) :
19 intValidator = QIntValidator( self )
21 lNbPoints = QLabel( "Number of points", self )
22 self.v11.addWidget( lNbPoints )
24 self.entryNbPoints = QLineEdit( self )
25 self.entryNbPoints.setValidator( intValidator )
26 self.entryNbPoints.setText( "10" )
27 self.v12.addWidget( self.entryNbPoints )
30 def execApply( self ) :
32 nbPoints = int( self.nbPoints )
33 self.getController().createPolyline( name, nbPoints )
34 self.reInitializeDialog()
38 def retrieveUserEntries( self ) :
39 self.name = str( self.entryName.text() )
40 self.nbPoints = str( self.entryNbPoints.text() )
43 def checkUserEntries( self ) :
44 if self.name == "" or self.nbPoints == "" :
45 self.errMessage = 'All attributes must be filled'
47 if int( self.nbPoints ) > 10 :
48 self.errMessage = 'The number of points must not exceed 10'
52 def reInitializeDialog( self ) :
53 nbPolylines = self.getController().getNbPolylines()
54 self.entryName.setText( "polyline_" + str(nbPolylines+1) )
55 self.entryNbPoints.setText( "10" )