3 class Dialog( QDialog ) :
5 def __init__( self, helpFile, controller, widgetDialogBox ) :
8 # Initializing parent widget
9 QDialog.__init__( self )
12 self.setObjectName( "Dialog" )
13 self.setWindowTitle( "Dialog data" )
14 self._helpFile = helpFile
15 self._controller = controller
16 self._widgetDialogBox = widgetDialogBox
19 self.mainLayout = QVBoxLayout( self )
20 self.h1 = QHBoxLayout( self )
21 self.h2 = QHBoxLayout( self )
22 self.mainLayout.addLayout( self.h1 )
23 self.mainLayout.addLayout( self.h2 )
24 self.v11 = QVBoxLayout( self)
25 self.v12 = QVBoxLayout( self )
26 self.h1.addLayout( self.v11 )
27 self.h1.addLayout( self.v12 )
29 # Filling layouts with standard widgets( common to all childre )
30 self.fillStandardWidgets()
31 # Adding special widgets to layouts( special to each child )
32 self.addSpecialWidgets()
34 # Connecting widgets to slots
38 def getController( self ) :
39 return self._controller
41 def fillStandardWidgets( self ) :
43 lName = QLabel( "Name", self )
44 self.v11.addWidget( lName )
46 self.entryName = QLineEdit( self )
47 self.v12.addWidget( self.entryName )
50 self.bApply = QPushButton( "Apply", self )
51 self.h2.addWidget( self.bApply )
52 self.bClose = QPushButton( "Close", self )
53 self.h2.addWidget( self.bClose )
54 self.bHelp = QPushButton( "Help", self )
55 self.h2.addWidget( self.bHelp )
58 def addSpecialWidgets( self ) :
59 print('Virtual method')
62 def connectSlots( self ) :
63 self.bApply.clicked.connect(self.apply)
64 self.bHelp.clicked.connect(self.help)
65 self.bClose.clicked.connect(self.close)
70 self.retrieveUserEntries()
71 if not self.checkUserEntries() :
72 QMessageBox.warning( self, 'information faillure', self.errMessage )
77 def retrieveUserEntries( self ) :
78 self.name = str( self.entryName.text() )
81 def checkUserEntries( self ) :
83 self.errMessage = 'All attributes must be filled'
87 def execApply( self ) :
88 print('Virtual method')
91 def reInitializeDialog( self ) :
92 print('Virtual method')
97 os.system( 'firefox ' + self._helpFile + '&' )
101 self._widgetDialogBox.close()