1 from PyQt4.QtGui import *
2 from PyQt4.QtCore import *
4 class Dialog( QDialog ) :
6 def __init__( self, helpFile, controller, widgetDialogBox ) :
9 # Initializing parent widget
10 QDialog.__init__( self )
13 self.setObjectName( "Dialog" )
14 self.setWindowTitle( "Dialog data" )
15 self._helpFile = helpFile
16 self._controller = controller
17 self._widgetDialogBox = widgetDialogBox
20 self.mainLayout = QVBoxLayout( self )
21 self.h1 = QHBoxLayout( self )
22 self.h2 = QHBoxLayout( self )
23 self.mainLayout.addLayout( self.h1 )
24 self.mainLayout.addLayout( self.h2 )
25 self.v11 = QVBoxLayout( self)
26 self.v12 = QVBoxLayout( self )
27 self.h1.addLayout( self.v11 )
28 self.h1.addLayout( self.v12 )
30 # Filling layouts with standard widgets( common to all childre )
31 self.fillStandardWidgets()
32 # Adding special widgets to layouts( special to each child )
33 self.addSpecialWidgets()
35 # Connecting widgets to slots
39 def getController( self ) :
40 return self._controller
42 def fillStandardWidgets( self ) :
44 lName = QLabel( "Name", self )
45 self.v11.addWidget( lName )
47 self.entryName = QLineEdit( self )
48 self.v12.addWidget( self.entryName )
51 self.bApply = QPushButton( "Apply", self )
52 self.h2.addWidget( self.bApply )
53 self.bClose = QPushButton( "Close", self )
54 self.h2.addWidget( self.bClose )
55 self.bHelp = QPushButton( "Help", self )
56 self.h2.addWidget( self.bHelp )
59 def addSpecialWidgets( self ) :
60 print 'Virtual method'
63 def connectSlots( self ) :
64 self.connect( self.bApply, SIGNAL( 'clicked()' ), self.apply )
65 self.connect( self.bHelp, SIGNAL( 'clicked()' ), self.help )
66 self.connect( self.bClose, SIGNAL( 'clicked()' ), self.close )
71 self.retrieveUserEntries()
72 if not self.checkUserEntries() :
73 QMessageBox.warning( self, 'information faillure', self.errMessage )
78 def retrieveUserEntries( self ) :
79 self.name = str( self.entryName.text() )
82 def checkUserEntries( self ) :
84 self.errMessage = 'All attributes must be filled'
88 def execApply( self ) :
89 print 'Virtual method'
92 def reInitializeDialog( self ) :
93 print 'Virtual method'
98 os.system( 'firefox ' + self._helpFile + '&' )
102 self._widgetDialogBox.close()