--- /dev/null
+from PyQt4 import QtCore
+from PyQt4.QtGui import *
+from newpersonwizard import NewPersonWizard
+
+class ChooseAction (QWidget):
+ def __init__(self, parent=None):
+ QWidget.__init__(self,parent)
+ self.l1 = QLabel("<center><h1>Select a task:<h1></center>")
+ self.pb1 = QCommandLinkButton("Add a person to the directory","If you haven't seen this program before, hit this button.")
+ self.pb2 = QCommandLinkButton("Edit a directory record","If you've already added your data, but want to edit it, hit this button.")
+ self.pb3 = QCommandLinkButton("Import photos","To match picture from a camera to entered data, hit this button.")
+ self.pb4 = QCommandLinkButton("Export as document","To export the directory as a document for printing, hit this button.")
+ self.layout = QGridLayout()
+ self.layout.addWidget(self.l1,0,0,1,3)
+ self.layout.addWidget(self.pb1,1,1,1,1)
+ self.layout.addWidget(self.pb2,2,1,1,1)
+ self.layout.addWidget(self.pb3,3,1,1,1)
+ self.layout.addWidget(self.pb4,4,1,1,1)
+ QtCore.QObject.connect(self.pb1, QtCore.SIGNAL("clicked()"), self.addPerson)
+ self.setLayout(self.layout)
+ def addPerson(self):
+ wiz = NewPersonWizard()
+ wiz.exec_()
--- /dev/null
+from PyQt4 import QtCore
+from PyQt4.QtGui import *
+
+from chooseaction import ChooseAction
+
+class MainApp (QMainWindow):
+ def __init__(self, Parent=None):
+ QMainWindow.__init__(self, Parent)
+ self.setWindowTitle("Whitepages V3")
+
+ self.center = ChooseAction(self)
+ #self.center = QLabel("<center><h1>Filler</h1></center>")
+ self.setCentralWidget(self.center)
+
+ self.createActions()
+ self.createMenus()
+
+ self.statusBar().showMessage("Ready")
+ self.setUnifiedTitleAndToolBarOnMac(True);
+ self.resize(800,600)
+ self.show()
+
+ def createActions(self):
+ self.fileNewAction = QAction("&New Database",self)
+ QtCore.QObject.connect( self.fileNewAction, QtCore.SIGNAL("triggered()"), self.newFile)
+ self.fileOpenAction = QAction("&Open Database",self)
+ QtCore.QObject.connect( self.fileOpenAction, QtCore.SIGNAL("triggered()"), self.openFile)
+ self.fileImportAction = QAction("&Import (Merge)", self)
+ QtCore.QObject.connect( self.fileImportAction, QtCore.SIGNAL("triggered()"), self.mergeWizard)
+ self.fileQuitAction = QAction("&Quit",self)
+ QtCore.QObject.connect( self.fileQuitAction, QtCore.SIGNAL("triggered()"), self.quit)
+
+
+ def createMenus(self):
+ self.fileMenu = self.menuBar().addMenu("&File")
+ self.fileMenu.addAction(self.fileNewAction)
+ self.fileMenu.addAction(self.fileOpenAction)
+ self.fileMenu.addAction(self.fileImportAction)
+ self.fileMenu.addSeparator()
+ self.fileMenu.addAction(self.fileQuitAction)
+
+
+ def newFile(self):
+ print "Close the existing database, create a new one."
+ def openFile(self):
+ fileName = QFileDialog.getOpenFileName(self, "Open dataset", ".", "Databases (*.db)")
+ print "and then we'd open the db",fileName
+ def mergeWizard(self):
+ fileName = QFileDialog.getOpenFileName(self, "Import which dataset?", ".", "Databases (*.db)" )
+ print "and then we'd import data from",fileName
+ def quit(self):
+ # You could do cleanup, like closing/flushing the database, an "Are you sure you want to quit?"
+ # modal dialog, or saving the window layout/state.
+ qApp.quit()
+
+
+
+if __name__ == "__main__" :
+ app = QApplication([""])
+ widget = MainApp()
+ app.exec_()
+
def __init__(self, parent=None):
QWidget.__init__(self,parent)
self.title = QLabel("<h1>Whitepages v3</h1><h2>Collecting contact information for the dorm</h2>")
- self.instructions = QLabel("&Enter your NetID:")
+ self.instructions = QLabel("Enter your NetID:")
self.netid = QLineEdit()
+ self.instructions.setFocusProxy(self.netid)
self.grid = QGridLayout()
self.grid.addWidget(self.title,0,0,1,2)
self.grid.addWidget(self.instructions,1,0,1,1)
from ldapstep import LDAPStep
from donestep import DoneStep
-class NewPersonWizard(QWidget):
+class NewPersonWizard(QDialog):
def __init__(self, parent=None):
- QWidget.__init__(self, parent)
+ QDialog.__init__(self, parent)
self.setWindowTitle("Whitepages v3")
self.steps = []
self.currentstep = 0
QtCore.QObject.connect( s, QtCore.SIGNAL('submit()'), self.next)
self.layout.addWidget(s,0,0,2,2)
s.hide()
- self.layout.addWidget(self.prev_button,2,0,1,1)
self.layout.addWidget(self.next_button,2,1,1,1)
+ self.layout.addWidget(self.prev_button,2,0,1,1)
self.setLayout(self.layout)
self.resize(400,300)
+ self.setModal(True)
self.show()
self.steps[0].show()
QtCore.QObject.connect( self.prev_button, QtCore.SIGNAL('clicked()'), self.prev)