1 from Dialog import Dialog
2 from PyQt4.QtGui import *
3 from PyQt4.QtCore import *
5 class CreatePolylineDialog( Dialog ) :
7 def __init__( self, helpFile, controller, widgetDialogBox ) :
10 #Initializing parent widget
11 Dialog.__init__( self, helpFile, controller, widgetDialogBox )
14 nbPolylines = controller.getNbPolylines()
15 self.entryName.setText( "polyline_" + str(nbPolylines+1) )
18 def addSpecialWidgets( self ) :
20 intValidator = QIntValidator( self )
22 lNbPoints = QLabel( "Number of points", self )
23 self.v11.addWidget( lNbPoints )
25 self.entryNbPoints = QLineEdit( self )
26 self.entryNbPoints.setValidator( intValidator )
27 self.entryNbPoints.setText( "10" )
28 self.v12.addWidget( self.entryNbPoints )
31 def execApply( self ) :
33 nbPoints = int( self.nbPoints )
34 self.getController().createPolyline( name, nbPoints )
35 self.reInitializeDialog()
39 def retrieveUserEntries( self ) :
40 self.name = str( self.entryName.text() )
41 self.nbPoints = str( self.entryNbPoints.text() )
44 def checkUserEntries( self ) :
45 if self.name == "" or self.nbPoints == "" :
46 self.errMessage = 'All attributes must be filled'
48 if int( self.nbPoints ) > 10 :
49 self.errMessage = 'The number of points must not exceed 10'
53 def reInitializeDialog( self ) :
54 nbPolylines = self.getController().getNbPolylines()
55 self.entryName.setText( "polyline_" + str(nbPolylines+1) )
56 self.entryNbPoints.setText( "10" )