1 from PyQt4 import QtCore
2 from PyQt4.QtGui import *
3 from newpersonwizard import NewPersonWizard
4 from editperson import EditPerson
6 class ChooseAction (QWidget):
7 def __init__(self, parent=None, db=None):
8 QWidget.__init__(self,parent)
10 self.l1 = QLabel("<h1>Select a task:<h1>")
11 self.l1.setAlignment(QtCore.Qt.AlignCenter)
12 self.pb1 = QCommandLinkButton("&Add a person to the directory","If you haven't seen this program before, hit this button.")
13 self.pb2 = QCommandLinkButton("&Edit a directory record","If you've already added your data, but want to edit it, hit this button.")
14 self.pb3 = QCommandLinkButton("&Import photos","To match picture from a camera to entered data, hit this button.")
15 self.pb4 = QCommandLinkButton("E&xport as document","To export the directory as a document for printing, hit this button.")
16 self.layout = QGridLayout()
17 self.layout.addWidget(self.l1,0,0,1,3)
18 self.layout.addWidget(self.pb1,1,1,1,1)
19 self.layout.addWidget(self.pb2,2,1,1,1)
20 self.layout.addWidget(self.pb3,3,1,1,1)
21 self.layout.addWidget(self.pb4,4,1,1,1)
22 QtCore.QObject.connect(self.pb1, QtCore.SIGNAL("clicked()"), self.addPerson)
23 QtCore.QObject.connect(self.pb2, QtCore.SIGNAL("clicked()"), self.editPerson)
24 QtCore.QObject.connect(self.pb3, QtCore.SIGNAL("clicked()"), self.importPhotos)
25 QtCore.QObject.connect(self.pb4, QtCore.SIGNAL("clicked()"), self.exportDocument)
26 self.setLayout(self.layout)
28 wiz = NewPersonWizard(self,self.db)
32 self.emit(QtCore.SIGNAL("editPerson()"))
33 def importPhotos(self):
35 def exportDocument(self):
36 fileName = QFileDialog.getSaveFileName(self, "Save new file as:", ".", "OpenDocument Text Documents (*.odt)")
37 print "Will export db as",fileName